From 3652eb254a8255065490e9aa3e2722bf10dfaa76 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Wed, 16 Oct 2019 12:36:04 +0800 Subject: [PATCH] Generated from 16ff787a51dc55db850a3486cccf7780722c1e41 (#6018) Revert changes in input-files to avoid errors --- profiles/latest/sql/mgmt/sql/models.go | 592 +- profiles/latest/sql/mgmt/sql/sqlapi/models.go | 27 + profiles/preview/sql/mgmt/sql/models.go | 592 +- .../preview/sql/mgmt/sql/sqlapi/models.go | 27 + .../sql/backuplongtermretentionpolicies.go | 298 + .../sql/backuplongtermretentionvaults.go | 292 + .../sql/mgmt/2014-04-01/sql/capabilities.go | 118 + .../mgmt/2014-04-01/sql/databaseadvisors.go | 292 + .../sql/databaseconnectionpolicies.go | 212 + services/sql/mgmt/2014-04-01/sql/databases.go | 162 + .../sql/databasetableauditingpolicies.go | 292 + .../sql/mgmt/2014-04-01/sql/databaseusages.go | 123 + .../2014-04-01/sql/datamaskingpolicies.go | 210 + .../mgmt/2014-04-01/sql/datamaskingrules.go | 223 + .../sql/disasterrecoveryconfigurations.go | 520 ++ .../sql/mgmt/2014-04-01/sql/elasticpools.go | 162 + .../sql/mgmt/2014-04-01/sql/extensions.go | 203 + .../mgmt/2014-04-01/sql/geobackuppolicies.go | 297 + services/sql/mgmt/2014-04-01/sql/models.go | 5355 +++++++++++++---- .../sql/mgmt/2014-04-01/sql/operations.go | 111 + services/sql/mgmt/2014-04-01/sql/queries.go | 123 + .../mgmt/2014-04-01/sql/querystatistics.go | 125 + .../sql/mgmt/2014-04-01/sql/querytexts.go | 125 + .../2014-04-01/sql/recoverabledatabases.go | 201 + .../sql/restorabledroppeddatabases.go | 202 + .../sql/mgmt/2014-04-01/sql/restorepoints.go | 123 + .../sql/mgmt/2014-04-01/sql/serveradvisors.go | 371 ++ .../sql/serverazureadadministrators.go | 374 ++ .../sql/servercommunicationlinks.go | 373 ++ .../sql/serverconnectionpolicies.go | 206 + services/sql/mgmt/2014-04-01/sql/servers.go | 466 ++ .../sql/servertableauditingpolicies.go | 285 + .../sql/mgmt/2014-04-01/sql/serverusages.go | 121 + .../mgmt/2014-04-01/sql/serviceobjectives.go | 201 + .../mgmt/2014-04-01/sql/sqlapi/interfaces.go | 243 +- ...transparentdataencryptionconfigurations.go | 126 + 36 files changed, 12674 insertions(+), 1099 deletions(-) create mode 100644 services/sql/mgmt/2014-04-01/sql/backuplongtermretentionpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/backuplongtermretentionvaults.go create mode 100644 services/sql/mgmt/2014-04-01/sql/capabilities.go create mode 100644 services/sql/mgmt/2014-04-01/sql/databaseadvisors.go create mode 100644 services/sql/mgmt/2014-04-01/sql/databaseconnectionpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/databasetableauditingpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/databaseusages.go create mode 100644 services/sql/mgmt/2014-04-01/sql/datamaskingpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/datamaskingrules.go create mode 100644 services/sql/mgmt/2014-04-01/sql/disasterrecoveryconfigurations.go create mode 100644 services/sql/mgmt/2014-04-01/sql/extensions.go create mode 100644 services/sql/mgmt/2014-04-01/sql/geobackuppolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/operations.go create mode 100644 services/sql/mgmt/2014-04-01/sql/queries.go create mode 100644 services/sql/mgmt/2014-04-01/sql/querystatistics.go create mode 100644 services/sql/mgmt/2014-04-01/sql/querytexts.go create mode 100644 services/sql/mgmt/2014-04-01/sql/recoverabledatabases.go create mode 100644 services/sql/mgmt/2014-04-01/sql/restorabledroppeddatabases.go create mode 100644 services/sql/mgmt/2014-04-01/sql/restorepoints.go create mode 100644 services/sql/mgmt/2014-04-01/sql/serveradvisors.go create mode 100644 services/sql/mgmt/2014-04-01/sql/serverazureadadministrators.go create mode 100644 services/sql/mgmt/2014-04-01/sql/servercommunicationlinks.go create mode 100644 services/sql/mgmt/2014-04-01/sql/serverconnectionpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/servertableauditingpolicies.go create mode 100644 services/sql/mgmt/2014-04-01/sql/serverusages.go create mode 100644 services/sql/mgmt/2014-04-01/sql/serviceobjectives.go create mode 100644 services/sql/mgmt/2014-04-01/sql/transparentdataencryptionconfigurations.go diff --git a/profiles/latest/sql/mgmt/sql/models.go b/profiles/latest/sql/mgmt/sql/models.go index 21281d393c61..250d9c622dff 100644 --- a/profiles/latest/sql/mgmt/sql/models.go +++ b/profiles/latest/sql/mgmt/sql/models.go @@ -25,6 +25,15 @@ const ( DefaultBaseURI = original.DefaultBaseURI ) +type AdvisorStatus = original.AdvisorStatus + +const ( + GA AdvisorStatus = original.GA + LimitedPublicPreview AdvisorStatus = original.LimitedPublicPreview + PrivatePreview AdvisorStatus = original.PrivatePreview + PublicPreview AdvisorStatus = original.PublicPreview +) + type AuthenticationType = original.AuthenticationType const ( @@ -32,6 +41,30 @@ const ( SQL AuthenticationType = original.SQL ) +type AutoExecuteStatus = original.AutoExecuteStatus + +const ( + Default AutoExecuteStatus = original.Default + Disabled AutoExecuteStatus = original.Disabled + Enabled AutoExecuteStatus = original.Enabled +) + +type BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyState + +const ( + BackupLongTermRetentionPolicyStateDisabled BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyStateDisabled + BackupLongTermRetentionPolicyStateEnabled BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyStateEnabled +) + +type CapabilityStatus = original.CapabilityStatus + +const ( + CapabilityStatusAvailable CapabilityStatus = original.CapabilityStatusAvailable + CapabilityStatusDefault CapabilityStatus = original.CapabilityStatusDefault + CapabilityStatusDisabled CapabilityStatus = original.CapabilityStatusDisabled + CapabilityStatusVisible CapabilityStatus = original.CapabilityStatusVisible +) + type CheckNameAvailabilityReason = original.CheckNameAvailabilityReason const ( @@ -42,14 +75,39 @@ const ( type CreateMode = original.CreateMode const ( - Copy CreateMode = original.Copy - Default CreateMode = original.Default - NonReadableSecondary CreateMode = original.NonReadableSecondary - OnlineSecondary CreateMode = original.OnlineSecondary - PointInTimeRestore CreateMode = original.PointInTimeRestore - Recovery CreateMode = original.Recovery - Restore CreateMode = original.Restore - RestoreLongTermRetentionBackup CreateMode = original.RestoreLongTermRetentionBackup + CreateModeCopy CreateMode = original.CreateModeCopy + CreateModeDefault CreateMode = original.CreateModeDefault + CreateModeNonReadableSecondary CreateMode = original.CreateModeNonReadableSecondary + CreateModeOnlineSecondary CreateMode = original.CreateModeOnlineSecondary + CreateModePointInTimeRestore CreateMode = original.CreateModePointInTimeRestore + CreateModeRecovery CreateMode = original.CreateModeRecovery + CreateModeRestore CreateMode = original.CreateModeRestore + CreateModeRestoreLongTermRetentionBackup CreateMode = original.CreateModeRestoreLongTermRetentionBackup +) + +type DataMaskingFunction = original.DataMaskingFunction + +const ( + DataMaskingFunctionCCN DataMaskingFunction = original.DataMaskingFunctionCCN + DataMaskingFunctionDefault DataMaskingFunction = original.DataMaskingFunctionDefault + DataMaskingFunctionEmail DataMaskingFunction = original.DataMaskingFunctionEmail + DataMaskingFunctionNumber DataMaskingFunction = original.DataMaskingFunctionNumber + DataMaskingFunctionSSN DataMaskingFunction = original.DataMaskingFunctionSSN + DataMaskingFunctionText DataMaskingFunction = original.DataMaskingFunctionText +) + +type DataMaskingRuleState = original.DataMaskingRuleState + +const ( + DataMaskingRuleStateDisabled DataMaskingRuleState = original.DataMaskingRuleStateDisabled + DataMaskingRuleStateEnabled DataMaskingRuleState = original.DataMaskingRuleStateEnabled +) + +type DataMaskingState = original.DataMaskingState + +const ( + DataMaskingStateDisabled DataMaskingState = original.DataMaskingStateDisabled + DataMaskingStateEnabled DataMaskingState = original.DataMaskingStateEnabled ) type DatabaseEdition = original.DatabaseEdition @@ -71,6 +129,37 @@ const ( Web DatabaseEdition = original.Web ) +type DisasterRecoveryConfigurationAutoFailover = original.DisasterRecoveryConfigurationAutoFailover + +const ( + Off DisasterRecoveryConfigurationAutoFailover = original.Off + On DisasterRecoveryConfigurationAutoFailover = original.On +) + +type DisasterRecoveryConfigurationFailoverPolicy = original.DisasterRecoveryConfigurationFailoverPolicy + +const ( + Automatic DisasterRecoveryConfigurationFailoverPolicy = original.Automatic + Manual DisasterRecoveryConfigurationFailoverPolicy = original.Manual +) + +type DisasterRecoveryConfigurationRole = original.DisasterRecoveryConfigurationRole + +const ( + None DisasterRecoveryConfigurationRole = original.None + Primary DisasterRecoveryConfigurationRole = original.Primary + Secondary DisasterRecoveryConfigurationRole = original.Secondary +) + +type DisasterRecoveryConfigurationStatus = original.DisasterRecoveryConfigurationStatus + +const ( + Creating DisasterRecoveryConfigurationStatus = original.Creating + Dropping DisasterRecoveryConfigurationStatus = original.Dropping + FailingOver DisasterRecoveryConfigurationStatus = original.FailingOver + Ready DisasterRecoveryConfigurationStatus = original.Ready +) + type ElasticPoolEdition = original.ElasticPoolEdition const ( @@ -84,9 +173,79 @@ const ( type ElasticPoolState = original.ElasticPoolState const ( - Creating ElasticPoolState = original.Creating - Disabled ElasticPoolState = original.Disabled - Ready ElasticPoolState = original.Ready + ElasticPoolStateCreating ElasticPoolState = original.ElasticPoolStateCreating + ElasticPoolStateDisabled ElasticPoolState = original.ElasticPoolStateDisabled + ElasticPoolStateReady ElasticPoolState = original.ElasticPoolStateReady +) + +type GeoBackupPolicyState = original.GeoBackupPolicyState + +const ( + GeoBackupPolicyStateDisabled GeoBackupPolicyState = original.GeoBackupPolicyStateDisabled + GeoBackupPolicyStateEnabled GeoBackupPolicyState = original.GeoBackupPolicyStateEnabled +) + +type MaxSizeUnits = original.MaxSizeUnits + +const ( + Gigabytes MaxSizeUnits = original.Gigabytes + Megabytes MaxSizeUnits = original.Megabytes + Petabytes MaxSizeUnits = original.Petabytes + Terabytes MaxSizeUnits = original.Terabytes +) + +type PerformanceLevelUnit = original.PerformanceLevelUnit + +const ( + DTU PerformanceLevelUnit = original.DTU +) + +type PrimaryAggregationType = original.PrimaryAggregationType + +const ( + PrimaryAggregationTypeAverage PrimaryAggregationType = original.PrimaryAggregationTypeAverage + PrimaryAggregationTypeCount PrimaryAggregationType = original.PrimaryAggregationTypeCount + PrimaryAggregationTypeMaximum PrimaryAggregationType = original.PrimaryAggregationTypeMaximum + PrimaryAggregationTypeMinimum PrimaryAggregationType = original.PrimaryAggregationTypeMinimum + PrimaryAggregationTypeNone PrimaryAggregationType = original.PrimaryAggregationTypeNone + PrimaryAggregationTypeTotal PrimaryAggregationType = original.PrimaryAggregationTypeTotal +) + +type QueryAggregationFunction = original.QueryAggregationFunction + +const ( + Avg QueryAggregationFunction = original.Avg + Max QueryAggregationFunction = original.Max + Min QueryAggregationFunction = original.Min + Sum QueryAggregationFunction = original.Sum +) + +type QueryExecutionType = original.QueryExecutionType + +const ( + Aborted QueryExecutionType = original.Aborted + Any QueryExecutionType = original.Any + Exception QueryExecutionType = original.Exception + Irregular QueryExecutionType = original.Irregular + Regular QueryExecutionType = original.Regular +) + +type QueryMetricUnit = original.QueryMetricUnit + +const ( + KB QueryMetricUnit = original.KB + Microseconds QueryMetricUnit = original.Microseconds + Percentage QueryMetricUnit = original.Percentage +) + +type QueryObservedMetricType = original.QueryObservedMetricType + +const ( + CPU QueryObservedMetricType = original.CPU + Duration QueryObservedMetricType = original.Duration + ExecutionCount QueryObservedMetricType = original.ExecutionCount + Io QueryObservedMetricType = original.Io + Logio QueryObservedMetricType = original.Logio ) type ReadScale = original.ReadScale @@ -148,6 +307,13 @@ const ( SUSPENDED ReplicationState = original.SUSPENDED ) +type RestorePointType = original.RestorePointType + +const ( + CONTINUOUS RestorePointType = original.CONTINUOUS + DISCRETE RestorePointType = original.DISCRETE +) + type SampleName = original.SampleName const ( @@ -176,6 +342,28 @@ const ( SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = original.SecurityAlertPolicyUseServerDefaultEnabled ) +type ServerConnectionType = original.ServerConnectionType + +const ( + ServerConnectionTypeDefault ServerConnectionType = original.ServerConnectionTypeDefault + ServerConnectionTypeProxy ServerConnectionType = original.ServerConnectionTypeProxy + ServerConnectionTypeRedirect ServerConnectionType = original.ServerConnectionTypeRedirect +) + +type ServerState = original.ServerState + +const ( + ServerStateDisabled ServerState = original.ServerStateDisabled + ServerStateReady ServerState = original.ServerStateReady +) + +type ServerVersion = original.ServerVersion + +const ( + OneTwoFullStopZero ServerVersion = original.OneTwoFullStopZero + TwoFullStopZero ServerVersion = original.TwoFullStopZero +) + type ServiceObjectiveName = original.ServiceObjectiveName const ( @@ -267,16 +455,70 @@ const ( TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = original.TransparentDataEncryptionStatusEnabled ) +type UnitDefinitionType = original.UnitDefinitionType + +const ( + Bytes UnitDefinitionType = original.Bytes + BytesPerSecond UnitDefinitionType = original.BytesPerSecond + Count UnitDefinitionType = original.Count + CountPerSecond UnitDefinitionType = original.CountPerSecond + Percent UnitDefinitionType = original.Percent + Seconds UnitDefinitionType = original.Seconds +) + +type UnitType = original.UnitType + +const ( + UnitTypeBytes UnitType = original.UnitTypeBytes + UnitTypeBytesPerSecond UnitType = original.UnitTypeBytesPerSecond + UnitTypeCount UnitType = original.UnitTypeCount + UnitTypeCountPerSecond UnitType = original.UnitTypeCountPerSecond + UnitTypePercent UnitType = original.UnitTypePercent + UnitTypeSeconds UnitType = original.UnitTypeSeconds +) + +type Advisor = original.Advisor +type AdvisorListResult = original.AdvisorListResult +type AdvisorProperties = original.AdvisorProperties +type BackupLongTermRetentionPoliciesClient = original.BackupLongTermRetentionPoliciesClient +type BackupLongTermRetentionPoliciesCreateOrUpdateFuture = original.BackupLongTermRetentionPoliciesCreateOrUpdateFuture +type BackupLongTermRetentionPolicy = original.BackupLongTermRetentionPolicy +type BackupLongTermRetentionPolicyListResult = original.BackupLongTermRetentionPolicyListResult +type BackupLongTermRetentionPolicyProperties = original.BackupLongTermRetentionPolicyProperties +type BackupLongTermRetentionVault = original.BackupLongTermRetentionVault +type BackupLongTermRetentionVaultListResult = original.BackupLongTermRetentionVaultListResult +type BackupLongTermRetentionVaultProperties = original.BackupLongTermRetentionVaultProperties +type BackupLongTermRetentionVaultsClient = original.BackupLongTermRetentionVaultsClient +type BackupLongTermRetentionVaultsCreateOrUpdateFuture = original.BackupLongTermRetentionVaultsCreateOrUpdateFuture type BaseClient = original.BaseClient +type CapabilitiesClient = original.CapabilitiesClient type CheckNameAvailabilityRequest = original.CheckNameAvailabilityRequest type CheckNameAvailabilityResponse = original.CheckNameAvailabilityResponse +type DataMaskingPoliciesClient = original.DataMaskingPoliciesClient +type DataMaskingPolicy = original.DataMaskingPolicy +type DataMaskingPolicyProperties = original.DataMaskingPolicyProperties +type DataMaskingRule = original.DataMaskingRule +type DataMaskingRuleListResult = original.DataMaskingRuleListResult +type DataMaskingRuleProperties = original.DataMaskingRuleProperties +type DataMaskingRulesClient = original.DataMaskingRulesClient type Database = original.Database +type DatabaseAdvisorsClient = original.DatabaseAdvisorsClient +type DatabaseConnectionPoliciesClient = original.DatabaseConnectionPoliciesClient +type DatabaseConnectionPolicy = original.DatabaseConnectionPolicy +type DatabaseConnectionPolicyProperties = original.DatabaseConnectionPolicyProperties type DatabaseListResult = original.DatabaseListResult type DatabaseProperties = original.DatabaseProperties type DatabaseSecurityAlertPolicy = original.DatabaseSecurityAlertPolicy type DatabaseSecurityAlertPolicyProperties = original.DatabaseSecurityAlertPolicyProperties +type DatabaseTableAuditingPoliciesClient = original.DatabaseTableAuditingPoliciesClient +type DatabaseTableAuditingPolicy = original.DatabaseTableAuditingPolicy +type DatabaseTableAuditingPolicyListResult = original.DatabaseTableAuditingPolicyListResult +type DatabaseTableAuditingPolicyProperties = original.DatabaseTableAuditingPolicyProperties type DatabaseThreatDetectionPoliciesClient = original.DatabaseThreatDetectionPoliciesClient type DatabaseUpdate = original.DatabaseUpdate +type DatabaseUsage = original.DatabaseUsage +type DatabaseUsageListResult = original.DatabaseUsageListResult +type DatabaseUsagesClient = original.DatabaseUsagesClient type DatabasesClient = original.DatabasesClient type DatabasesCreateImportOperationFuture = original.DatabasesCreateImportOperationFuture type DatabasesCreateOrUpdateFuture = original.DatabasesCreateOrUpdateFuture @@ -285,6 +527,15 @@ type DatabasesImportFuture = original.DatabasesImportFuture type DatabasesPauseFuture = original.DatabasesPauseFuture type DatabasesResumeFuture = original.DatabasesResumeFuture type DatabasesUpdateFuture = original.DatabasesUpdateFuture +type DisasterRecoveryConfiguration = original.DisasterRecoveryConfiguration +type DisasterRecoveryConfigurationListResult = original.DisasterRecoveryConfigurationListResult +type DisasterRecoveryConfigurationProperties = original.DisasterRecoveryConfigurationProperties +type DisasterRecoveryConfigurationsClient = original.DisasterRecoveryConfigurationsClient +type DisasterRecoveryConfigurationsCreateOrUpdateFuture = original.DisasterRecoveryConfigurationsCreateOrUpdateFuture +type DisasterRecoveryConfigurationsDeleteFuture = original.DisasterRecoveryConfigurationsDeleteFuture +type DisasterRecoveryConfigurationsFailoverAllowDataLossFuture = original.DisasterRecoveryConfigurationsFailoverAllowDataLossFuture +type DisasterRecoveryConfigurationsFailoverFuture = original.DisasterRecoveryConfigurationsFailoverFuture +type EditionCapability = original.EditionCapability type ElasticPool = original.ElasticPool type ElasticPoolActivitiesClient = original.ElasticPoolActivitiesClient type ElasticPoolActivity = original.ElasticPoolActivity @@ -294,24 +545,57 @@ type ElasticPoolDatabaseActivitiesClient = original.ElasticPoolDatabaseActivitie type ElasticPoolDatabaseActivity = original.ElasticPoolDatabaseActivity type ElasticPoolDatabaseActivityListResult = original.ElasticPoolDatabaseActivityListResult type ElasticPoolDatabaseActivityProperties = original.ElasticPoolDatabaseActivityProperties +type ElasticPoolDtuCapability = original.ElasticPoolDtuCapability +type ElasticPoolEditionCapability = original.ElasticPoolEditionCapability type ElasticPoolListResult = original.ElasticPoolListResult +type ElasticPoolPerDatabaseMaxDtuCapability = original.ElasticPoolPerDatabaseMaxDtuCapability +type ElasticPoolPerDatabaseMinDtuCapability = original.ElasticPoolPerDatabaseMinDtuCapability type ElasticPoolProperties = original.ElasticPoolProperties type ElasticPoolUpdate = original.ElasticPoolUpdate type ElasticPoolsClient = original.ElasticPoolsClient type ElasticPoolsCreateOrUpdateFuture = original.ElasticPoolsCreateOrUpdateFuture type ElasticPoolsUpdateFuture = original.ElasticPoolsUpdateFuture type ExportRequest = original.ExportRequest +type ExtensionListResult = original.ExtensionListResult +type ExtensionsClient = original.ExtensionsClient type FirewallRule = original.FirewallRule type FirewallRuleListResult = original.FirewallRuleListResult type FirewallRuleProperties = original.FirewallRuleProperties type FirewallRulesClient = original.FirewallRulesClient +type GeoBackupPoliciesClient = original.GeoBackupPoliciesClient +type GeoBackupPolicy = original.GeoBackupPolicy +type GeoBackupPolicyListResult = original.GeoBackupPolicyListResult +type GeoBackupPolicyProperties = original.GeoBackupPolicyProperties type ImportExportResponse = original.ImportExportResponse type ImportExportResponseProperties = original.ImportExportResponseProperties type ImportExtensionProperties = original.ImportExtensionProperties type ImportExtensionRequest = original.ImportExtensionRequest type ImportRequest = original.ImportRequest +type LocationCapabilities = original.LocationCapabilities +type MaxSizeCapability = original.MaxSizeCapability +type Metric = original.Metric +type MetricAvailability = original.MetricAvailability +type MetricDefinition = original.MetricDefinition +type MetricDefinitionListResult = original.MetricDefinitionListResult +type MetricListResult = original.MetricListResult +type MetricName = original.MetricName +type MetricValue = original.MetricValue +type Operation = original.Operation +type OperationDisplay = original.OperationDisplay type OperationImpact = original.OperationImpact +type OperationListResult = original.OperationListResult +type OperationsClient = original.OperationsClient +type PerformanceLevel = original.PerformanceLevel type ProxyResource = original.ProxyResource +type QueriesClient = original.QueriesClient +type QueryInterval = original.QueryInterval +type QueryMetric = original.QueryMetric +type QueryStatistic = original.QueryStatistic +type QueryStatisticListResult = original.QueryStatisticListResult +type QueryStatisticsClient = original.QueryStatisticsClient +type QueryText = original.QueryText +type QueryTextListResult = original.QueryTextListResult +type QueryTextsClient = original.QueryTextsClient type RecommendedElasticPool = original.RecommendedElasticPool type RecommendedElasticPoolListMetricsResult = original.RecommendedElasticPoolListMetricsResult type RecommendedElasticPoolListResult = original.RecommendedElasticPoolListResult @@ -320,6 +604,10 @@ type RecommendedElasticPoolProperties = original.RecommendedElasticPoolPropertie type RecommendedElasticPoolsClient = original.RecommendedElasticPoolsClient type RecommendedIndex = original.RecommendedIndex type RecommendedIndexProperties = original.RecommendedIndexProperties +type RecoverableDatabase = original.RecoverableDatabase +type RecoverableDatabaseListResult = original.RecoverableDatabaseListResult +type RecoverableDatabaseProperties = original.RecoverableDatabaseProperties +type RecoverableDatabasesClient = original.RecoverableDatabasesClient type ReplicationLink = original.ReplicationLink type ReplicationLinkListResult = original.ReplicationLinkListResult type ReplicationLinkProperties = original.ReplicationLinkProperties @@ -327,36 +615,141 @@ type ReplicationLinksClient = original.ReplicationLinksClient type ReplicationLinksFailoverAllowDataLossFuture = original.ReplicationLinksFailoverAllowDataLossFuture type ReplicationLinksFailoverFuture = original.ReplicationLinksFailoverFuture type Resource = original.Resource +type RestorableDroppedDatabase = original.RestorableDroppedDatabase +type RestorableDroppedDatabaseListResult = original.RestorableDroppedDatabaseListResult +type RestorableDroppedDatabaseProperties = original.RestorableDroppedDatabaseProperties +type RestorableDroppedDatabasesClient = original.RestorableDroppedDatabasesClient +type RestorePoint = original.RestorePoint +type RestorePointListResult = original.RestorePointListResult +type RestorePointProperties = original.RestorePointProperties +type RestorePointsClient = original.RestorePointsClient +type Server = original.Server +type ServerAdministratorListResult = original.ServerAdministratorListResult +type ServerAdministratorProperties = original.ServerAdministratorProperties +type ServerAdvisorsClient = original.ServerAdvisorsClient +type ServerAzureADAdministrator = original.ServerAzureADAdministrator +type ServerAzureADAdministratorsClient = original.ServerAzureADAdministratorsClient +type ServerAzureADAdministratorsCreateOrUpdateFuture = original.ServerAzureADAdministratorsCreateOrUpdateFuture +type ServerAzureADAdministratorsDeleteFuture = original.ServerAzureADAdministratorsDeleteFuture +type ServerCommunicationLink = original.ServerCommunicationLink +type ServerCommunicationLinkListResult = original.ServerCommunicationLinkListResult +type ServerCommunicationLinkProperties = original.ServerCommunicationLinkProperties +type ServerCommunicationLinksClient = original.ServerCommunicationLinksClient +type ServerCommunicationLinksCreateOrUpdateFuture = original.ServerCommunicationLinksCreateOrUpdateFuture +type ServerConnectionPoliciesClient = original.ServerConnectionPoliciesClient +type ServerConnectionPolicy = original.ServerConnectionPolicy +type ServerConnectionPolicyProperties = original.ServerConnectionPolicyProperties +type ServerListResult = original.ServerListResult +type ServerProperties = original.ServerProperties +type ServerTableAuditingPoliciesClient = original.ServerTableAuditingPoliciesClient +type ServerTableAuditingPolicy = original.ServerTableAuditingPolicy +type ServerTableAuditingPolicyListResult = original.ServerTableAuditingPolicyListResult +type ServerTableAuditingPolicyProperties = original.ServerTableAuditingPolicyProperties +type ServerUpdate = original.ServerUpdate +type ServerUsage = original.ServerUsage +type ServerUsageListResult = original.ServerUsageListResult +type ServerUsagesClient = original.ServerUsagesClient +type ServerVersionCapability = original.ServerVersionCapability type ServersClient = original.ServersClient +type ServiceObjective = original.ServiceObjective +type ServiceObjectiveCapability = original.ServiceObjectiveCapability +type ServiceObjectiveListResult = original.ServiceObjectiveListResult +type ServiceObjectiveProperties = original.ServiceObjectiveProperties +type ServiceObjectivesClient = original.ServiceObjectivesClient type ServiceTierAdvisor = original.ServiceTierAdvisor type ServiceTierAdvisorListResult = original.ServiceTierAdvisorListResult type ServiceTierAdvisorProperties = original.ServiceTierAdvisorProperties type ServiceTierAdvisorsClient = original.ServiceTierAdvisorsClient type SloUsageMetric = original.SloUsageMetric +type TableAuditingPolicyProperties = original.TableAuditingPolicyProperties +type TopQueries = original.TopQueries +type TopQueriesListResult = original.TopQueriesListResult type TrackedResource = original.TrackedResource type TransparentDataEncryption = original.TransparentDataEncryption type TransparentDataEncryptionActivitiesClient = original.TransparentDataEncryptionActivitiesClient type TransparentDataEncryptionActivity = original.TransparentDataEncryptionActivity type TransparentDataEncryptionActivityListResult = original.TransparentDataEncryptionActivityListResult type TransparentDataEncryptionActivityProperties = original.TransparentDataEncryptionActivityProperties +type TransparentDataEncryptionConfigurationsClient = original.TransparentDataEncryptionConfigurationsClient +type TransparentDataEncryptionListResult = original.TransparentDataEncryptionListResult type TransparentDataEncryptionProperties = original.TransparentDataEncryptionProperties type TransparentDataEncryptionsClient = original.TransparentDataEncryptionsClient func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { + return original.NewBackupLongTermRetentionPoliciesClient(subscriptionID) +} +func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { + return original.NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewBackupLongTermRetentionVaultsClient(subscriptionID string) BackupLongTermRetentionVaultsClient { + return original.NewBackupLongTermRetentionVaultsClient(subscriptionID) +} +func NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionVaultsClient { + return original.NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI, subscriptionID) +} +func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { + return original.NewCapabilitiesClient(subscriptionID) +} +func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { + return original.NewCapabilitiesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { + return original.NewDataMaskingPoliciesClient(subscriptionID) +} +func NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { + return original.NewDataMaskingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { + return original.NewDataMaskingRulesClient(subscriptionID) +} +func NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { + return original.NewDataMaskingRulesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseAdvisorsClient(subscriptionID string) DatabaseAdvisorsClient { + return original.NewDatabaseAdvisorsClient(subscriptionID) +} +func NewDatabaseAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAdvisorsClient { + return original.NewDatabaseAdvisorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseConnectionPoliciesClient(subscriptionID string) DatabaseConnectionPoliciesClient { + return original.NewDatabaseConnectionPoliciesClient(subscriptionID) +} +func NewDatabaseConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseConnectionPoliciesClient { + return original.NewDatabaseConnectionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseTableAuditingPoliciesClient(subscriptionID string) DatabaseTableAuditingPoliciesClient { + return original.NewDatabaseTableAuditingPoliciesClient(subscriptionID) +} +func NewDatabaseTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseTableAuditingPoliciesClient { + return original.NewDatabaseTableAuditingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} func NewDatabaseThreatDetectionPoliciesClient(subscriptionID string) DatabaseThreatDetectionPoliciesClient { return original.NewDatabaseThreatDetectionPoliciesClient(subscriptionID) } func NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseThreatDetectionPoliciesClient { return original.NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI, subscriptionID) } +func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { + return original.NewDatabaseUsagesClient(subscriptionID) +} +func NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { + return original.NewDatabaseUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewDatabasesClient(subscriptionID string) DatabasesClient { return original.NewDatabasesClient(subscriptionID) } func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { return original.NewDatabasesClientWithBaseURI(baseURI, subscriptionID) } +func NewDisasterRecoveryConfigurationsClient(subscriptionID string) DisasterRecoveryConfigurationsClient { + return original.NewDisasterRecoveryConfigurationsClient(subscriptionID) +} +func NewDisasterRecoveryConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigurationsClient { + return original.NewDisasterRecoveryConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewElasticPoolActivitiesClient(subscriptionID string) ElasticPoolActivitiesClient { return original.NewElasticPoolActivitiesClient(subscriptionID) } @@ -375,30 +768,126 @@ func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { return original.NewElasticPoolsClientWithBaseURI(baseURI, subscriptionID) } +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return original.NewExtensionsClient(subscriptionID) +} +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return original.NewExtensionsClientWithBaseURI(baseURI, subscriptionID) +} func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { return original.NewFirewallRulesClient(subscriptionID) } func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { return original.NewFirewallRulesClientWithBaseURI(baseURI, subscriptionID) } +func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { + return original.NewGeoBackupPoliciesClient(subscriptionID) +} +func NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { + return original.NewGeoBackupPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueriesClient(subscriptionID string) QueriesClient { + return original.NewQueriesClient(subscriptionID) +} +func NewQueriesClientWithBaseURI(baseURI string, subscriptionID string) QueriesClient { + return original.NewQueriesClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueryStatisticsClient(subscriptionID string) QueryStatisticsClient { + return original.NewQueryStatisticsClient(subscriptionID) +} +func NewQueryStatisticsClientWithBaseURI(baseURI string, subscriptionID string) QueryStatisticsClient { + return original.NewQueryStatisticsClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueryTextsClient(subscriptionID string) QueryTextsClient { + return original.NewQueryTextsClient(subscriptionID) +} +func NewQueryTextsClientWithBaseURI(baseURI string, subscriptionID string) QueryTextsClient { + return original.NewQueryTextsClientWithBaseURI(baseURI, subscriptionID) +} func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient { return original.NewRecommendedElasticPoolsClient(subscriptionID) } func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient { return original.NewRecommendedElasticPoolsClientWithBaseURI(baseURI, subscriptionID) } +func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { + return original.NewRecoverableDatabasesClient(subscriptionID) +} +func NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { + return original.NewRecoverableDatabasesClientWithBaseURI(baseURI, subscriptionID) +} func NewReplicationLinksClient(subscriptionID string) ReplicationLinksClient { return original.NewReplicationLinksClient(subscriptionID) } func NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ReplicationLinksClient { return original.NewReplicationLinksClientWithBaseURI(baseURI, subscriptionID) } +func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { + return original.NewRestorableDroppedDatabasesClient(subscriptionID) +} +func NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { + return original.NewRestorableDroppedDatabasesClientWithBaseURI(baseURI, subscriptionID) +} +func NewRestorePointsClient(subscriptionID string) RestorePointsClient { + return original.NewRestorePointsClient(subscriptionID) +} +func NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { + return original.NewRestorePointsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerAdvisorsClient(subscriptionID string) ServerAdvisorsClient { + return original.NewServerAdvisorsClient(subscriptionID) +} +func NewServerAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdvisorsClient { + return original.NewServerAdvisorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { + return original.NewServerAzureADAdministratorsClient(subscriptionID) +} +func NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { + return original.NewServerAzureADAdministratorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { + return original.NewServerCommunicationLinksClient(subscriptionID) +} +func NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { + return original.NewServerCommunicationLinksClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { + return original.NewServerConnectionPoliciesClient(subscriptionID) +} +func NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { + return original.NewServerConnectionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerTableAuditingPoliciesClient(subscriptionID string) ServerTableAuditingPoliciesClient { + return original.NewServerTableAuditingPoliciesClient(subscriptionID) +} +func NewServerTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerTableAuditingPoliciesClient { + return original.NewServerTableAuditingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { + return original.NewServerUsagesClient(subscriptionID) +} +func NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { + return original.NewServerUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewServersClient(subscriptionID string) ServersClient { return original.NewServersClient(subscriptionID) } func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { return original.NewServersClientWithBaseURI(baseURI, subscriptionID) } +func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { + return original.NewServiceObjectivesClient(subscriptionID) +} +func NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { + return original.NewServiceObjectivesClientWithBaseURI(baseURI, subscriptionID) +} func NewServiceTierAdvisorsClient(subscriptionID string) ServiceTierAdvisorsClient { return original.NewServiceTierAdvisorsClient(subscriptionID) } @@ -411,6 +900,12 @@ func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) Transpa func NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { return original.NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI, subscriptionID) } +func NewTransparentDataEncryptionConfigurationsClient(subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return original.NewTransparentDataEncryptionConfigurationsClient(subscriptionID) +} +func NewTransparentDataEncryptionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return original.NewTransparentDataEncryptionConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewTransparentDataEncryptionsClient(subscriptionID string) TransparentDataEncryptionsClient { return original.NewTransparentDataEncryptionsClient(subscriptionID) } @@ -420,24 +915,81 @@ func NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscription func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAdvisorStatusValues() []AdvisorStatus { + return original.PossibleAdvisorStatusValues() +} func PossibleAuthenticationTypeValues() []AuthenticationType { return original.PossibleAuthenticationTypeValues() } +func PossibleAutoExecuteStatusValues() []AutoExecuteStatus { + return original.PossibleAutoExecuteStatusValues() +} +func PossibleBackupLongTermRetentionPolicyStateValues() []BackupLongTermRetentionPolicyState { + return original.PossibleBackupLongTermRetentionPolicyStateValues() +} +func PossibleCapabilityStatusValues() []CapabilityStatus { + return original.PossibleCapabilityStatusValues() +} func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { return original.PossibleCheckNameAvailabilityReasonValues() } func PossibleCreateModeValues() []CreateMode { return original.PossibleCreateModeValues() } +func PossibleDataMaskingFunctionValues() []DataMaskingFunction { + return original.PossibleDataMaskingFunctionValues() +} +func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { + return original.PossibleDataMaskingRuleStateValues() +} +func PossibleDataMaskingStateValues() []DataMaskingState { + return original.PossibleDataMaskingStateValues() +} func PossibleDatabaseEditionValues() []DatabaseEdition { return original.PossibleDatabaseEditionValues() } +func PossibleDisasterRecoveryConfigurationAutoFailoverValues() []DisasterRecoveryConfigurationAutoFailover { + return original.PossibleDisasterRecoveryConfigurationAutoFailoverValues() +} +func PossibleDisasterRecoveryConfigurationFailoverPolicyValues() []DisasterRecoveryConfigurationFailoverPolicy { + return original.PossibleDisasterRecoveryConfigurationFailoverPolicyValues() +} +func PossibleDisasterRecoveryConfigurationRoleValues() []DisasterRecoveryConfigurationRole { + return original.PossibleDisasterRecoveryConfigurationRoleValues() +} +func PossibleDisasterRecoveryConfigurationStatusValues() []DisasterRecoveryConfigurationStatus { + return original.PossibleDisasterRecoveryConfigurationStatusValues() +} func PossibleElasticPoolEditionValues() []ElasticPoolEdition { return original.PossibleElasticPoolEditionValues() } func PossibleElasticPoolStateValues() []ElasticPoolState { return original.PossibleElasticPoolStateValues() } +func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { + return original.PossibleGeoBackupPolicyStateValues() +} +func PossibleMaxSizeUnitsValues() []MaxSizeUnits { + return original.PossibleMaxSizeUnitsValues() +} +func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { + return original.PossiblePerformanceLevelUnitValues() +} +func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { + return original.PossiblePrimaryAggregationTypeValues() +} +func PossibleQueryAggregationFunctionValues() []QueryAggregationFunction { + return original.PossibleQueryAggregationFunctionValues() +} +func PossibleQueryExecutionTypeValues() []QueryExecutionType { + return original.PossibleQueryExecutionTypeValues() +} +func PossibleQueryMetricUnitValues() []QueryMetricUnit { + return original.PossibleQueryMetricUnitValues() +} +func PossibleQueryObservedMetricTypeValues() []QueryObservedMetricType { + return original.PossibleQueryObservedMetricTypeValues() +} func PossibleReadScaleValues() []ReadScale { return original.PossibleReadScaleValues() } @@ -456,6 +1008,9 @@ func PossibleReplicationRoleValues() []ReplicationRole { func PossibleReplicationStateValues() []ReplicationState { return original.PossibleReplicationStateValues() } +func PossibleRestorePointTypeValues() []RestorePointType { + return original.PossibleRestorePointTypeValues() +} func PossibleSampleNameValues() []SampleName { return original.PossibleSampleNameValues() } @@ -468,6 +1023,15 @@ func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUseServerDefault { return original.PossibleSecurityAlertPolicyUseServerDefaultValues() } +func PossibleServerConnectionTypeValues() []ServerConnectionType { + return original.PossibleServerConnectionTypeValues() +} +func PossibleServerStateValues() []ServerState { + return original.PossibleServerStateValues() +} +func PossibleServerVersionValues() []ServerVersion { + return original.PossibleServerVersionValues() +} func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { return original.PossibleServiceObjectiveNameValues() } @@ -480,6 +1044,12 @@ func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEn func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { return original.PossibleTransparentDataEncryptionStatusValues() } +func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { + return original.PossibleUnitDefinitionTypeValues() +} +func PossibleUnitTypeValues() []UnitType { + return original.PossibleUnitTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/latest" } diff --git a/profiles/latest/sql/mgmt/sql/sqlapi/models.go b/profiles/latest/sql/mgmt/sql/sqlapi/models.go index 8a1a24d93635..d641097b6ea9 100644 --- a/profiles/latest/sql/mgmt/sql/sqlapi/models.go +++ b/profiles/latest/sql/mgmt/sql/sqlapi/models.go @@ -21,15 +21,42 @@ package sqlapi import original "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2014-04-01/sql/sqlapi" +type BackupLongTermRetentionPoliciesClientAPI = original.BackupLongTermRetentionPoliciesClientAPI +type BackupLongTermRetentionVaultsClientAPI = original.BackupLongTermRetentionVaultsClientAPI +type CapabilitiesClientAPI = original.CapabilitiesClientAPI +type DataMaskingPoliciesClientAPI = original.DataMaskingPoliciesClientAPI +type DataMaskingRulesClientAPI = original.DataMaskingRulesClientAPI +type DatabaseAdvisorsClientAPI = original.DatabaseAdvisorsClientAPI +type DatabaseConnectionPoliciesClientAPI = original.DatabaseConnectionPoliciesClientAPI +type DatabaseTableAuditingPoliciesClientAPI = original.DatabaseTableAuditingPoliciesClientAPI type DatabaseThreatDetectionPoliciesClientAPI = original.DatabaseThreatDetectionPoliciesClientAPI +type DatabaseUsagesClientAPI = original.DatabaseUsagesClientAPI type DatabasesClientAPI = original.DatabasesClientAPI +type DisasterRecoveryConfigurationsClientAPI = original.DisasterRecoveryConfigurationsClientAPI type ElasticPoolActivitiesClientAPI = original.ElasticPoolActivitiesClientAPI type ElasticPoolDatabaseActivitiesClientAPI = original.ElasticPoolDatabaseActivitiesClientAPI type ElasticPoolsClientAPI = original.ElasticPoolsClientAPI +type ExtensionsClientAPI = original.ExtensionsClientAPI type FirewallRulesClientAPI = original.FirewallRulesClientAPI +type GeoBackupPoliciesClientAPI = original.GeoBackupPoliciesClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type QueriesClientAPI = original.QueriesClientAPI +type QueryStatisticsClientAPI = original.QueryStatisticsClientAPI +type QueryTextsClientAPI = original.QueryTextsClientAPI type RecommendedElasticPoolsClientAPI = original.RecommendedElasticPoolsClientAPI +type RecoverableDatabasesClientAPI = original.RecoverableDatabasesClientAPI type ReplicationLinksClientAPI = original.ReplicationLinksClientAPI +type RestorableDroppedDatabasesClientAPI = original.RestorableDroppedDatabasesClientAPI +type RestorePointsClientAPI = original.RestorePointsClientAPI +type ServerAdvisorsClientAPI = original.ServerAdvisorsClientAPI +type ServerAzureADAdministratorsClientAPI = original.ServerAzureADAdministratorsClientAPI +type ServerCommunicationLinksClientAPI = original.ServerCommunicationLinksClientAPI +type ServerConnectionPoliciesClientAPI = original.ServerConnectionPoliciesClientAPI +type ServerTableAuditingPoliciesClientAPI = original.ServerTableAuditingPoliciesClientAPI +type ServerUsagesClientAPI = original.ServerUsagesClientAPI type ServersClientAPI = original.ServersClientAPI +type ServiceObjectivesClientAPI = original.ServiceObjectivesClientAPI type ServiceTierAdvisorsClientAPI = original.ServiceTierAdvisorsClientAPI type TransparentDataEncryptionActivitiesClientAPI = original.TransparentDataEncryptionActivitiesClientAPI +type TransparentDataEncryptionConfigurationsClientAPI = original.TransparentDataEncryptionConfigurationsClientAPI type TransparentDataEncryptionsClientAPI = original.TransparentDataEncryptionsClientAPI diff --git a/profiles/preview/sql/mgmt/sql/models.go b/profiles/preview/sql/mgmt/sql/models.go index c236e3c00709..1ef18e61db29 100644 --- a/profiles/preview/sql/mgmt/sql/models.go +++ b/profiles/preview/sql/mgmt/sql/models.go @@ -25,6 +25,15 @@ const ( DefaultBaseURI = original.DefaultBaseURI ) +type AdvisorStatus = original.AdvisorStatus + +const ( + GA AdvisorStatus = original.GA + LimitedPublicPreview AdvisorStatus = original.LimitedPublicPreview + PrivatePreview AdvisorStatus = original.PrivatePreview + PublicPreview AdvisorStatus = original.PublicPreview +) + type AuthenticationType = original.AuthenticationType const ( @@ -32,6 +41,30 @@ const ( SQL AuthenticationType = original.SQL ) +type AutoExecuteStatus = original.AutoExecuteStatus + +const ( + Default AutoExecuteStatus = original.Default + Disabled AutoExecuteStatus = original.Disabled + Enabled AutoExecuteStatus = original.Enabled +) + +type BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyState + +const ( + BackupLongTermRetentionPolicyStateDisabled BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyStateDisabled + BackupLongTermRetentionPolicyStateEnabled BackupLongTermRetentionPolicyState = original.BackupLongTermRetentionPolicyStateEnabled +) + +type CapabilityStatus = original.CapabilityStatus + +const ( + CapabilityStatusAvailable CapabilityStatus = original.CapabilityStatusAvailable + CapabilityStatusDefault CapabilityStatus = original.CapabilityStatusDefault + CapabilityStatusDisabled CapabilityStatus = original.CapabilityStatusDisabled + CapabilityStatusVisible CapabilityStatus = original.CapabilityStatusVisible +) + type CheckNameAvailabilityReason = original.CheckNameAvailabilityReason const ( @@ -42,14 +75,39 @@ const ( type CreateMode = original.CreateMode const ( - Copy CreateMode = original.Copy - Default CreateMode = original.Default - NonReadableSecondary CreateMode = original.NonReadableSecondary - OnlineSecondary CreateMode = original.OnlineSecondary - PointInTimeRestore CreateMode = original.PointInTimeRestore - Recovery CreateMode = original.Recovery - Restore CreateMode = original.Restore - RestoreLongTermRetentionBackup CreateMode = original.RestoreLongTermRetentionBackup + CreateModeCopy CreateMode = original.CreateModeCopy + CreateModeDefault CreateMode = original.CreateModeDefault + CreateModeNonReadableSecondary CreateMode = original.CreateModeNonReadableSecondary + CreateModeOnlineSecondary CreateMode = original.CreateModeOnlineSecondary + CreateModePointInTimeRestore CreateMode = original.CreateModePointInTimeRestore + CreateModeRecovery CreateMode = original.CreateModeRecovery + CreateModeRestore CreateMode = original.CreateModeRestore + CreateModeRestoreLongTermRetentionBackup CreateMode = original.CreateModeRestoreLongTermRetentionBackup +) + +type DataMaskingFunction = original.DataMaskingFunction + +const ( + DataMaskingFunctionCCN DataMaskingFunction = original.DataMaskingFunctionCCN + DataMaskingFunctionDefault DataMaskingFunction = original.DataMaskingFunctionDefault + DataMaskingFunctionEmail DataMaskingFunction = original.DataMaskingFunctionEmail + DataMaskingFunctionNumber DataMaskingFunction = original.DataMaskingFunctionNumber + DataMaskingFunctionSSN DataMaskingFunction = original.DataMaskingFunctionSSN + DataMaskingFunctionText DataMaskingFunction = original.DataMaskingFunctionText +) + +type DataMaskingRuleState = original.DataMaskingRuleState + +const ( + DataMaskingRuleStateDisabled DataMaskingRuleState = original.DataMaskingRuleStateDisabled + DataMaskingRuleStateEnabled DataMaskingRuleState = original.DataMaskingRuleStateEnabled +) + +type DataMaskingState = original.DataMaskingState + +const ( + DataMaskingStateDisabled DataMaskingState = original.DataMaskingStateDisabled + DataMaskingStateEnabled DataMaskingState = original.DataMaskingStateEnabled ) type DatabaseEdition = original.DatabaseEdition @@ -71,6 +129,37 @@ const ( Web DatabaseEdition = original.Web ) +type DisasterRecoveryConfigurationAutoFailover = original.DisasterRecoveryConfigurationAutoFailover + +const ( + Off DisasterRecoveryConfigurationAutoFailover = original.Off + On DisasterRecoveryConfigurationAutoFailover = original.On +) + +type DisasterRecoveryConfigurationFailoverPolicy = original.DisasterRecoveryConfigurationFailoverPolicy + +const ( + Automatic DisasterRecoveryConfigurationFailoverPolicy = original.Automatic + Manual DisasterRecoveryConfigurationFailoverPolicy = original.Manual +) + +type DisasterRecoveryConfigurationRole = original.DisasterRecoveryConfigurationRole + +const ( + None DisasterRecoveryConfigurationRole = original.None + Primary DisasterRecoveryConfigurationRole = original.Primary + Secondary DisasterRecoveryConfigurationRole = original.Secondary +) + +type DisasterRecoveryConfigurationStatus = original.DisasterRecoveryConfigurationStatus + +const ( + Creating DisasterRecoveryConfigurationStatus = original.Creating + Dropping DisasterRecoveryConfigurationStatus = original.Dropping + FailingOver DisasterRecoveryConfigurationStatus = original.FailingOver + Ready DisasterRecoveryConfigurationStatus = original.Ready +) + type ElasticPoolEdition = original.ElasticPoolEdition const ( @@ -84,9 +173,79 @@ const ( type ElasticPoolState = original.ElasticPoolState const ( - Creating ElasticPoolState = original.Creating - Disabled ElasticPoolState = original.Disabled - Ready ElasticPoolState = original.Ready + ElasticPoolStateCreating ElasticPoolState = original.ElasticPoolStateCreating + ElasticPoolStateDisabled ElasticPoolState = original.ElasticPoolStateDisabled + ElasticPoolStateReady ElasticPoolState = original.ElasticPoolStateReady +) + +type GeoBackupPolicyState = original.GeoBackupPolicyState + +const ( + GeoBackupPolicyStateDisabled GeoBackupPolicyState = original.GeoBackupPolicyStateDisabled + GeoBackupPolicyStateEnabled GeoBackupPolicyState = original.GeoBackupPolicyStateEnabled +) + +type MaxSizeUnits = original.MaxSizeUnits + +const ( + Gigabytes MaxSizeUnits = original.Gigabytes + Megabytes MaxSizeUnits = original.Megabytes + Petabytes MaxSizeUnits = original.Petabytes + Terabytes MaxSizeUnits = original.Terabytes +) + +type PerformanceLevelUnit = original.PerformanceLevelUnit + +const ( + DTU PerformanceLevelUnit = original.DTU +) + +type PrimaryAggregationType = original.PrimaryAggregationType + +const ( + PrimaryAggregationTypeAverage PrimaryAggregationType = original.PrimaryAggregationTypeAverage + PrimaryAggregationTypeCount PrimaryAggregationType = original.PrimaryAggregationTypeCount + PrimaryAggregationTypeMaximum PrimaryAggregationType = original.PrimaryAggregationTypeMaximum + PrimaryAggregationTypeMinimum PrimaryAggregationType = original.PrimaryAggregationTypeMinimum + PrimaryAggregationTypeNone PrimaryAggregationType = original.PrimaryAggregationTypeNone + PrimaryAggregationTypeTotal PrimaryAggregationType = original.PrimaryAggregationTypeTotal +) + +type QueryAggregationFunction = original.QueryAggregationFunction + +const ( + Avg QueryAggregationFunction = original.Avg + Max QueryAggregationFunction = original.Max + Min QueryAggregationFunction = original.Min + Sum QueryAggregationFunction = original.Sum +) + +type QueryExecutionType = original.QueryExecutionType + +const ( + Aborted QueryExecutionType = original.Aborted + Any QueryExecutionType = original.Any + Exception QueryExecutionType = original.Exception + Irregular QueryExecutionType = original.Irregular + Regular QueryExecutionType = original.Regular +) + +type QueryMetricUnit = original.QueryMetricUnit + +const ( + KB QueryMetricUnit = original.KB + Microseconds QueryMetricUnit = original.Microseconds + Percentage QueryMetricUnit = original.Percentage +) + +type QueryObservedMetricType = original.QueryObservedMetricType + +const ( + CPU QueryObservedMetricType = original.CPU + Duration QueryObservedMetricType = original.Duration + ExecutionCount QueryObservedMetricType = original.ExecutionCount + Io QueryObservedMetricType = original.Io + Logio QueryObservedMetricType = original.Logio ) type ReadScale = original.ReadScale @@ -148,6 +307,13 @@ const ( SUSPENDED ReplicationState = original.SUSPENDED ) +type RestorePointType = original.RestorePointType + +const ( + CONTINUOUS RestorePointType = original.CONTINUOUS + DISCRETE RestorePointType = original.DISCRETE +) + type SampleName = original.SampleName const ( @@ -176,6 +342,28 @@ const ( SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = original.SecurityAlertPolicyUseServerDefaultEnabled ) +type ServerConnectionType = original.ServerConnectionType + +const ( + ServerConnectionTypeDefault ServerConnectionType = original.ServerConnectionTypeDefault + ServerConnectionTypeProxy ServerConnectionType = original.ServerConnectionTypeProxy + ServerConnectionTypeRedirect ServerConnectionType = original.ServerConnectionTypeRedirect +) + +type ServerState = original.ServerState + +const ( + ServerStateDisabled ServerState = original.ServerStateDisabled + ServerStateReady ServerState = original.ServerStateReady +) + +type ServerVersion = original.ServerVersion + +const ( + OneTwoFullStopZero ServerVersion = original.OneTwoFullStopZero + TwoFullStopZero ServerVersion = original.TwoFullStopZero +) + type ServiceObjectiveName = original.ServiceObjectiveName const ( @@ -267,16 +455,70 @@ const ( TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = original.TransparentDataEncryptionStatusEnabled ) +type UnitDefinitionType = original.UnitDefinitionType + +const ( + Bytes UnitDefinitionType = original.Bytes + BytesPerSecond UnitDefinitionType = original.BytesPerSecond + Count UnitDefinitionType = original.Count + CountPerSecond UnitDefinitionType = original.CountPerSecond + Percent UnitDefinitionType = original.Percent + Seconds UnitDefinitionType = original.Seconds +) + +type UnitType = original.UnitType + +const ( + UnitTypeBytes UnitType = original.UnitTypeBytes + UnitTypeBytesPerSecond UnitType = original.UnitTypeBytesPerSecond + UnitTypeCount UnitType = original.UnitTypeCount + UnitTypeCountPerSecond UnitType = original.UnitTypeCountPerSecond + UnitTypePercent UnitType = original.UnitTypePercent + UnitTypeSeconds UnitType = original.UnitTypeSeconds +) + +type Advisor = original.Advisor +type AdvisorListResult = original.AdvisorListResult +type AdvisorProperties = original.AdvisorProperties +type BackupLongTermRetentionPoliciesClient = original.BackupLongTermRetentionPoliciesClient +type BackupLongTermRetentionPoliciesCreateOrUpdateFuture = original.BackupLongTermRetentionPoliciesCreateOrUpdateFuture +type BackupLongTermRetentionPolicy = original.BackupLongTermRetentionPolicy +type BackupLongTermRetentionPolicyListResult = original.BackupLongTermRetentionPolicyListResult +type BackupLongTermRetentionPolicyProperties = original.BackupLongTermRetentionPolicyProperties +type BackupLongTermRetentionVault = original.BackupLongTermRetentionVault +type BackupLongTermRetentionVaultListResult = original.BackupLongTermRetentionVaultListResult +type BackupLongTermRetentionVaultProperties = original.BackupLongTermRetentionVaultProperties +type BackupLongTermRetentionVaultsClient = original.BackupLongTermRetentionVaultsClient +type BackupLongTermRetentionVaultsCreateOrUpdateFuture = original.BackupLongTermRetentionVaultsCreateOrUpdateFuture type BaseClient = original.BaseClient +type CapabilitiesClient = original.CapabilitiesClient type CheckNameAvailabilityRequest = original.CheckNameAvailabilityRequest type CheckNameAvailabilityResponse = original.CheckNameAvailabilityResponse +type DataMaskingPoliciesClient = original.DataMaskingPoliciesClient +type DataMaskingPolicy = original.DataMaskingPolicy +type DataMaskingPolicyProperties = original.DataMaskingPolicyProperties +type DataMaskingRule = original.DataMaskingRule +type DataMaskingRuleListResult = original.DataMaskingRuleListResult +type DataMaskingRuleProperties = original.DataMaskingRuleProperties +type DataMaskingRulesClient = original.DataMaskingRulesClient type Database = original.Database +type DatabaseAdvisorsClient = original.DatabaseAdvisorsClient +type DatabaseConnectionPoliciesClient = original.DatabaseConnectionPoliciesClient +type DatabaseConnectionPolicy = original.DatabaseConnectionPolicy +type DatabaseConnectionPolicyProperties = original.DatabaseConnectionPolicyProperties type DatabaseListResult = original.DatabaseListResult type DatabaseProperties = original.DatabaseProperties type DatabaseSecurityAlertPolicy = original.DatabaseSecurityAlertPolicy type DatabaseSecurityAlertPolicyProperties = original.DatabaseSecurityAlertPolicyProperties +type DatabaseTableAuditingPoliciesClient = original.DatabaseTableAuditingPoliciesClient +type DatabaseTableAuditingPolicy = original.DatabaseTableAuditingPolicy +type DatabaseTableAuditingPolicyListResult = original.DatabaseTableAuditingPolicyListResult +type DatabaseTableAuditingPolicyProperties = original.DatabaseTableAuditingPolicyProperties type DatabaseThreatDetectionPoliciesClient = original.DatabaseThreatDetectionPoliciesClient type DatabaseUpdate = original.DatabaseUpdate +type DatabaseUsage = original.DatabaseUsage +type DatabaseUsageListResult = original.DatabaseUsageListResult +type DatabaseUsagesClient = original.DatabaseUsagesClient type DatabasesClient = original.DatabasesClient type DatabasesCreateImportOperationFuture = original.DatabasesCreateImportOperationFuture type DatabasesCreateOrUpdateFuture = original.DatabasesCreateOrUpdateFuture @@ -285,6 +527,15 @@ type DatabasesImportFuture = original.DatabasesImportFuture type DatabasesPauseFuture = original.DatabasesPauseFuture type DatabasesResumeFuture = original.DatabasesResumeFuture type DatabasesUpdateFuture = original.DatabasesUpdateFuture +type DisasterRecoveryConfiguration = original.DisasterRecoveryConfiguration +type DisasterRecoveryConfigurationListResult = original.DisasterRecoveryConfigurationListResult +type DisasterRecoveryConfigurationProperties = original.DisasterRecoveryConfigurationProperties +type DisasterRecoveryConfigurationsClient = original.DisasterRecoveryConfigurationsClient +type DisasterRecoveryConfigurationsCreateOrUpdateFuture = original.DisasterRecoveryConfigurationsCreateOrUpdateFuture +type DisasterRecoveryConfigurationsDeleteFuture = original.DisasterRecoveryConfigurationsDeleteFuture +type DisasterRecoveryConfigurationsFailoverAllowDataLossFuture = original.DisasterRecoveryConfigurationsFailoverAllowDataLossFuture +type DisasterRecoveryConfigurationsFailoverFuture = original.DisasterRecoveryConfigurationsFailoverFuture +type EditionCapability = original.EditionCapability type ElasticPool = original.ElasticPool type ElasticPoolActivitiesClient = original.ElasticPoolActivitiesClient type ElasticPoolActivity = original.ElasticPoolActivity @@ -294,24 +545,57 @@ type ElasticPoolDatabaseActivitiesClient = original.ElasticPoolDatabaseActivitie type ElasticPoolDatabaseActivity = original.ElasticPoolDatabaseActivity type ElasticPoolDatabaseActivityListResult = original.ElasticPoolDatabaseActivityListResult type ElasticPoolDatabaseActivityProperties = original.ElasticPoolDatabaseActivityProperties +type ElasticPoolDtuCapability = original.ElasticPoolDtuCapability +type ElasticPoolEditionCapability = original.ElasticPoolEditionCapability type ElasticPoolListResult = original.ElasticPoolListResult +type ElasticPoolPerDatabaseMaxDtuCapability = original.ElasticPoolPerDatabaseMaxDtuCapability +type ElasticPoolPerDatabaseMinDtuCapability = original.ElasticPoolPerDatabaseMinDtuCapability type ElasticPoolProperties = original.ElasticPoolProperties type ElasticPoolUpdate = original.ElasticPoolUpdate type ElasticPoolsClient = original.ElasticPoolsClient type ElasticPoolsCreateOrUpdateFuture = original.ElasticPoolsCreateOrUpdateFuture type ElasticPoolsUpdateFuture = original.ElasticPoolsUpdateFuture type ExportRequest = original.ExportRequest +type ExtensionListResult = original.ExtensionListResult +type ExtensionsClient = original.ExtensionsClient type FirewallRule = original.FirewallRule type FirewallRuleListResult = original.FirewallRuleListResult type FirewallRuleProperties = original.FirewallRuleProperties type FirewallRulesClient = original.FirewallRulesClient +type GeoBackupPoliciesClient = original.GeoBackupPoliciesClient +type GeoBackupPolicy = original.GeoBackupPolicy +type GeoBackupPolicyListResult = original.GeoBackupPolicyListResult +type GeoBackupPolicyProperties = original.GeoBackupPolicyProperties type ImportExportResponse = original.ImportExportResponse type ImportExportResponseProperties = original.ImportExportResponseProperties type ImportExtensionProperties = original.ImportExtensionProperties type ImportExtensionRequest = original.ImportExtensionRequest type ImportRequest = original.ImportRequest +type LocationCapabilities = original.LocationCapabilities +type MaxSizeCapability = original.MaxSizeCapability +type Metric = original.Metric +type MetricAvailability = original.MetricAvailability +type MetricDefinition = original.MetricDefinition +type MetricDefinitionListResult = original.MetricDefinitionListResult +type MetricListResult = original.MetricListResult +type MetricName = original.MetricName +type MetricValue = original.MetricValue +type Operation = original.Operation +type OperationDisplay = original.OperationDisplay type OperationImpact = original.OperationImpact +type OperationListResult = original.OperationListResult +type OperationsClient = original.OperationsClient +type PerformanceLevel = original.PerformanceLevel type ProxyResource = original.ProxyResource +type QueriesClient = original.QueriesClient +type QueryInterval = original.QueryInterval +type QueryMetric = original.QueryMetric +type QueryStatistic = original.QueryStatistic +type QueryStatisticListResult = original.QueryStatisticListResult +type QueryStatisticsClient = original.QueryStatisticsClient +type QueryText = original.QueryText +type QueryTextListResult = original.QueryTextListResult +type QueryTextsClient = original.QueryTextsClient type RecommendedElasticPool = original.RecommendedElasticPool type RecommendedElasticPoolListMetricsResult = original.RecommendedElasticPoolListMetricsResult type RecommendedElasticPoolListResult = original.RecommendedElasticPoolListResult @@ -320,6 +604,10 @@ type RecommendedElasticPoolProperties = original.RecommendedElasticPoolPropertie type RecommendedElasticPoolsClient = original.RecommendedElasticPoolsClient type RecommendedIndex = original.RecommendedIndex type RecommendedIndexProperties = original.RecommendedIndexProperties +type RecoverableDatabase = original.RecoverableDatabase +type RecoverableDatabaseListResult = original.RecoverableDatabaseListResult +type RecoverableDatabaseProperties = original.RecoverableDatabaseProperties +type RecoverableDatabasesClient = original.RecoverableDatabasesClient type ReplicationLink = original.ReplicationLink type ReplicationLinkListResult = original.ReplicationLinkListResult type ReplicationLinkProperties = original.ReplicationLinkProperties @@ -327,36 +615,141 @@ type ReplicationLinksClient = original.ReplicationLinksClient type ReplicationLinksFailoverAllowDataLossFuture = original.ReplicationLinksFailoverAllowDataLossFuture type ReplicationLinksFailoverFuture = original.ReplicationLinksFailoverFuture type Resource = original.Resource +type RestorableDroppedDatabase = original.RestorableDroppedDatabase +type RestorableDroppedDatabaseListResult = original.RestorableDroppedDatabaseListResult +type RestorableDroppedDatabaseProperties = original.RestorableDroppedDatabaseProperties +type RestorableDroppedDatabasesClient = original.RestorableDroppedDatabasesClient +type RestorePoint = original.RestorePoint +type RestorePointListResult = original.RestorePointListResult +type RestorePointProperties = original.RestorePointProperties +type RestorePointsClient = original.RestorePointsClient +type Server = original.Server +type ServerAdministratorListResult = original.ServerAdministratorListResult +type ServerAdministratorProperties = original.ServerAdministratorProperties +type ServerAdvisorsClient = original.ServerAdvisorsClient +type ServerAzureADAdministrator = original.ServerAzureADAdministrator +type ServerAzureADAdministratorsClient = original.ServerAzureADAdministratorsClient +type ServerAzureADAdministratorsCreateOrUpdateFuture = original.ServerAzureADAdministratorsCreateOrUpdateFuture +type ServerAzureADAdministratorsDeleteFuture = original.ServerAzureADAdministratorsDeleteFuture +type ServerCommunicationLink = original.ServerCommunicationLink +type ServerCommunicationLinkListResult = original.ServerCommunicationLinkListResult +type ServerCommunicationLinkProperties = original.ServerCommunicationLinkProperties +type ServerCommunicationLinksClient = original.ServerCommunicationLinksClient +type ServerCommunicationLinksCreateOrUpdateFuture = original.ServerCommunicationLinksCreateOrUpdateFuture +type ServerConnectionPoliciesClient = original.ServerConnectionPoliciesClient +type ServerConnectionPolicy = original.ServerConnectionPolicy +type ServerConnectionPolicyProperties = original.ServerConnectionPolicyProperties +type ServerListResult = original.ServerListResult +type ServerProperties = original.ServerProperties +type ServerTableAuditingPoliciesClient = original.ServerTableAuditingPoliciesClient +type ServerTableAuditingPolicy = original.ServerTableAuditingPolicy +type ServerTableAuditingPolicyListResult = original.ServerTableAuditingPolicyListResult +type ServerTableAuditingPolicyProperties = original.ServerTableAuditingPolicyProperties +type ServerUpdate = original.ServerUpdate +type ServerUsage = original.ServerUsage +type ServerUsageListResult = original.ServerUsageListResult +type ServerUsagesClient = original.ServerUsagesClient +type ServerVersionCapability = original.ServerVersionCapability type ServersClient = original.ServersClient +type ServiceObjective = original.ServiceObjective +type ServiceObjectiveCapability = original.ServiceObjectiveCapability +type ServiceObjectiveListResult = original.ServiceObjectiveListResult +type ServiceObjectiveProperties = original.ServiceObjectiveProperties +type ServiceObjectivesClient = original.ServiceObjectivesClient type ServiceTierAdvisor = original.ServiceTierAdvisor type ServiceTierAdvisorListResult = original.ServiceTierAdvisorListResult type ServiceTierAdvisorProperties = original.ServiceTierAdvisorProperties type ServiceTierAdvisorsClient = original.ServiceTierAdvisorsClient type SloUsageMetric = original.SloUsageMetric +type TableAuditingPolicyProperties = original.TableAuditingPolicyProperties +type TopQueries = original.TopQueries +type TopQueriesListResult = original.TopQueriesListResult type TrackedResource = original.TrackedResource type TransparentDataEncryption = original.TransparentDataEncryption type TransparentDataEncryptionActivitiesClient = original.TransparentDataEncryptionActivitiesClient type TransparentDataEncryptionActivity = original.TransparentDataEncryptionActivity type TransparentDataEncryptionActivityListResult = original.TransparentDataEncryptionActivityListResult type TransparentDataEncryptionActivityProperties = original.TransparentDataEncryptionActivityProperties +type TransparentDataEncryptionConfigurationsClient = original.TransparentDataEncryptionConfigurationsClient +type TransparentDataEncryptionListResult = original.TransparentDataEncryptionListResult type TransparentDataEncryptionProperties = original.TransparentDataEncryptionProperties type TransparentDataEncryptionsClient = original.TransparentDataEncryptionsClient func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { + return original.NewBackupLongTermRetentionPoliciesClient(subscriptionID) +} +func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { + return original.NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewBackupLongTermRetentionVaultsClient(subscriptionID string) BackupLongTermRetentionVaultsClient { + return original.NewBackupLongTermRetentionVaultsClient(subscriptionID) +} +func NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionVaultsClient { + return original.NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI, subscriptionID) +} +func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { + return original.NewCapabilitiesClient(subscriptionID) +} +func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { + return original.NewCapabilitiesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { + return original.NewDataMaskingPoliciesClient(subscriptionID) +} +func NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { + return original.NewDataMaskingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { + return original.NewDataMaskingRulesClient(subscriptionID) +} +func NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { + return original.NewDataMaskingRulesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseAdvisorsClient(subscriptionID string) DatabaseAdvisorsClient { + return original.NewDatabaseAdvisorsClient(subscriptionID) +} +func NewDatabaseAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAdvisorsClient { + return original.NewDatabaseAdvisorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseConnectionPoliciesClient(subscriptionID string) DatabaseConnectionPoliciesClient { + return original.NewDatabaseConnectionPoliciesClient(subscriptionID) +} +func NewDatabaseConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseConnectionPoliciesClient { + return original.NewDatabaseConnectionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDatabaseTableAuditingPoliciesClient(subscriptionID string) DatabaseTableAuditingPoliciesClient { + return original.NewDatabaseTableAuditingPoliciesClient(subscriptionID) +} +func NewDatabaseTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseTableAuditingPoliciesClient { + return original.NewDatabaseTableAuditingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} func NewDatabaseThreatDetectionPoliciesClient(subscriptionID string) DatabaseThreatDetectionPoliciesClient { return original.NewDatabaseThreatDetectionPoliciesClient(subscriptionID) } func NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseThreatDetectionPoliciesClient { return original.NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI, subscriptionID) } +func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { + return original.NewDatabaseUsagesClient(subscriptionID) +} +func NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { + return original.NewDatabaseUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewDatabasesClient(subscriptionID string) DatabasesClient { return original.NewDatabasesClient(subscriptionID) } func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { return original.NewDatabasesClientWithBaseURI(baseURI, subscriptionID) } +func NewDisasterRecoveryConfigurationsClient(subscriptionID string) DisasterRecoveryConfigurationsClient { + return original.NewDisasterRecoveryConfigurationsClient(subscriptionID) +} +func NewDisasterRecoveryConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigurationsClient { + return original.NewDisasterRecoveryConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewElasticPoolActivitiesClient(subscriptionID string) ElasticPoolActivitiesClient { return original.NewElasticPoolActivitiesClient(subscriptionID) } @@ -375,30 +768,126 @@ func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { return original.NewElasticPoolsClientWithBaseURI(baseURI, subscriptionID) } +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return original.NewExtensionsClient(subscriptionID) +} +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return original.NewExtensionsClientWithBaseURI(baseURI, subscriptionID) +} func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { return original.NewFirewallRulesClient(subscriptionID) } func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { return original.NewFirewallRulesClientWithBaseURI(baseURI, subscriptionID) } +func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { + return original.NewGeoBackupPoliciesClient(subscriptionID) +} +func NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { + return original.NewGeoBackupPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueriesClient(subscriptionID string) QueriesClient { + return original.NewQueriesClient(subscriptionID) +} +func NewQueriesClientWithBaseURI(baseURI string, subscriptionID string) QueriesClient { + return original.NewQueriesClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueryStatisticsClient(subscriptionID string) QueryStatisticsClient { + return original.NewQueryStatisticsClient(subscriptionID) +} +func NewQueryStatisticsClientWithBaseURI(baseURI string, subscriptionID string) QueryStatisticsClient { + return original.NewQueryStatisticsClientWithBaseURI(baseURI, subscriptionID) +} +func NewQueryTextsClient(subscriptionID string) QueryTextsClient { + return original.NewQueryTextsClient(subscriptionID) +} +func NewQueryTextsClientWithBaseURI(baseURI string, subscriptionID string) QueryTextsClient { + return original.NewQueryTextsClientWithBaseURI(baseURI, subscriptionID) +} func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient { return original.NewRecommendedElasticPoolsClient(subscriptionID) } func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient { return original.NewRecommendedElasticPoolsClientWithBaseURI(baseURI, subscriptionID) } +func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { + return original.NewRecoverableDatabasesClient(subscriptionID) +} +func NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { + return original.NewRecoverableDatabasesClientWithBaseURI(baseURI, subscriptionID) +} func NewReplicationLinksClient(subscriptionID string) ReplicationLinksClient { return original.NewReplicationLinksClient(subscriptionID) } func NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ReplicationLinksClient { return original.NewReplicationLinksClientWithBaseURI(baseURI, subscriptionID) } +func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { + return original.NewRestorableDroppedDatabasesClient(subscriptionID) +} +func NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { + return original.NewRestorableDroppedDatabasesClientWithBaseURI(baseURI, subscriptionID) +} +func NewRestorePointsClient(subscriptionID string) RestorePointsClient { + return original.NewRestorePointsClient(subscriptionID) +} +func NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { + return original.NewRestorePointsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerAdvisorsClient(subscriptionID string) ServerAdvisorsClient { + return original.NewServerAdvisorsClient(subscriptionID) +} +func NewServerAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdvisorsClient { + return original.NewServerAdvisorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { + return original.NewServerAzureADAdministratorsClient(subscriptionID) +} +func NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { + return original.NewServerAzureADAdministratorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { + return original.NewServerCommunicationLinksClient(subscriptionID) +} +func NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { + return original.NewServerCommunicationLinksClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { + return original.NewServerConnectionPoliciesClient(subscriptionID) +} +func NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { + return original.NewServerConnectionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerTableAuditingPoliciesClient(subscriptionID string) ServerTableAuditingPoliciesClient { + return original.NewServerTableAuditingPoliciesClient(subscriptionID) +} +func NewServerTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerTableAuditingPoliciesClient { + return original.NewServerTableAuditingPoliciesClientWithBaseURI(baseURI, subscriptionID) +} +func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { + return original.NewServerUsagesClient(subscriptionID) +} +func NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { + return original.NewServerUsagesClientWithBaseURI(baseURI, subscriptionID) +} func NewServersClient(subscriptionID string) ServersClient { return original.NewServersClient(subscriptionID) } func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { return original.NewServersClientWithBaseURI(baseURI, subscriptionID) } +func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { + return original.NewServiceObjectivesClient(subscriptionID) +} +func NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { + return original.NewServiceObjectivesClientWithBaseURI(baseURI, subscriptionID) +} func NewServiceTierAdvisorsClient(subscriptionID string) ServiceTierAdvisorsClient { return original.NewServiceTierAdvisorsClient(subscriptionID) } @@ -411,6 +900,12 @@ func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) Transpa func NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { return original.NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI, subscriptionID) } +func NewTransparentDataEncryptionConfigurationsClient(subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return original.NewTransparentDataEncryptionConfigurationsClient(subscriptionID) +} +func NewTransparentDataEncryptionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return original.NewTransparentDataEncryptionConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewTransparentDataEncryptionsClient(subscriptionID string) TransparentDataEncryptionsClient { return original.NewTransparentDataEncryptionsClient(subscriptionID) } @@ -420,24 +915,81 @@ func NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscription func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAdvisorStatusValues() []AdvisorStatus { + return original.PossibleAdvisorStatusValues() +} func PossibleAuthenticationTypeValues() []AuthenticationType { return original.PossibleAuthenticationTypeValues() } +func PossibleAutoExecuteStatusValues() []AutoExecuteStatus { + return original.PossibleAutoExecuteStatusValues() +} +func PossibleBackupLongTermRetentionPolicyStateValues() []BackupLongTermRetentionPolicyState { + return original.PossibleBackupLongTermRetentionPolicyStateValues() +} +func PossibleCapabilityStatusValues() []CapabilityStatus { + return original.PossibleCapabilityStatusValues() +} func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { return original.PossibleCheckNameAvailabilityReasonValues() } func PossibleCreateModeValues() []CreateMode { return original.PossibleCreateModeValues() } +func PossibleDataMaskingFunctionValues() []DataMaskingFunction { + return original.PossibleDataMaskingFunctionValues() +} +func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { + return original.PossibleDataMaskingRuleStateValues() +} +func PossibleDataMaskingStateValues() []DataMaskingState { + return original.PossibleDataMaskingStateValues() +} func PossibleDatabaseEditionValues() []DatabaseEdition { return original.PossibleDatabaseEditionValues() } +func PossibleDisasterRecoveryConfigurationAutoFailoverValues() []DisasterRecoveryConfigurationAutoFailover { + return original.PossibleDisasterRecoveryConfigurationAutoFailoverValues() +} +func PossibleDisasterRecoveryConfigurationFailoverPolicyValues() []DisasterRecoveryConfigurationFailoverPolicy { + return original.PossibleDisasterRecoveryConfigurationFailoverPolicyValues() +} +func PossibleDisasterRecoveryConfigurationRoleValues() []DisasterRecoveryConfigurationRole { + return original.PossibleDisasterRecoveryConfigurationRoleValues() +} +func PossibleDisasterRecoveryConfigurationStatusValues() []DisasterRecoveryConfigurationStatus { + return original.PossibleDisasterRecoveryConfigurationStatusValues() +} func PossibleElasticPoolEditionValues() []ElasticPoolEdition { return original.PossibleElasticPoolEditionValues() } func PossibleElasticPoolStateValues() []ElasticPoolState { return original.PossibleElasticPoolStateValues() } +func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { + return original.PossibleGeoBackupPolicyStateValues() +} +func PossibleMaxSizeUnitsValues() []MaxSizeUnits { + return original.PossibleMaxSizeUnitsValues() +} +func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { + return original.PossiblePerformanceLevelUnitValues() +} +func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { + return original.PossiblePrimaryAggregationTypeValues() +} +func PossibleQueryAggregationFunctionValues() []QueryAggregationFunction { + return original.PossibleQueryAggregationFunctionValues() +} +func PossibleQueryExecutionTypeValues() []QueryExecutionType { + return original.PossibleQueryExecutionTypeValues() +} +func PossibleQueryMetricUnitValues() []QueryMetricUnit { + return original.PossibleQueryMetricUnitValues() +} +func PossibleQueryObservedMetricTypeValues() []QueryObservedMetricType { + return original.PossibleQueryObservedMetricTypeValues() +} func PossibleReadScaleValues() []ReadScale { return original.PossibleReadScaleValues() } @@ -456,6 +1008,9 @@ func PossibleReplicationRoleValues() []ReplicationRole { func PossibleReplicationStateValues() []ReplicationState { return original.PossibleReplicationStateValues() } +func PossibleRestorePointTypeValues() []RestorePointType { + return original.PossibleRestorePointTypeValues() +} func PossibleSampleNameValues() []SampleName { return original.PossibleSampleNameValues() } @@ -468,6 +1023,15 @@ func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUseServerDefault { return original.PossibleSecurityAlertPolicyUseServerDefaultValues() } +func PossibleServerConnectionTypeValues() []ServerConnectionType { + return original.PossibleServerConnectionTypeValues() +} +func PossibleServerStateValues() []ServerState { + return original.PossibleServerStateValues() +} +func PossibleServerVersionValues() []ServerVersion { + return original.PossibleServerVersionValues() +} func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { return original.PossibleServiceObjectiveNameValues() } @@ -480,6 +1044,12 @@ func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEn func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { return original.PossibleTransparentDataEncryptionStatusValues() } +func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { + return original.PossibleUnitDefinitionTypeValues() +} +func PossibleUnitTypeValues() []UnitType { + return original.PossibleUnitTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/sql/mgmt/sql/sqlapi/models.go b/profiles/preview/sql/mgmt/sql/sqlapi/models.go index 8a1a24d93635..d641097b6ea9 100644 --- a/profiles/preview/sql/mgmt/sql/sqlapi/models.go +++ b/profiles/preview/sql/mgmt/sql/sqlapi/models.go @@ -21,15 +21,42 @@ package sqlapi import original "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2014-04-01/sql/sqlapi" +type BackupLongTermRetentionPoliciesClientAPI = original.BackupLongTermRetentionPoliciesClientAPI +type BackupLongTermRetentionVaultsClientAPI = original.BackupLongTermRetentionVaultsClientAPI +type CapabilitiesClientAPI = original.CapabilitiesClientAPI +type DataMaskingPoliciesClientAPI = original.DataMaskingPoliciesClientAPI +type DataMaskingRulesClientAPI = original.DataMaskingRulesClientAPI +type DatabaseAdvisorsClientAPI = original.DatabaseAdvisorsClientAPI +type DatabaseConnectionPoliciesClientAPI = original.DatabaseConnectionPoliciesClientAPI +type DatabaseTableAuditingPoliciesClientAPI = original.DatabaseTableAuditingPoliciesClientAPI type DatabaseThreatDetectionPoliciesClientAPI = original.DatabaseThreatDetectionPoliciesClientAPI +type DatabaseUsagesClientAPI = original.DatabaseUsagesClientAPI type DatabasesClientAPI = original.DatabasesClientAPI +type DisasterRecoveryConfigurationsClientAPI = original.DisasterRecoveryConfigurationsClientAPI type ElasticPoolActivitiesClientAPI = original.ElasticPoolActivitiesClientAPI type ElasticPoolDatabaseActivitiesClientAPI = original.ElasticPoolDatabaseActivitiesClientAPI type ElasticPoolsClientAPI = original.ElasticPoolsClientAPI +type ExtensionsClientAPI = original.ExtensionsClientAPI type FirewallRulesClientAPI = original.FirewallRulesClientAPI +type GeoBackupPoliciesClientAPI = original.GeoBackupPoliciesClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type QueriesClientAPI = original.QueriesClientAPI +type QueryStatisticsClientAPI = original.QueryStatisticsClientAPI +type QueryTextsClientAPI = original.QueryTextsClientAPI type RecommendedElasticPoolsClientAPI = original.RecommendedElasticPoolsClientAPI +type RecoverableDatabasesClientAPI = original.RecoverableDatabasesClientAPI type ReplicationLinksClientAPI = original.ReplicationLinksClientAPI +type RestorableDroppedDatabasesClientAPI = original.RestorableDroppedDatabasesClientAPI +type RestorePointsClientAPI = original.RestorePointsClientAPI +type ServerAdvisorsClientAPI = original.ServerAdvisorsClientAPI +type ServerAzureADAdministratorsClientAPI = original.ServerAzureADAdministratorsClientAPI +type ServerCommunicationLinksClientAPI = original.ServerCommunicationLinksClientAPI +type ServerConnectionPoliciesClientAPI = original.ServerConnectionPoliciesClientAPI +type ServerTableAuditingPoliciesClientAPI = original.ServerTableAuditingPoliciesClientAPI +type ServerUsagesClientAPI = original.ServerUsagesClientAPI type ServersClientAPI = original.ServersClientAPI +type ServiceObjectivesClientAPI = original.ServiceObjectivesClientAPI type ServiceTierAdvisorsClientAPI = original.ServiceTierAdvisorsClientAPI type TransparentDataEncryptionActivitiesClientAPI = original.TransparentDataEncryptionActivitiesClientAPI +type TransparentDataEncryptionConfigurationsClientAPI = original.TransparentDataEncryptionConfigurationsClientAPI type TransparentDataEncryptionsClientAPI = original.TransparentDataEncryptionsClientAPI diff --git a/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionpolicies.go b/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionpolicies.go new file mode 100644 index 000000000000..d106b0595037 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionpolicies.go @@ -0,0 +1,298 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupLongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type BackupLongTermRetentionPoliciesClient struct { + BaseClient +} + +// NewBackupLongTermRetentionPoliciesClient creates an instance of the BackupLongTermRetentionPoliciesClient client. +func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { + return NewBackupLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupLongTermRetentionPoliciesClientWithBaseURI creates an instance of the BackupLongTermRetentionPoliciesClient +// client. +func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { + return BackupLongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database backup long term retention policy +// Parameters: +// resourceGroupName - the name of the resource group 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 +// parameters - the required parameters to update a backup long term retention policy +func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (result BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BackupLongTermRetentionPolicyProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BackupLongTermRetentionPolicyProperties.RecoveryServicesBackupPolicyResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupLongTermRetentionPolicyName": autorest.Encode("path", "Default"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get returns a database backup long term retention policy +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupLongTermRetentionPolicyName": autorest.Encode("path", "Default"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDatabase returns a database backup long term retention policy +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupLongTermRetentionPolicyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionvaults.go b/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionvaults.go new file mode 100644 index 000000000000..da3db554f53d --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionvaults.go @@ -0,0 +1,292 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupLongTermRetentionVaultsClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type BackupLongTermRetentionVaultsClient struct { + BaseClient +} + +// NewBackupLongTermRetentionVaultsClient creates an instance of the BackupLongTermRetentionVaultsClient client. +func NewBackupLongTermRetentionVaultsClient(subscriptionID string) BackupLongTermRetentionVaultsClient { + return NewBackupLongTermRetentionVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupLongTermRetentionVaultsClientWithBaseURI creates an instance of the BackupLongTermRetentionVaultsClient +// client. +func NewBackupLongTermRetentionVaultsClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionVaultsClient { + return BackupLongTermRetentionVaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate updates a server backup long term retention vault +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters to update a backup long term retention vault +func (client BackupLongTermRetentionVaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters BackupLongTermRetentionVault) (result BackupLongTermRetentionVaultsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionVaultsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BackupLongTermRetentionVaultProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BackupLongTermRetentionVaultProperties.RecoveryServicesVaultResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.BackupLongTermRetentionVaultsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BackupLongTermRetentionVaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters BackupLongTermRetentionVault) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupLongTermRetentionVaultName": autorest.Encode("path", "RegisteredVault"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionVaultsClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionVaultsCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionVaultsClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionVault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a server backup long term retention vault +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client BackupLongTermRetentionVaultsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result BackupLongTermRetentionVault, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionVaultsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupLongTermRetentionVaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupLongTermRetentionVaultName": autorest.Encode("path", "RegisteredVault"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionVaultsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionVaultsClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionVault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets server backup long term retention vaults in a server +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client BackupLongTermRetentionVaultsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result BackupLongTermRetentionVaultListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionVaultsClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client BackupLongTermRetentionVaultsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client BackupLongTermRetentionVaultsClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client BackupLongTermRetentionVaultsClient) ListByServerResponder(resp *http.Response) (result BackupLongTermRetentionVaultListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/capabilities.go b/services/sql/mgmt/2014-04-01/sql/capabilities.go new file mode 100644 index 000000000000..c5718dd09fbe --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/capabilities.go @@ -0,0 +1,118 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CapabilitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact +// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and +// delete databases. +type CapabilitiesClient struct { + BaseClient +} + +// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. +func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { + return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCapabilitiesClientWithBaseURI creates an instance of the CapabilitiesClient client. +func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { + return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByLocation gets the capabilities available for the specified location. +// Parameters: +// locationID - the location id whose capabilities are retrieved. +func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationID string) (result LocationCapabilities, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesClient.ListByLocation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByLocationPreparer(ctx, locationID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") + return + } + + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client CapabilitiesClient) ListByLocationPreparer(ctx context.Context, locationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationId": autorest.Encode("path", locationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByLocationSender sends the ListByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/databaseadvisors.go b/services/sql/mgmt/2014-04-01/sql/databaseadvisors.go new file mode 100644 index 000000000000..be13e2ed22e1 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/databaseadvisors.go @@ -0,0 +1,292 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabaseAdvisorsClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type DatabaseAdvisorsClient struct { + BaseClient +} + +// NewDatabaseAdvisorsClient creates an instance of the DatabaseAdvisorsClient client. +func NewDatabaseAdvisorsClient(subscriptionID string) DatabaseAdvisorsClient { + return NewDatabaseAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabaseAdvisorsClientWithBaseURI creates an instance of the DatabaseAdvisorsClient client. +func NewDatabaseAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAdvisorsClient { + return DatabaseAdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database advisor. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// advisorName - the name of the Database Advisor. +// parameters - the requested advisor resource state. +func (client DatabaseAdvisorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, parameters Advisor) (result Advisor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAdvisorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, advisorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabaseAdvisorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, parameters Advisor) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "advisorName": autorest.Encode("path", advisorName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAdvisorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabaseAdvisorsClient) CreateOrUpdateResponder(resp *http.Response) (result Advisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get returns details of a Database Advisor. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// advisorName - the name of the Database Advisor. +func (client DatabaseAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string) (result Advisor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAdvisorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, advisorName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabaseAdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "advisorName": autorest.Encode("path", advisorName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAdvisorsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabaseAdvisorsClient) GetResponder(resp *http.Response) (result Advisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDatabase returns a list of database advisors. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DatabaseAdvisorsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result AdvisorListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAdvisorsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseAdvisorsClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client DatabaseAdvisorsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAdvisorsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client DatabaseAdvisorsClient) ListByDatabaseResponder(resp *http.Response) (result AdvisorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/databaseconnectionpolicies.go b/services/sql/mgmt/2014-04-01/sql/databaseconnectionpolicies.go new file mode 100644 index 000000000000..7c70c940b266 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/databaseconnectionpolicies.go @@ -0,0 +1,212 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabaseConnectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type DatabaseConnectionPoliciesClient struct { + BaseClient +} + +// NewDatabaseConnectionPoliciesClient creates an instance of the DatabaseConnectionPoliciesClient client. +func NewDatabaseConnectionPoliciesClient(subscriptionID string) DatabaseConnectionPoliciesClient { + return NewDatabaseConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabaseConnectionPoliciesClientWithBaseURI creates an instance of the DatabaseConnectionPoliciesClient client. +func NewDatabaseConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseConnectionPoliciesClient { + return DatabaseConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database's connection policy, which is used with table auditing. Table auditing +// is deprecated, use blob auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the connection policy will be defined. +// parameters - the database connection policy. +func (client DatabaseConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseConnectionPolicy) (result DatabaseConnectionPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseConnectionPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabaseConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseConnectionPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionPolicyName": autorest.Encode("path", "default"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/connectionPolicies/{connectionPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseConnectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabaseConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseConnectionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob +// auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the connection policy is defined. +func (client DatabaseConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseConnectionPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseConnectionPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseConnectionPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabaseConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionPolicyName": autorest.Encode("path", "default"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/connectionPolicies/{connectionPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseConnectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabaseConnectionPoliciesClient) GetResponder(resp *http.Response) (result DatabaseConnectionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/databases.go b/services/sql/mgmt/2014-04-01/sql/databases.go index dcb44f215b7a..36b2bc57c791 100644 --- a/services/sql/mgmt/2014-04-01/sql/databases.go +++ b/services/sql/mgmt/2014-04-01/sql/databases.go @@ -974,6 +974,168 @@ func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result return } +// ListMetricDefinitions returns database metric definitions. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DatabasesClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result MetricDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetricDefinitions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client DatabasesClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetrics returns database metrics. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DatabasesClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result MetricListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, databaseName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client DatabasesClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Pause pauses a data warehouse. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/sql/mgmt/2014-04-01/sql/databasetableauditingpolicies.go b/services/sql/mgmt/2014-04-01/sql/databasetableauditingpolicies.go new file mode 100644 index 000000000000..731bef2eb94f --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/databasetableauditingpolicies.go @@ -0,0 +1,292 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabaseTableAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type DatabaseTableAuditingPoliciesClient struct { + BaseClient +} + +// NewDatabaseTableAuditingPoliciesClient creates an instance of the DatabaseTableAuditingPoliciesClient client. +func NewDatabaseTableAuditingPoliciesClient(subscriptionID string) DatabaseTableAuditingPoliciesClient { + return NewDatabaseTableAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabaseTableAuditingPoliciesClientWithBaseURI creates an instance of the DatabaseTableAuditingPoliciesClient +// client. +func NewDatabaseTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseTableAuditingPoliciesClient { + return DatabaseTableAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database's table auditing policy. Table auditing is deprecated, use blob +// auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the table auditing policy will be defined. +// parameters - the database table auditing policy. +func (client DatabaseTableAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseTableAuditingPolicy) (result DatabaseTableAuditingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseTableAuditingPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabaseTableAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseTableAuditingPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tableAuditingPolicyName": autorest.Encode("path", "default"), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies/{tableAuditingPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseTableAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabaseTableAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseTableAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a database's table auditing policy. Table auditing is deprecated, use blob auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the table audit policy is defined. +func (client DatabaseTableAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseTableAuditingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseTableAuditingPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabaseTableAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tableAuditingPolicyName": autorest.Encode("path", "default"), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies/{tableAuditingPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseTableAuditingPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabaseTableAuditingPoliciesClient) GetResponder(resp *http.Response) (result DatabaseTableAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDatabase lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the table audit policy is defined. +func (client DatabaseTableAuditingPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseTableAuditingPolicyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseTableAuditingPoliciesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseTableAuditingPoliciesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client DatabaseTableAuditingPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseTableAuditingPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client DatabaseTableAuditingPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseTableAuditingPolicyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/databaseusages.go b/services/sql/mgmt/2014-04-01/sql/databaseusages.go new file mode 100644 index 000000000000..45f0a1e730a4 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/databaseusages.go @@ -0,0 +1,123 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabaseUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type DatabaseUsagesClient struct { + BaseClient +} + +// NewDatabaseUsagesClient creates an instance of the DatabaseUsagesClient client. +func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { + return NewDatabaseUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabaseUsagesClientWithBaseURI creates an instance of the DatabaseUsagesClient client. +func NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { + return DatabaseUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByDatabase returns database usages. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DatabaseUsagesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseUsageListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseUsagesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client DatabaseUsagesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseUsagesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client DatabaseUsagesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseUsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/datamaskingpolicies.go b/services/sql/mgmt/2014-04-01/sql/datamaskingpolicies.go new file mode 100644 index 000000000000..65303d3d345a --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/datamaskingpolicies.go @@ -0,0 +1,210 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataMaskingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type DataMaskingPoliciesClient struct { + BaseClient +} + +// NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. +func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { + return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient client. +func NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { + return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database data masking policy +// Parameters: +// resourceGroupName - the name of the resource group 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. +// parameters - parameters for creating or updating a data masking policy. +func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "dataMaskingPolicyName": autorest.Encode("path", "Default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + parameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataMaskingPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a database data masking policy. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "dataMaskingPolicyName": autorest.Encode("path", "Default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataMaskingPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/datamaskingrules.go b/services/sql/mgmt/2014-04-01/sql/datamaskingrules.go new file mode 100644 index 000000000000..d7a6ff263792 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/datamaskingrules.go @@ -0,0 +1,223 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataMaskingRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type DataMaskingRulesClient struct { + BaseClient +} + +// NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. +func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { + return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient client. +func NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { + return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a database data masking rule. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// dataMaskingRuleName - the name of the data masking rule. +// parameters - the required parameters for creating or updating a data masking rule. +func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties.SchemaName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DataMaskingRuleProperties.TableName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DataMaskingRuleProperties.ColumnName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("sql.DataMaskingRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "dataMaskingPolicyName": autorest.Encode("path", "Default"), + "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + parameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataMaskingRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDatabase gets a list of database data masking rules. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client DataMaskingRulesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingRuleListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client DataMaskingRulesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "dataMaskingPolicyName": autorest.Encode("path", "Default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client DataMaskingRulesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client DataMaskingRulesClient) ListByDatabaseResponder(resp *http.Response) (result DataMaskingRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/disasterrecoveryconfigurations.go b/services/sql/mgmt/2014-04-01/sql/disasterrecoveryconfigurations.go new file mode 100644 index 000000000000..4ff7c9f53201 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/disasterrecoveryconfigurations.go @@ -0,0 +1,520 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DisasterRecoveryConfigurationsClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type DisasterRecoveryConfigurationsClient struct { + BaseClient +} + +// NewDisasterRecoveryConfigurationsClient creates an instance of the DisasterRecoveryConfigurationsClient client. +func NewDisasterRecoveryConfigurationsClient(subscriptionID string) DisasterRecoveryConfigurationsClient { + return NewDisasterRecoveryConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisasterRecoveryConfigurationsClientWithBaseURI creates an instance of the DisasterRecoveryConfigurationsClient +// client. +func NewDisasterRecoveryConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigurationsClient { + return DisasterRecoveryConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a disaster recovery configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// disasterRecoveryConfigurationName - the name of the disaster recovery configuration to be created/updated. +func (client DisasterRecoveryConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result DisasterRecoveryConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, disasterRecoveryConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisasterRecoveryConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "disasterRecoveryConfigurationName": autorest.Encode("path", disasterRecoveryConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future DisasterRecoveryConfigurationsCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result DisasterRecoveryConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a disaster recovery configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// disasterRecoveryConfigurationName - the name of the disaster recovery configuration to be deleted. +func (client DisasterRecoveryConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result DisasterRecoveryConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, disasterRecoveryConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DisasterRecoveryConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "disasterRecoveryConfigurationName": autorest.Encode("path", disasterRecoveryConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) DeleteSender(req *http.Request) (future DisasterRecoveryConfigurationsDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Failover fails over from the current primary server to this server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// disasterRecoveryConfigurationName - the name of the disaster recovery configuration to failover. +func (client DisasterRecoveryConfigurationsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result DisasterRecoveryConfigurationsFailoverFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.Failover") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, disasterRecoveryConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Failover", nil, "Failure preparing request") + return + } + + result, err = client.FailoverSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Failover", result.Response(), "Failure sending request") + return + } + + return +} + +// FailoverPreparer prepares the Failover request. +func (client DisasterRecoveryConfigurationsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "disasterRecoveryConfigurationName": autorest.Encode("path", disasterRecoveryConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/failover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FailoverSender sends the Failover request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) FailoverSender(req *http.Request) (future DisasterRecoveryConfigurationsFailoverFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// FailoverResponder handles the response to the Failover request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) FailoverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// FailoverAllowDataLoss fails over from the current primary server to this server. This operation might result in data +// loss. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// disasterRecoveryConfigurationName - the name of the disaster recovery configuration to failover forcefully. +func (client DisasterRecoveryConfigurationsClient) FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result DisasterRecoveryConfigurationsFailoverAllowDataLossFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.FailoverAllowDataLoss") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.FailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, disasterRecoveryConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "FailoverAllowDataLoss", nil, "Failure preparing request") + return + } + + result, err = client.FailoverAllowDataLossSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "FailoverAllowDataLoss", result.Response(), "Failure sending request") + return + } + + return +} + +// FailoverAllowDataLossPreparer prepares the FailoverAllowDataLoss request. +func (client DisasterRecoveryConfigurationsClient) FailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "disasterRecoveryConfigurationName": autorest.Encode("path", disasterRecoveryConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/forceFailoverAllowDataLoss", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FailoverAllowDataLossSender sends the FailoverAllowDataLoss request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) FailoverAllowDataLossSender(req *http.Request) (future DisasterRecoveryConfigurationsFailoverAllowDataLossFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// FailoverAllowDataLossResponder handles the response to the FailoverAllowDataLoss request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) FailoverAllowDataLossResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a disaster recovery configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// disasterRecoveryConfigurationName - the name of the disaster recovery configuration. +func (client DisasterRecoveryConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result DisasterRecoveryConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, disasterRecoveryConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisasterRecoveryConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "disasterRecoveryConfigurationName": autorest.Encode("path", disasterRecoveryConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) GetResponder(resp *http.Response) (result DisasterRecoveryConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists a server's disaster recovery configuration. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client DisasterRecoveryConfigurationsClient) List(ctx context.Context, resourceGroupName string, serverName string) (result DisasterRecoveryConfigurationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DisasterRecoveryConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisasterRecoveryConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DisasterRecoveryConfigurationsClient) ListResponder(resp *http.Response) (result DisasterRecoveryConfigurationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/elasticpools.go b/services/sql/mgmt/2014-04-01/sql/elasticpools.go index ed5ee5d537eb..8b2ff84aad84 100644 --- a/services/sql/mgmt/2014-04-01/sql/elasticpools.go +++ b/services/sql/mgmt/2014-04-01/sql/elasticpools.go @@ -363,6 +363,168 @@ func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (res return } +// ListMetricDefinitions returns elastic pool metric definitions. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ElasticPoolsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result MetricDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetricDefinitions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client ElasticPoolsClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetrics returns elastic pool metrics. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result MetricListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, elasticPoolName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client ElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update updates an existing elastic pool. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/sql/mgmt/2014-04-01/sql/extensions.go b/services/sql/mgmt/2014-04-01/sql/extensions.go new file mode 100644 index 000000000000..e240a3ccadf4 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/extensions.go @@ -0,0 +1,203 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExtensionsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact +// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and +// delete databases. +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient client. +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a database extension. This API is deprecated and should not be used. +// Parameters: +// resourceGroupName - the name of the resource group 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 to import into +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "extensionName": autorest.Encode("path", "import"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListByDatabase gets database extensions. This API is deprecated and should not be used. +// Parameters: +// resourceGroupName - the name of the resource group 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 to import into +func (client ExtensionsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ExtensionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ExtensionsClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client ExtensionsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListByDatabaseResponder(resp *http.Response) (result ExtensionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/geobackuppolicies.go b/services/sql/mgmt/2014-04-01/sql/geobackuppolicies.go new file mode 100644 index 000000000000..28e35d715a1b --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/geobackuppolicies.go @@ -0,0 +1,297 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GeoBackupPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type GeoBackupPoliciesClient struct { + BaseClient +} + +// NewGeoBackupPoliciesClient creates an instance of the GeoBackupPoliciesClient client. +func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { + return NewGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGeoBackupPoliciesClientWithBaseURI creates an instance of the GeoBackupPoliciesClient client. +func NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { + return GeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate updates a database geo backup policy. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// parameters - the required parameters for creating or updating the geo backup policy. +func (client GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (result GeoBackupPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.GeoBackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("sql.GeoBackupPoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "geoBackupPolicyName": autorest.Encode("path", "Default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GeoBackupPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result GeoBackupPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a geo backup policy. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "geoBackupPolicyName": autorest.Encode("path", "Default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GeoBackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDatabase returns a list of geo backup policies. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client GeoBackupPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client GeoBackupPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client GeoBackupPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client GeoBackupPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result GeoBackupPolicyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/models.go b/services/sql/mgmt/2014-04-01/sql/models.go index 7a19e59246e4..c98749074733 100644 --- a/services/sql/mgmt/2014-04-01/sql/models.go +++ b/services/sql/mgmt/2014-04-01/sql/models.go @@ -30,6 +30,25 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/sql/mgmt/2014-04-01/sql" +// AdvisorStatus enumerates the values for advisor status. +type AdvisorStatus string + +const ( + // GA ... + GA AdvisorStatus = "GA" + // LimitedPublicPreview ... + LimitedPublicPreview AdvisorStatus = "LimitedPublicPreview" + // PrivatePreview ... + PrivatePreview AdvisorStatus = "PrivatePreview" + // PublicPreview ... + PublicPreview AdvisorStatus = "PublicPreview" +) + +// PossibleAdvisorStatusValues returns an array of possible values for the AdvisorStatus const type. +func PossibleAdvisorStatusValues() []AdvisorStatus { + return []AdvisorStatus{GA, LimitedPublicPreview, PrivatePreview, PublicPreview} +} + // AuthenticationType enumerates the values for authentication type. type AuthenticationType string @@ -45,6 +64,57 @@ func PossibleAuthenticationTypeValues() []AuthenticationType { return []AuthenticationType{ADPassword, SQL} } +// AutoExecuteStatus enumerates the values for auto execute status. +type AutoExecuteStatus string + +const ( + // Default ... + Default AutoExecuteStatus = "Default" + // Disabled ... + Disabled AutoExecuteStatus = "Disabled" + // Enabled ... + Enabled AutoExecuteStatus = "Enabled" +) + +// PossibleAutoExecuteStatusValues returns an array of possible values for the AutoExecuteStatus const type. +func PossibleAutoExecuteStatusValues() []AutoExecuteStatus { + return []AutoExecuteStatus{Default, Disabled, Enabled} +} + +// BackupLongTermRetentionPolicyState enumerates the values for backup long term retention policy state. +type BackupLongTermRetentionPolicyState string + +const ( + // BackupLongTermRetentionPolicyStateDisabled ... + BackupLongTermRetentionPolicyStateDisabled BackupLongTermRetentionPolicyState = "Disabled" + // BackupLongTermRetentionPolicyStateEnabled ... + BackupLongTermRetentionPolicyStateEnabled BackupLongTermRetentionPolicyState = "Enabled" +) + +// PossibleBackupLongTermRetentionPolicyStateValues returns an array of possible values for the BackupLongTermRetentionPolicyState const type. +func PossibleBackupLongTermRetentionPolicyStateValues() []BackupLongTermRetentionPolicyState { + return []BackupLongTermRetentionPolicyState{BackupLongTermRetentionPolicyStateDisabled, BackupLongTermRetentionPolicyStateEnabled} +} + +// CapabilityStatus enumerates the values for capability status. +type CapabilityStatus string + +const ( + // CapabilityStatusAvailable ... + CapabilityStatusAvailable CapabilityStatus = "Available" + // CapabilityStatusDefault ... + CapabilityStatusDefault CapabilityStatus = "Default" + // CapabilityStatusDisabled ... + CapabilityStatusDisabled CapabilityStatus = "Disabled" + // CapabilityStatusVisible ... + CapabilityStatusVisible CapabilityStatus = "Visible" +) + +// PossibleCapabilityStatusValues returns an array of possible values for the CapabilityStatus const type. +func PossibleCapabilityStatusValues() []CapabilityStatus { + return []CapabilityStatus{CapabilityStatusAvailable, CapabilityStatusDefault, CapabilityStatusDisabled, CapabilityStatusVisible} +} + // CheckNameAvailabilityReason enumerates the values for check name availability reason. type CheckNameAvailabilityReason string @@ -64,27 +134,27 @@ func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { type CreateMode string const ( - // Copy ... - Copy CreateMode = "Copy" - // Default ... - Default CreateMode = "Default" - // NonReadableSecondary ... - NonReadableSecondary CreateMode = "NonReadableSecondary" - // OnlineSecondary ... - OnlineSecondary CreateMode = "OnlineSecondary" - // PointInTimeRestore ... - PointInTimeRestore CreateMode = "PointInTimeRestore" - // Recovery ... - Recovery CreateMode = "Recovery" - // Restore ... - Restore CreateMode = "Restore" - // RestoreLongTermRetentionBackup ... - RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" + // CreateModeCopy ... + CreateModeCopy CreateMode = "Copy" + // CreateModeDefault ... + CreateModeDefault CreateMode = "Default" + // CreateModeNonReadableSecondary ... + CreateModeNonReadableSecondary CreateMode = "NonReadableSecondary" + // CreateModeOnlineSecondary ... + CreateModeOnlineSecondary CreateMode = "OnlineSecondary" + // CreateModePointInTimeRestore ... + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + // CreateModeRecovery ... + CreateModeRecovery CreateMode = "Recovery" + // CreateModeRestore ... + CreateModeRestore CreateMode = "Restore" + // CreateModeRestoreLongTermRetentionBackup ... + CreateModeRestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" ) // PossibleCreateModeValues returns an array of possible values for the CreateMode const type. func PossibleCreateModeValues() []CreateMode { - return []CreateMode{Copy, Default, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, Restore, RestoreLongTermRetentionBackup} + return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeNonReadableSecondary, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreLongTermRetentionBackup} } // DatabaseEdition enumerates the values for database edition. @@ -126,6 +196,127 @@ func PossibleDatabaseEditionValues() []DatabaseEdition { return []DatabaseEdition{Basic, Business, BusinessCritical, DataWarehouse, Free, GeneralPurpose, Hyperscale, Premium, PremiumRS, Standard, Stretch, System, System2, Web} } +// DataMaskingFunction enumerates the values for data masking function. +type DataMaskingFunction string + +const ( + // DataMaskingFunctionCCN ... + DataMaskingFunctionCCN DataMaskingFunction = "CCN" + // DataMaskingFunctionDefault ... + DataMaskingFunctionDefault DataMaskingFunction = "Default" + // DataMaskingFunctionEmail ... + DataMaskingFunctionEmail DataMaskingFunction = "Email" + // DataMaskingFunctionNumber ... + DataMaskingFunctionNumber DataMaskingFunction = "Number" + // DataMaskingFunctionSSN ... + DataMaskingFunctionSSN DataMaskingFunction = "SSN" + // DataMaskingFunctionText ... + DataMaskingFunctionText DataMaskingFunction = "Text" +) + +// PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. +func PossibleDataMaskingFunctionValues() []DataMaskingFunction { + return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} +} + +// DataMaskingRuleState enumerates the values for data masking rule state. +type DataMaskingRuleState string + +const ( + // DataMaskingRuleStateDisabled ... + DataMaskingRuleStateDisabled DataMaskingRuleState = "Disabled" + // DataMaskingRuleStateEnabled ... + DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" +) + +// PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. +func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { + return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} +} + +// DataMaskingState enumerates the values for data masking state. +type DataMaskingState string + +const ( + // DataMaskingStateDisabled ... + DataMaskingStateDisabled DataMaskingState = "Disabled" + // DataMaskingStateEnabled ... + DataMaskingStateEnabled DataMaskingState = "Enabled" +) + +// PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. +func PossibleDataMaskingStateValues() []DataMaskingState { + return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} +} + +// DisasterRecoveryConfigurationAutoFailover enumerates the values for disaster recovery configuration auto +// failover. +type DisasterRecoveryConfigurationAutoFailover string + +const ( + // Off ... + Off DisasterRecoveryConfigurationAutoFailover = "Off" + // On ... + On DisasterRecoveryConfigurationAutoFailover = "On" +) + +// PossibleDisasterRecoveryConfigurationAutoFailoverValues returns an array of possible values for the DisasterRecoveryConfigurationAutoFailover const type. +func PossibleDisasterRecoveryConfigurationAutoFailoverValues() []DisasterRecoveryConfigurationAutoFailover { + return []DisasterRecoveryConfigurationAutoFailover{Off, On} +} + +// DisasterRecoveryConfigurationFailoverPolicy enumerates the values for disaster recovery configuration +// failover policy. +type DisasterRecoveryConfigurationFailoverPolicy string + +const ( + // Automatic ... + Automatic DisasterRecoveryConfigurationFailoverPolicy = "Automatic" + // Manual ... + Manual DisasterRecoveryConfigurationFailoverPolicy = "Manual" +) + +// PossibleDisasterRecoveryConfigurationFailoverPolicyValues returns an array of possible values for the DisasterRecoveryConfigurationFailoverPolicy const type. +func PossibleDisasterRecoveryConfigurationFailoverPolicyValues() []DisasterRecoveryConfigurationFailoverPolicy { + return []DisasterRecoveryConfigurationFailoverPolicy{Automatic, Manual} +} + +// DisasterRecoveryConfigurationRole enumerates the values for disaster recovery configuration role. +type DisasterRecoveryConfigurationRole string + +const ( + // None ... + None DisasterRecoveryConfigurationRole = "None" + // Primary ... + Primary DisasterRecoveryConfigurationRole = "Primary" + // Secondary ... + Secondary DisasterRecoveryConfigurationRole = "Secondary" +) + +// PossibleDisasterRecoveryConfigurationRoleValues returns an array of possible values for the DisasterRecoveryConfigurationRole const type. +func PossibleDisasterRecoveryConfigurationRoleValues() []DisasterRecoveryConfigurationRole { + return []DisasterRecoveryConfigurationRole{None, Primary, Secondary} +} + +// DisasterRecoveryConfigurationStatus enumerates the values for disaster recovery configuration status. +type DisasterRecoveryConfigurationStatus string + +const ( + // Creating ... + Creating DisasterRecoveryConfigurationStatus = "Creating" + // Dropping ... + Dropping DisasterRecoveryConfigurationStatus = "Dropping" + // FailingOver ... + FailingOver DisasterRecoveryConfigurationStatus = "FailingOver" + // Ready ... + Ready DisasterRecoveryConfigurationStatus = "Ready" +) + +// PossibleDisasterRecoveryConfigurationStatusValues returns an array of possible values for the DisasterRecoveryConfigurationStatus const type. +func PossibleDisasterRecoveryConfigurationStatusValues() []DisasterRecoveryConfigurationStatus { + return []DisasterRecoveryConfigurationStatus{Creating, Dropping, FailingOver, Ready} +} + // ElasticPoolEdition enumerates the values for elastic pool edition. type ElasticPoolEdition string @@ -151,17 +342,165 @@ func PossibleElasticPoolEditionValues() []ElasticPoolEdition { type ElasticPoolState string const ( - // Creating ... - Creating ElasticPoolState = "Creating" - // Disabled ... - Disabled ElasticPoolState = "Disabled" - // Ready ... - Ready ElasticPoolState = "Ready" + // ElasticPoolStateCreating ... + ElasticPoolStateCreating ElasticPoolState = "Creating" + // ElasticPoolStateDisabled ... + ElasticPoolStateDisabled ElasticPoolState = "Disabled" + // ElasticPoolStateReady ... + ElasticPoolStateReady ElasticPoolState = "Ready" ) // PossibleElasticPoolStateValues returns an array of possible values for the ElasticPoolState const type. func PossibleElasticPoolStateValues() []ElasticPoolState { - return []ElasticPoolState{Creating, Disabled, Ready} + return []ElasticPoolState{ElasticPoolStateCreating, ElasticPoolStateDisabled, ElasticPoolStateReady} +} + +// GeoBackupPolicyState enumerates the values for geo backup policy state. +type GeoBackupPolicyState string + +const ( + // GeoBackupPolicyStateDisabled ... + GeoBackupPolicyStateDisabled GeoBackupPolicyState = "Disabled" + // GeoBackupPolicyStateEnabled ... + GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" +) + +// PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. +func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { + return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} +} + +// MaxSizeUnits enumerates the values for max size units. +type MaxSizeUnits string + +const ( + // Gigabytes ... + Gigabytes MaxSizeUnits = "Gigabytes" + // Megabytes ... + Megabytes MaxSizeUnits = "Megabytes" + // Petabytes ... + Petabytes MaxSizeUnits = "Petabytes" + // Terabytes ... + Terabytes MaxSizeUnits = "Terabytes" +) + +// PossibleMaxSizeUnitsValues returns an array of possible values for the MaxSizeUnits const type. +func PossibleMaxSizeUnitsValues() []MaxSizeUnits { + return []MaxSizeUnits{Gigabytes, Megabytes, Petabytes, Terabytes} +} + +// PerformanceLevelUnit enumerates the values for performance level unit. +type PerformanceLevelUnit string + +const ( + // DTU ... + DTU PerformanceLevelUnit = "DTU" +) + +// PossiblePerformanceLevelUnitValues returns an array of possible values for the PerformanceLevelUnit const type. +func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { + return []PerformanceLevelUnit{DTU} +} + +// PrimaryAggregationType enumerates the values for primary aggregation type. +type PrimaryAggregationType string + +const ( + // PrimaryAggregationTypeAverage ... + PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" + // PrimaryAggregationTypeCount ... + PrimaryAggregationTypeCount PrimaryAggregationType = "Count" + // PrimaryAggregationTypeMaximum ... + PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" + // PrimaryAggregationTypeMinimum ... + PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" + // PrimaryAggregationTypeNone ... + PrimaryAggregationTypeNone PrimaryAggregationType = "None" + // PrimaryAggregationTypeTotal ... + PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" +) + +// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. +func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { + return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeCount, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} +} + +// QueryAggregationFunction enumerates the values for query aggregation function. +type QueryAggregationFunction string + +const ( + // Avg ... + Avg QueryAggregationFunction = "avg" + // Max ... + Max QueryAggregationFunction = "max" + // Min ... + Min QueryAggregationFunction = "min" + // Sum ... + Sum QueryAggregationFunction = "sum" +) + +// PossibleQueryAggregationFunctionValues returns an array of possible values for the QueryAggregationFunction const type. +func PossibleQueryAggregationFunctionValues() []QueryAggregationFunction { + return []QueryAggregationFunction{Avg, Max, Min, Sum} +} + +// QueryExecutionType enumerates the values for query execution type. +type QueryExecutionType string + +const ( + // Aborted ... + Aborted QueryExecutionType = "aborted" + // Any ... + Any QueryExecutionType = "any" + // Exception ... + Exception QueryExecutionType = "exception" + // Irregular ... + Irregular QueryExecutionType = "irregular" + // Regular ... + Regular QueryExecutionType = "regular" +) + +// PossibleQueryExecutionTypeValues returns an array of possible values for the QueryExecutionType const type. +func PossibleQueryExecutionTypeValues() []QueryExecutionType { + return []QueryExecutionType{Aborted, Any, Exception, Irregular, Regular} +} + +// QueryMetricUnit enumerates the values for query metric unit. +type QueryMetricUnit string + +const ( + // KB ... + KB QueryMetricUnit = "KB" + // Microseconds ... + Microseconds QueryMetricUnit = "microseconds" + // Percentage ... + Percentage QueryMetricUnit = "percentage" +) + +// PossibleQueryMetricUnitValues returns an array of possible values for the QueryMetricUnit const type. +func PossibleQueryMetricUnitValues() []QueryMetricUnit { + return []QueryMetricUnit{KB, Microseconds, Percentage} +} + +// QueryObservedMetricType enumerates the values for query observed metric type. +type QueryObservedMetricType string + +const ( + // CPU ... + CPU QueryObservedMetricType = "cpu" + // Duration ... + Duration QueryObservedMetricType = "duration" + // ExecutionCount ... + ExecutionCount QueryObservedMetricType = "executionCount" + // Io ... + Io QueryObservedMetricType = "io" + // Logio ... + Logio QueryObservedMetricType = "logio" +) + +// PossibleQueryObservedMetricTypeValues returns an array of possible values for the QueryObservedMetricType const type. +func PossibleQueryObservedMetricTypeValues() []QueryObservedMetricType { + return []QueryObservedMetricType{CPU, Duration, ExecutionCount, Io, Logio} } // ReadScale enumerates the values for read scale. @@ -288,6 +627,21 @@ func PossibleReplicationStateValues() []ReplicationState { return []ReplicationState{CATCHUP, PENDING, SEEDING, SUSPENDED} } +// RestorePointType enumerates the values for restore point type. +type RestorePointType string + +const ( + // CONTINUOUS ... + CONTINUOUS RestorePointType = "CONTINUOUS" + // DISCRETE ... + DISCRETE RestorePointType = "DISCRETE" +) + +// PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. +func PossibleRestorePointTypeValues() []RestorePointType { + return []RestorePointType{CONTINUOUS, DISCRETE} +} + // SampleName enumerates the values for sample name. type SampleName string @@ -348,6 +702,53 @@ func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUs return []SecurityAlertPolicyUseServerDefault{SecurityAlertPolicyUseServerDefaultDisabled, SecurityAlertPolicyUseServerDefaultEnabled} } +// ServerConnectionType enumerates the values for server connection type. +type ServerConnectionType string + +const ( + // ServerConnectionTypeDefault ... + ServerConnectionTypeDefault ServerConnectionType = "Default" + // ServerConnectionTypeProxy ... + ServerConnectionTypeProxy ServerConnectionType = "Proxy" + // ServerConnectionTypeRedirect ... + ServerConnectionTypeRedirect ServerConnectionType = "Redirect" +) + +// PossibleServerConnectionTypeValues returns an array of possible values for the ServerConnectionType const type. +func PossibleServerConnectionTypeValues() []ServerConnectionType { + return []ServerConnectionType{ServerConnectionTypeDefault, ServerConnectionTypeProxy, ServerConnectionTypeRedirect} +} + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // ServerStateDisabled ... + ServerStateDisabled ServerState = "Disabled" + // ServerStateReady ... + ServerStateReady ServerState = "Ready" +) + +// PossibleServerStateValues returns an array of possible values for the ServerState const type. +func PossibleServerStateValues() []ServerState { + return []ServerState{ServerStateDisabled, ServerStateReady} +} + +// ServerVersion enumerates the values for server version. +type ServerVersion string + +const ( + // OneTwoFullStopZero ... + OneTwoFullStopZero ServerVersion = "12.0" + // TwoFullStopZero ... + TwoFullStopZero ServerVersion = "2.0" +) + +// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. +func PossibleServerVersionValues() []ServerVersion { + return []ServerVersion{OneTwoFullStopZero, TwoFullStopZero} +} + // ServiceObjectiveName enumerates the values for service objective name. type ServiceObjectiveName string @@ -535,39 +936,61 @@ func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryption return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} } -// CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. -type CheckNameAvailabilityRequest struct { - // Name - The name whose availability is to be checked. - Name *string `json:"name,omitempty"` - // Type - The type of resource that is used as the scope of the availability check. - Type *string `json:"type,omitempty"` +// UnitDefinitionType enumerates the values for unit definition type. +type UnitDefinitionType string + +const ( + // Bytes ... + Bytes UnitDefinitionType = "Bytes" + // BytesPerSecond ... + BytesPerSecond UnitDefinitionType = "BytesPerSecond" + // Count ... + Count UnitDefinitionType = "Count" + // CountPerSecond ... + CountPerSecond UnitDefinitionType = "CountPerSecond" + // Percent ... + Percent UnitDefinitionType = "Percent" + // Seconds ... + Seconds UnitDefinitionType = "Seconds" +) + +// PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. +func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { + return []UnitDefinitionType{Bytes, BytesPerSecond, Count, CountPerSecond, Percent, Seconds} } -// CheckNameAvailabilityResponse a response indicating whether the specified name for a resource is -// available. -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // Available - READ-ONLY; True if the name is available, otherwise false. - Available *bool `json:"available,omitempty"` - // Message - READ-ONLY; A message explaining why the name is unavailable. Will be null if the name is available. - Message *string `json:"message,omitempty"` - // Name - READ-ONLY; The name whose availability was checked. - Name *string `json:"name,omitempty"` - // Reason - READ-ONLY; The reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists' - Reason CheckNameAvailabilityReason `json:"reason,omitempty"` +// UnitType enumerates the values for unit type. +type UnitType string + +const ( + // UnitTypeBytes ... + UnitTypeBytes UnitType = "bytes" + // UnitTypeBytesPerSecond ... + UnitTypeBytesPerSecond UnitType = "bytesPerSecond" + // UnitTypeCount ... + UnitTypeCount UnitType = "count" + // UnitTypeCountPerSecond ... + UnitTypeCountPerSecond UnitType = "countPerSecond" + // UnitTypePercent ... + UnitTypePercent UnitType = "percent" + // UnitTypeSeconds ... + UnitTypeSeconds UnitType = "seconds" +) + +// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. +func PossibleUnitTypeValues() []UnitType { + return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypePercent, UnitTypeSeconds} } -// Database represents a database. -type Database struct { +// Advisor database Advisor. +type Advisor struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. + // Kind - READ-ONLY; Resource kind. Kind *string `json:"kind,omitempty"` - // DatabaseProperties - The properties representing the resource. - *DatabaseProperties `json:"properties,omitempty"` - // Location - Resource location. + // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + // AdvisorProperties - Resource properties. + *AdvisorProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -576,23 +999,17 @@ type Database struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Advisor. +func (a Advisor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags + if a.AdvisorProperties != nil { + objectMap["properties"] = a.AdvisorProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for Advisor struct. +func (a *Advisor) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -607,16 +1024,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Kind = &kind - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties + a.Kind = &kind } case "location": if v != nil { @@ -625,16 +1033,16 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Location = &location + a.Location = &location } - case "tags": + case "properties": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var advisorProperties AdvisorProperties + err = json.Unmarshal(*v, &advisorProperties) if err != nil { return err } - d.Tags = tags + a.AdvisorProperties = &advisorProperties } case "id": if v != nil { @@ -643,7 +1051,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.ID = &ID + a.ID = &ID } case "name": if v != nil { @@ -652,7 +1060,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Name = &name + a.Name = &name } case "type": if v != nil { @@ -661,7 +1069,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Type = &typeVar + a.Type = &typeVar } } } @@ -669,168 +1077,161 @@ func (d *Database) UnmarshalJSON(body []byte) error { return nil } -// DatabaseListResult represents the response to a list database request. -type DatabaseListResult struct { +// AdvisorListResult represents the response to a list advisors request. +type AdvisorListResult struct { autorest.Response `json:"-"` - // Value - The list of databases housed in the server. - Value *[]Database `json:"value,omitempty"` + // Value - The list of advisors. + Value *[]Advisor `json:"value,omitempty"` } -// DatabaseProperties represents the properties of a database. -type DatabaseProperties struct { - // Collation - The collation of the database. If createMode is not Default, this value is ignored. - Collation *string `json:"collation,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // ContainmentState - READ-ONLY; The containment state of the database. - ContainmentState *int64 `json:"containmentState,omitempty"` - // CurrentServiceObjectiveID - READ-ONLY; The current service level objective ID of the database. This is the ID of the service level objective that is currently active. - CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` - // DatabaseID - READ-ONLY; The ID of the database. - DatabaseID *uuid.UUID `json:"databaseId,omitempty"` - // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // CreateMode - Specifies the mode of database creation. - // Default: regular database creation. - // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. - // OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. - // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. - // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. - // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. - // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. - // Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup' - CreateMode CreateMode `json:"createMode,omitempty"` - // SourceDatabaseID - Conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // SourceDatabaseDeletionDate - Conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` - // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // RecoveryServicesRecoveryPointResourceID - Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. - RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` - // Edition - The edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - Edition DatabaseEdition `json:"edition,omitempty"` - // MaxSizeBytes - The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // RequestedServiceObjectiveID - The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. - // - // The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. - RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` - // RequestedServiceObjectiveName - The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` - // ServiceLevelObjective - READ-ONLY; The current service level objective of the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - // Status - READ-ONLY; The status of the database. - Status *string `json:"status,omitempty"` - // ElasticPoolName - The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // ServiceTierAdvisors - READ-ONLY; The list of service tier advisors for this database. Expanded property - ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` - // TransparentDataEncryption - READ-ONLY; The transparent data encryption info for this database. - TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` - // RecommendedIndex - READ-ONLY; The recommended indices for this database. - RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` - // FailoverGroupID - READ-ONLY; The resource identifier of the failover group containing this database. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // ReadScale - Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'ReadScaleEnabled', 'ReadScaleDisabled' - ReadScale ReadScale `json:"readScale,omitempty"` - // SampleName - Indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT' - SampleName SampleName `json:"sampleName,omitempty"` - // ZoneRedundant - 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"` +// AdvisorProperties properties for a Database, Server or Elastic Pool Advisor. +type AdvisorProperties struct { + // AdvisorStatus - READ-ONLY; Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Possible values include: 'GA', 'PublicPreview', 'LimitedPublicPreview', 'PrivatePreview' + AdvisorStatus AdvisorStatus `json:"advisorStatus,omitempty"` + // AutoExecuteValue - Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' + AutoExecuteValue AutoExecuteStatus `json:"autoExecuteValue,omitempty"` + // RecommendationsStatus - 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"` + // LastChecked - READ-ONLY; Gets the time when the current resource was analyzed for recommendations by this advisor. + LastChecked *date.Time `json:"lastChecked,omitempty"` } -// DatabasesCreateImportOperationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasesCreateImportOperationFuture struct { +// BackupLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type BackupLongTermRetentionPoliciesCreateOrUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesCreateImportOperationFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { +func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) Result(client BackupLongTermRetentionPoliciesClient) (bltrp BackupLongTermRetentionPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") + err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.CreateImportOperationResponder(ier.Response.Response) + if bltrp.Response.Response, err = future.GetResult(sender); err == nil && bltrp.Response.Response.StatusCode != http.StatusNoContent { + bltrp, err = client.CreateOrUpdateResponder(bltrp.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", ier.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", bltrp.Response.Response, "Failure responding to request") } } return } -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.Future +// BackupLongTermRetentionPolicy a backup long term retention policy +type BackupLongTermRetentionPolicy struct { + autorest.Response `json:"-"` + // Location - READ-ONLY; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // BackupLongTermRetentionPolicyProperties - The properties of the backup long term retention policy + *BackupLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return +// MarshalJSON is the custom marshaler for BackupLongTermRetentionPolicy. +func (bltrp BackupLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bltrp.BackupLongTermRetentionPolicyProperties != nil { + objectMap["properties"] = bltrp.BackupLongTermRetentionPolicyProperties } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") - return + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionPolicy struct. +func (bltrp *BackupLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bltrp.Location = &location + } + case "properties": + if v != nil { + var backupLongTermRetentionPolicyProperties BackupLongTermRetentionPolicyProperties + err = json.Unmarshal(*v, &backupLongTermRetentionPolicyProperties) + if err != nil { + return err + } + bltrp.BackupLongTermRetentionPolicyProperties = &backupLongTermRetentionPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bltrp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bltrp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bltrp.Type = &typeVar + } } } - return + + return nil } -// DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. -type DatabaseSecurityAlertPolicy struct { +// BackupLongTermRetentionPolicyListResult represents the response to a list long-term retention policies +// request. +type BackupLongTermRetentionPolicyListResult struct { autorest.Response `json:"-"` - // Location - The geo-location where the resource lives + // Value - The list of long-term retention policies in the database. + Value *[]BackupLongTermRetentionPolicy `json:"value,omitempty"` +} + +// BackupLongTermRetentionPolicyProperties the properties of a backup long term retention policy +type BackupLongTermRetentionPolicyProperties struct { + // State - The status of the backup long term retention policy. Possible values include: 'BackupLongTermRetentionPolicyStateDisabled', 'BackupLongTermRetentionPolicyStateEnabled' + State BackupLongTermRetentionPolicyState `json:"state,omitempty"` + // RecoveryServicesBackupPolicyResourceID - The azure recovery services backup protection policy resource id + RecoveryServicesBackupPolicyResourceID *string `json:"recoveryServicesBackupPolicyResourceId,omitempty"` +} + +// BackupLongTermRetentionVault a backup long term retention vault +type BackupLongTermRetentionVault struct { + autorest.Response `json:"-"` + // Location - READ-ONLY; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // DatabaseSecurityAlertPolicyProperties - Properties of the security alert policy. - *DatabaseSecurityAlertPolicyProperties `json:"properties,omitempty"` + // BackupLongTermRetentionVaultProperties - The properties of the backup long term retention vault + *BackupLongTermRetentionVaultProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -839,20 +1240,17 @@ type DatabaseSecurityAlertPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. -func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for BackupLongTermRetentionVault. +func (bltrv BackupLongTermRetentionVault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if dsap.Location != nil { - objectMap["location"] = dsap.Location - } - if dsap.DatabaseSecurityAlertPolicyProperties != nil { - objectMap["properties"] = dsap.DatabaseSecurityAlertPolicyProperties + if bltrv.BackupLongTermRetentionVaultProperties != nil { + objectMap["properties"] = bltrv.BackupLongTermRetentionVaultProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. -func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionVault struct. +func (bltrv *BackupLongTermRetentionVault) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -867,25 +1265,16 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - dsap.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dsap.Kind = &kind + bltrv.Location = &location } case "properties": if v != nil { - var databaseSecurityAlertPolicyProperties DatabaseSecurityAlertPolicyProperties - err = json.Unmarshal(*v, &databaseSecurityAlertPolicyProperties) + var backupLongTermRetentionVaultProperties BackupLongTermRetentionVaultProperties + err = json.Unmarshal(*v, &backupLongTermRetentionVaultProperties) if err != nil { return err } - dsap.DatabaseSecurityAlertPolicyProperties = &databaseSecurityAlertPolicyProperties + bltrv.BackupLongTermRetentionVaultProperties = &backupLongTermRetentionVaultProperties } case "id": if v != nil { @@ -894,7 +1283,7 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - dsap.ID = &ID + bltrv.ID = &ID } case "name": if v != nil { @@ -903,7 +1292,7 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - dsap.Name = &name + bltrv.Name = &name } case "type": if v != nil { @@ -912,7 +1301,7 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - dsap.Type = &typeVar + bltrv.Type = &typeVar } } } @@ -920,165 +1309,2981 @@ func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { return nil } -// DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. -type DatabaseSecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. - DisabledAlerts *string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. - EmailAddresses *string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. Possible values include: 'SecurityAlertPolicyEmailAccountAdminsEnabled', 'SecurityAlertPolicyEmailAccountAdminsDisabled' - EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // UseServerDefault - Specifies whether to use the default server policy. Possible values include: 'SecurityAlertPolicyUseServerDefaultEnabled', 'SecurityAlertPolicyUseServerDefaultDisabled' - UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` -} - -// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesExportFuture struct { - azure.Future +// BackupLongTermRetentionVaultListResult represents the response to a list vaults request. +type BackupLongTermRetentionVaultListResult struct { + autorest.Response `json:"-"` + // Value - The list of vaults in the server. + Value *[]BackupLongTermRetentionVault `json:"value,omitempty"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *DatabasesExportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.ExportResponder(ier.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") - } - } - return +// BackupLongTermRetentionVaultProperties the properties of a backup long term retention vault. +type BackupLongTermRetentionVaultProperties struct { + // RecoveryServicesVaultResourceID - The azure recovery services vault resource id + RecoveryServicesVaultResourceID *string `json:"recoveryServicesVaultResourceId,omitempty"` } -// DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesImportFuture struct { +// BackupLongTermRetentionVaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type BackupLongTermRetentionVaultsCreateOrUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesImportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { +func (future *BackupLongTermRetentionVaultsCreateOrUpdateFuture) Result(client BackupLongTermRetentionVaultsClient) (bltrv BackupLongTermRetentionVault, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") + err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.ImportResponder(ier.Response.Response) + if bltrv.Response.Response, err = future.GetResult(sender); err == nil && bltrv.Response.Response.StatusCode != http.StatusNoContent { + bltrv, err = client.CreateOrUpdateResponder(bltrv.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", ier.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture", "Result", bltrv.Response.Response, "Failure responding to request") } } return } -// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesPauseFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *DatabasesPauseFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") - return - } - ar.Response = future.Response() - return +// CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. +type CheckNameAvailabilityRequest struct { + // Name - The name whose availability is to be checked. + Name *string `json:"name,omitempty"` + // Type - The type of resource that is used as the scope of the availability check. + Type *string `json:"type,omitempty"` } -// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// CheckNameAvailabilityResponse a response indicating whether the specified name for a resource is +// available. +type CheckNameAvailabilityResponse struct { + autorest.Response `json:"-"` + // Available - READ-ONLY; True if the name is available, otherwise false. + Available *bool `json:"available,omitempty"` + // Message - READ-ONLY; A message explaining why the name is unavailable. Will be null if the name is available. + Message *string `json:"message,omitempty"` + // Name - READ-ONLY; The name whose availability was checked. + Name *string `json:"name,omitempty"` + // Reason - READ-ONLY; The reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists' + Reason CheckNameAvailabilityReason `json:"reason,omitempty"` +} + +// Database represents a database. +type Database struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // DatabaseProperties - The properties representing the resource. + *DatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Database. +func (d Database) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DatabaseProperties != nil { + objectMap["properties"] = d.DatabaseProperties + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Database struct. +func (d *Database) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d.Kind = &kind + } + case "properties": + if v != nil { + var databaseProperties DatabaseProperties + err = json.Unmarshal(*v, &databaseProperties) + if err != nil { + return err + } + d.DatabaseProperties = &databaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseConnectionPolicy a database connection policy. +type DatabaseConnectionPolicy struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Resource kind. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // DatabaseConnectionPolicyProperties - Resource properties. + *DatabaseConnectionPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseConnectionPolicy. +func (dcp DatabaseConnectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcp.DatabaseConnectionPolicyProperties != nil { + objectMap["properties"] = dcp.DatabaseConnectionPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseConnectionPolicy struct. +func (dcp *DatabaseConnectionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dcp.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcp.Location = &location + } + case "properties": + if v != nil { + var databaseConnectionPolicyProperties DatabaseConnectionPolicyProperties + err = json.Unmarshal(*v, &databaseConnectionPolicyProperties) + if err != nil { + return err + } + dcp.DatabaseConnectionPolicyProperties = &databaseConnectionPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcp.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseConnectionPolicyProperties properties of a database connection policy. +type DatabaseConnectionPolicyProperties struct { + // SecurityEnabledAccess - The state of security access. + SecurityEnabledAccess *string `json:"securityEnabledAccess,omitempty"` + // ProxyDNSName - The fully qualified host name of the auditing proxy. + ProxyDNSName *string `json:"proxyDnsName,omitempty"` + // ProxyPort - The port number of the auditing proxy. + ProxyPort *string `json:"proxyPort,omitempty"` + // Visibility - The visibility of the auditing proxy. + Visibility *string `json:"visibility,omitempty"` + // UseServerDefault - Whether server default is enabled or disabled. + UseServerDefault *string `json:"useServerDefault,omitempty"` + // RedirectionState - The state of proxy redirection. + RedirectionState *string `json:"redirectionState,omitempty"` + // State - The connection policy state. + State *string `json:"state,omitempty"` +} + +// DatabaseListResult represents the response to a list database request. +type DatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of databases housed in the server. + Value *[]Database `json:"value,omitempty"` +} + +// DatabaseProperties represents the properties of a database. +type DatabaseProperties struct { + // Collation - The collation of the database. If createMode is not Default, this value is ignored. + Collation *string `json:"collation,omitempty"` + // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). + CreationDate *date.Time `json:"creationDate,omitempty"` + // ContainmentState - READ-ONLY; The containment state of the database. + ContainmentState *int64 `json:"containmentState,omitempty"` + // CurrentServiceObjectiveID - READ-ONLY; The current service level objective ID of the database. This is the ID of the service level objective that is currently active. + CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` + // DatabaseID - READ-ONLY; The ID of the database. + DatabaseID *uuid.UUID `json:"databaseId,omitempty"` + // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + // CreateMode - Specifies the mode of database creation. + // Default: regular database creation. + // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + // OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + // Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeCopy', 'CreateModeDefault', 'CreateModeNonReadableSecondary', 'CreateModeOnlineSecondary', 'CreateModePointInTimeRestore', 'CreateModeRecovery', 'CreateModeRestore', 'CreateModeRestoreLongTermRetentionBackup' + CreateMode CreateMode `json:"createMode,omitempty"` + // SourceDatabaseID - Conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + // SourceDatabaseDeletionDate - Conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` + // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + // RecoveryServicesRecoveryPointResourceID - Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` + // Edition - The edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. + // + // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + // + // ```azurecli + // az sql db list-editions -l -o table + // ```` + // + // ```powershell + // Get-AzSqlServerServiceObjective -Location + // ```` + // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' + Edition DatabaseEdition `json:"edition,omitempty"` + // MaxSizeBytes - The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + // RequestedServiceObjectiveID - The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. + // + // The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. + RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` + // RequestedServiceObjectiveName - The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. + // + // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + // + // ```azurecli + // az sql db list-editions -l -o table + // ```` + // + // ```powershell + // Get-AzSqlServerServiceObjective -Location + // ```` + // . Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' + RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` + // ServiceLevelObjective - READ-ONLY; The current service level objective of the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' + ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` + // Status - READ-ONLY; The status of the database. + Status *string `json:"status,omitempty"` + // ElasticPoolName - The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + // ServiceTierAdvisors - READ-ONLY; The list of service tier advisors for this database. Expanded property + ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` + // TransparentDataEncryption - READ-ONLY; The transparent data encryption info for this database. + TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` + // RecommendedIndex - READ-ONLY; The recommended indices for this database. + RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` + // FailoverGroupID - READ-ONLY; The resource identifier of the failover group containing this database. + FailoverGroupID *string `json:"failoverGroupId,omitempty"` + // ReadScale - Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'ReadScaleEnabled', 'ReadScaleDisabled' + ReadScale ReadScale `json:"readScale,omitempty"` + // SampleName - Indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT' + SampleName SampleName `json:"sampleName,omitempty"` + // ZoneRedundant - 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"` +} + +// DatabasesCreateImportOperationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DatabasesCreateImportOperationFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesCreateImportOperationFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.CreateImportOperationResponder(ier.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", ier.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. +type DatabaseSecurityAlertPolicy struct { + autorest.Response `json:"-"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // Kind - READ-ONLY; Resource kind. + Kind *string `json:"kind,omitempty"` + // DatabaseSecurityAlertPolicyProperties - Properties of the security alert policy. + *DatabaseSecurityAlertPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. +func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsap.Location != nil { + objectMap["location"] = dsap.Location + } + if dsap.DatabaseSecurityAlertPolicyProperties != nil { + objectMap["properties"] = dsap.DatabaseSecurityAlertPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. +func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dsap.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dsap.Kind = &kind + } + case "properties": + if v != nil { + var databaseSecurityAlertPolicyProperties DatabaseSecurityAlertPolicyProperties + err = json.Unmarshal(*v, &databaseSecurityAlertPolicyProperties) + if err != nil { + return err + } + dsap.DatabaseSecurityAlertPolicyProperties = &databaseSecurityAlertPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dsap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dsap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dsap.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. +type DatabaseSecurityAlertPolicyProperties struct { + // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' + State SecurityAlertPolicyState `json:"state,omitempty"` + // DisabledAlerts - Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. + DisabledAlerts *string `json:"disabledAlerts,omitempty"` + // EmailAddresses - Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + EmailAddresses *string `json:"emailAddresses,omitempty"` + // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. Possible values include: 'SecurityAlertPolicyEmailAccountAdminsEnabled', 'SecurityAlertPolicyEmailAccountAdminsDisabled' + EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` + // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. + RetentionDays *int32 `json:"retentionDays,omitempty"` + // UseServerDefault - Specifies whether to use the default server policy. Possible values include: 'SecurityAlertPolicyUseServerDefaultEnabled', 'SecurityAlertPolicyUseServerDefaultDisabled' + UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` +} + +// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesExportFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesExportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.ExportResponder(ier.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesImportFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesImportFuture) Result(client DatabasesClient) (ier ImportExportResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { + ier, err = client.ImportResponder(ier.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", ier.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesPauseFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesPauseFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") + return + } + ar.Response = future.Response() + return +} + +// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. type DatabasesResumeFuture struct { azure.Future } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") + return + } + ar.Response = future.Response() + return +} + +// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabaseTableAuditingPolicy a database table auditing policy. +type DatabaseTableAuditingPolicy struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Resource kind. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // DatabaseTableAuditingPolicyProperties - Resource properties. + *DatabaseTableAuditingPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseTableAuditingPolicy. +func (dtap DatabaseTableAuditingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dtap.DatabaseTableAuditingPolicyProperties != nil { + objectMap["properties"] = dtap.DatabaseTableAuditingPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseTableAuditingPolicy struct. +func (dtap *DatabaseTableAuditingPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dtap.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dtap.Location = &location + } + case "properties": + if v != nil { + var databaseTableAuditingPolicyProperties DatabaseTableAuditingPolicyProperties + err = json.Unmarshal(*v, &databaseTableAuditingPolicyProperties) + if err != nil { + return err + } + dtap.DatabaseTableAuditingPolicyProperties = &databaseTableAuditingPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dtap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dtap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dtap.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseTableAuditingPolicyListResult represents the response to a list database table auditing policies +// request. +type DatabaseTableAuditingPolicyListResult struct { + autorest.Response `json:"-"` + // Value - The list of database table auditing policies. + Value *[]DatabaseTableAuditingPolicy `json:"value,omitempty"` +} + +// DatabaseTableAuditingPolicyProperties properties of a database table auditing policy. +type DatabaseTableAuditingPolicyProperties struct { + // UseServerDefault - Whether server default is enabled or disabled. + UseServerDefault *string `json:"useServerDefault,omitempty"` + // AuditingState - The state of the policy. + AuditingState *string `json:"auditingState,omitempty"` + // AuditLogsTableName - The audit logs table name. + AuditLogsTableName *string `json:"auditLogsTableName,omitempty"` + // EventTypesToAudit - Comma-separated list of event types to audit. + EventTypesToAudit *string `json:"eventTypesToAudit,omitempty"` + // FullAuditLogsTableName - The full audit logs table name. + FullAuditLogsTableName *string `json:"fullAuditLogsTableName,omitempty"` + // RetentionDays - The number of days to keep in the audit logs. + RetentionDays *string `json:"retentionDays,omitempty"` + // StorageAccountKey - The key of the auditing storage account. + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + // StorageAccountName - The table storage account name + StorageAccountName *string `json:"storageAccountName,omitempty"` + // StorageAccountResourceGroupName - The table storage account resource group name + StorageAccountResourceGroupName *string `json:"storageAccountResourceGroupName,omitempty"` + // StorageAccountSecondaryKey - The secondary key of the auditing storage account. + StorageAccountSecondaryKey *string `json:"storageAccountSecondaryKey,omitempty"` + // StorageAccountSubscriptionID - The table storage subscription Id. + StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` + // StorageTableEndpoint - The storage table endpoint. + StorageTableEndpoint *string `json:"storageTableEndpoint,omitempty"` +} + +// DatabaseUpdate represents a database update. +type DatabaseUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // DatabaseProperties - The properties representing the resource. + *DatabaseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseUpdate. +func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if du.Tags != nil { + objectMap["tags"] = du.Tags + } + if du.DatabaseProperties != nil { + objectMap["properties"] = du.DatabaseProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. +func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + du.Tags = tags + } + case "properties": + if v != nil { + var databaseProperties DatabaseProperties + err = json.Unmarshal(*v, &databaseProperties) + if err != nil { + return err + } + du.DatabaseProperties = &databaseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + du.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + du.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + du.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseUsage the database usages. +type DatabaseUsage struct { + // Name - READ-ONLY; The name of the usage metric. + Name *string `json:"name,omitempty"` + // ResourceName - READ-ONLY; The name of the resource. + ResourceName *string `json:"resourceName,omitempty"` + // DisplayName - READ-ONLY; The usage metric display name. + DisplayName *string `json:"displayName,omitempty"` + // CurrentValue - READ-ONLY; The current value of the usage metric. + CurrentValue *float64 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; The current limit of the usage metric. + Limit *float64 `json:"limit,omitempty"` + // Unit - READ-ONLY; The units of the usage metric. + Unit *string `json:"unit,omitempty"` + // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). + NextResetTime *date.Time `json:"nextResetTime,omitempty"` +} + +// DatabaseUsageListResult the response to a list database metrics request. +type DatabaseUsageListResult struct { + autorest.Response `json:"-"` + // Value - The list of database usages for the database. + Value *[]DatabaseUsage `json:"value,omitempty"` +} + +// DataMaskingPolicy represents a database data masking policy. +type DataMaskingPolicy struct { + autorest.Response `json:"-"` + // DataMaskingPolicyProperties - The properties of the data masking policy. + *DataMaskingPolicyProperties `json:"properties,omitempty"` + // Location - READ-ONLY; The location of the data masking policy. + Location *string `json:"location,omitempty"` + // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. + Kind *string `json:"kind,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataMaskingPolicy. +func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dmp.DataMaskingPolicyProperties != nil { + objectMap["properties"] = dmp.DataMaskingPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. +func (dmp *DataMaskingPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataMaskingPolicyProperties DataMaskingPolicyProperties + err = json.Unmarshal(*v, &dataMaskingPolicyProperties) + if err != nil { + return err + } + dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dmp.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dmp.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dmp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dmp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dmp.Type = &typeVar + } + } + } + + return nil +} + +// DataMaskingPolicyProperties the properties of a database data masking policy. +type DataMaskingPolicyProperties struct { + // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' + DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` + // ExemptPrincipals - 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"` + // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. + ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` + // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. + MaskingLevel *string `json:"maskingLevel,omitempty"` +} + +// DataMaskingRule represents a database data masking rule. +type DataMaskingRule struct { + autorest.Response `json:"-"` + // DataMaskingRuleProperties - The properties of the resource. + *DataMaskingRuleProperties `json:"properties,omitempty"` + // Location - READ-ONLY; The location of the data masking rule. + Location *string `json:"location,omitempty"` + // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. + Kind *string `json:"kind,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataMaskingRule. +func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dmr.DataMaskingRuleProperties != nil { + objectMap["properties"] = dmr.DataMaskingRuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. +func (dmr *DataMaskingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataMaskingRuleProperties DataMaskingRuleProperties + err = json.Unmarshal(*v, &dataMaskingRuleProperties) + if err != nil { + return err + } + dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dmr.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dmr.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dmr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dmr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dmr.Type = &typeVar + } + } + } + + return nil +} + +// DataMaskingRuleListResult the response to a list data masking rules request. +type DataMaskingRuleListResult struct { + autorest.Response `json:"-"` + // Value - The list of database data masking rules. + Value *[]DataMaskingRule `json:"value,omitempty"` +} + +// DataMaskingRuleProperties the properties of a database data masking rule. +type DataMaskingRuleProperties struct { + // ID - READ-ONLY; The rule Id. + ID *string `json:"id,omitempty"` + // AliasName - The alias name. This is a legacy parameter and is no longer used. + AliasName *string `json:"aliasName,omitempty"` + // RuleState - 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. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' + RuleState DataMaskingRuleState `json:"ruleState,omitempty"` + // SchemaName - The schema name on which the data masking rule is applied. + SchemaName *string `json:"schemaName,omitempty"` + // TableName - The table name on which the data masking rule is applied. + TableName *string `json:"tableName,omitempty"` + // ColumnName - The column name on which the data masking rule is applied. + ColumnName *string `json:"columnName,omitempty"` + // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' + MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` + // NumberFrom - 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"` + // NumberTo - 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"` + // PrefixSize - 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"` + // SuffixSize - 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"` + // ReplacementString - 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"` +} + +// DisasterRecoveryConfiguration represents a disaster recovery configuration. +type DisasterRecoveryConfiguration struct { + autorest.Response `json:"-"` + // DisasterRecoveryConfigurationProperties - The properties representing the resource. + *DisasterRecoveryConfigurationProperties `json:"properties,omitempty"` + // Location - READ-ONLY; Location of the server that contains this disaster recovery configuration. + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DisasterRecoveryConfiguration. +func (drc DisasterRecoveryConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drc.DisasterRecoveryConfigurationProperties != nil { + objectMap["properties"] = drc.DisasterRecoveryConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DisasterRecoveryConfiguration struct. +func (drc *DisasterRecoveryConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var disasterRecoveryConfigurationProperties DisasterRecoveryConfigurationProperties + err = json.Unmarshal(*v, &disasterRecoveryConfigurationProperties) + if err != nil { + return err + } + drc.DisasterRecoveryConfigurationProperties = &disasterRecoveryConfigurationProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + drc.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + drc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + drc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + drc.Type = &typeVar + } + } + } + + return nil +} + +// DisasterRecoveryConfigurationListResult represents the response to a List disaster recovery +// configuration request. +type DisasterRecoveryConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of disaster recovery configurations housed under the server. + Value *[]DisasterRecoveryConfiguration `json:"value,omitempty"` +} + +// DisasterRecoveryConfigurationProperties represents the properties of a disaster recovery configuration. +type DisasterRecoveryConfigurationProperties struct { + // Status - READ-ONLY; The status of the disaster recovery configuration. Possible values include: 'Creating', 'Ready', 'FailingOver', 'Dropping' + Status DisasterRecoveryConfigurationStatus `json:"status,omitempty"` + // AutoFailover - Whether or not failover can be done automatically. Possible values include: 'Off', 'On' + AutoFailover DisasterRecoveryConfigurationAutoFailover `json:"autoFailover,omitempty"` + // FailoverPolicy - How aggressive the automatic failover should be. Possible values include: 'Manual', 'Automatic' + FailoverPolicy DisasterRecoveryConfigurationFailoverPolicy `json:"failoverPolicy,omitempty"` + // PartnerServerID - Id of the partner server. + PartnerServerID *string `json:"partnerServerId,omitempty"` + // LogicalServerName - READ-ONLY; Logical name of the server. + LogicalServerName *string `json:"logicalServerName,omitempty"` + // PartnerLogicalServerName - READ-ONLY; Logical name of the partner server. + PartnerLogicalServerName *string `json:"partnerLogicalServerName,omitempty"` + // Role - READ-ONLY; The role of the current server in the disaster recovery configuration. Possible values include: 'None', 'Primary', 'Secondary' + Role DisasterRecoveryConfigurationRole `json:"role,omitempty"` +} + +// DisasterRecoveryConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DisasterRecoveryConfigurationsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisasterRecoveryConfigurationsCreateOrUpdateFuture) Result(client DisasterRecoveryConfigurationsClient) (drc DisasterRecoveryConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DisasterRecoveryConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if drc.Response.Response, err = future.GetResult(sender); err == nil && drc.Response.Response.StatusCode != http.StatusNoContent { + drc, err = client.CreateOrUpdateResponder(drc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsCreateOrUpdateFuture", "Result", drc.Response.Response, "Failure responding to request") + } + } + return +} + +// DisasterRecoveryConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DisasterRecoveryConfigurationsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisasterRecoveryConfigurationsDeleteFuture) Result(client DisasterRecoveryConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DisasterRecoveryConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DisasterRecoveryConfigurationsFailoverAllowDataLossFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type DisasterRecoveryConfigurationsFailoverAllowDataLossFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisasterRecoveryConfigurationsFailoverAllowDataLossFuture) Result(client DisasterRecoveryConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DisasterRecoveryConfigurationsFailoverAllowDataLossFuture") + return + } + ar.Response = future.Response() + return +} + +// DisasterRecoveryConfigurationsFailoverFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type DisasterRecoveryConfigurationsFailoverFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DisasterRecoveryConfigurationsFailoverFuture) Result(client DisasterRecoveryConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DisasterRecoveryConfigurationsFailoverFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.DisasterRecoveryConfigurationsFailoverFuture") + return + } + ar.Response = future.Response() + return +} + +// EditionCapability the database edition capabilities. +type EditionCapability struct { + // Name - READ-ONLY; The edition name. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the edition. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. + SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// ElasticPool represents a database elastic pool. +type ElasticPool struct { + autorest.Response `json:"-"` + // ElasticPoolProperties - The properties representing the resource. + *ElasticPoolProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPool. +func (ep ElasticPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.ElasticPoolProperties != nil { + objectMap["properties"] = ep.ElasticPoolProperties + } + if ep.Location != nil { + objectMap["location"] = ep.Location + } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. +func (ep *ElasticPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var elasticPoolProperties ElasticPoolProperties + err = json.Unmarshal(*v, &elasticPoolProperties) + if err != nil { + return err + } + ep.ElasticPoolProperties = &elasticPoolProperties + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ep.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ep.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ep.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ep.Type = &typeVar + } + } + } + + return nil +} + +// ElasticPoolActivity represents the activity on an elastic pool. +type ElasticPoolActivity struct { + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ElasticPoolActivityProperties - The properties representing the resource. + *ElasticPoolActivityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolActivity. +func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epa.Location != nil { + objectMap["location"] = epa.Location + } + if epa.ElasticPoolActivityProperties != nil { + objectMap["properties"] = epa.ElasticPoolActivityProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. +func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + epa.Location = &location + } + case "properties": + if v != nil { + var elasticPoolActivityProperties ElasticPoolActivityProperties + err = json.Unmarshal(*v, &elasticPoolActivityProperties) + if err != nil { + return err + } + epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + epa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + epa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epa.Type = &typeVar + } + } + } + + return nil +} + +// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. +type ElasticPoolActivityListResult struct { + autorest.Response `json:"-"` + // Value - The list of elastic pool activities. + Value *[]ElasticPoolActivity `json:"value,omitempty"` +} + +// ElasticPoolActivityProperties represents the properties of an elastic pool. +type ElasticPoolActivityProperties struct { + // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). + EndTime *date.Time `json:"endTime,omitempty"` + // ErrorCode - READ-ONLY; The error code if available. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorMessage - READ-ONLY; The error message if available. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ErrorSeverity - READ-ONLY; The error severity if available. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // Operation - READ-ONLY; The operation name. + Operation *string `json:"operation,omitempty"` + // OperationID - READ-ONLY; The unique operation ID. + OperationID *uuid.UUID `json:"operationId,omitempty"` + // PercentComplete - READ-ONLY; The percentage complete if available. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. + RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` + // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. + RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` + // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. + RequestedDtu *int32 `json:"requestedDtu,omitempty"` + // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. + RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` + // ElasticPoolName - READ-ONLY; The name of the elastic pool. + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // ServerName - READ-ONLY; The name of the server the elastic pool is in. + ServerName *string `json:"serverName,omitempty"` + // StartTime - READ-ONLY; The time the operation started (ISO8601 format). + StartTime *date.Time `json:"startTime,omitempty"` + // State - READ-ONLY; The current state of the operation. + State *string `json:"state,omitempty"` + // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. + RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` + // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. + RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` + // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. + RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` + // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. + RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` +} + +// ElasticPoolDatabaseActivity represents the activity on an elastic pool. +type ElasticPoolDatabaseActivity struct { + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ElasticPoolDatabaseActivityProperties - The properties representing the resource. + *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. +func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epda.Location != nil { + objectMap["location"] = epda.Location + } + if epda.ElasticPoolDatabaseActivityProperties != nil { + objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. +func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + epda.Location = &location + } + case "properties": + if v != nil { + var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties + err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) + if err != nil { + return err + } + epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + epda.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + epda.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epda.Type = &typeVar + } + } + } + + return nil +} + +// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity +// request. +type ElasticPoolDatabaseActivityListResult struct { + autorest.Response `json:"-"` + // Value - 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 { + // DatabaseName - READ-ONLY; The database name. + DatabaseName *string `json:"databaseName,omitempty"` + // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). + EndTime *date.Time `json:"endTime,omitempty"` + // ErrorCode - READ-ONLY; The error code if available. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorMessage - READ-ONLY; The error message if available. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ErrorSeverity - READ-ONLY; The error severity if available. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // Operation - READ-ONLY; The operation name. + Operation *string `json:"operation,omitempty"` + // OperationID - READ-ONLY; The unique operation ID. + OperationID *uuid.UUID `json:"operationId,omitempty"` + // PercentComplete - READ-ONLY; The percentage complete if available. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. + CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` + // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. + CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` + // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. + RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` + // ServerName - READ-ONLY; The name of the server the elastic pool is in. + ServerName *string `json:"serverName,omitempty"` + // StartTime - READ-ONLY; The time the operation started (ISO8601 format). + StartTime *date.Time `json:"startTime,omitempty"` + // State - READ-ONLY; The current state of the operation. + State *string `json:"state,omitempty"` +} + +// ElasticPoolDtuCapability the Elastic Pool DTU capability. +type ElasticPoolDtuCapability struct { + // Limit - READ-ONLY; The maximum size of the database (see 'unit' for the units). + Limit *int64 `json:"limit,omitempty"` + // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. + MaxDatabaseCount *int64 `json:"maxDatabaseCount,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. + SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` + // IncludedMaxSize - READ-ONLY; The included (free) max size for this service level objective. + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` + // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported max database sizes. + SupportedPerDatabaseMaxSizes *[]MaxSizeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` + // SupportedPerDatabaseMaxDtus - READ-ONLY; The list of supported max database DTUs. + SupportedPerDatabaseMaxDtus *[]ElasticPoolPerDatabaseMaxDtuCapability `json:"supportedPerDatabaseMaxDtus,omitempty"` +} + +// ElasticPoolEditionCapability the elastic pool edition capabilities. +type ElasticPoolEditionCapability struct { + // Name - READ-ONLY; The elastic pool edition name. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the elastic pool edition. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedElasticPoolDtus - READ-ONLY; The list of supported elastic pool DTU levels for the edition. + SupportedElasticPoolDtus *[]ElasticPoolDtuCapability `json:"supportedElasticPoolDtus,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// ElasticPoolListResult represents the response to a list elastic pool request. +type ElasticPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of elastic pools hosted in the server. + Value *[]ElasticPool `json:"value,omitempty"` +} + +// ElasticPoolPerDatabaseMaxDtuCapability the max per-database DTU capability. +type ElasticPoolPerDatabaseMaxDtuCapability struct { + // Limit - READ-ONLY; The maximum DTUs per database. + Limit *int64 `json:"limit,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedPerDatabaseMinDtus - READ-ONLY; The list of supported min database DTUs. + SupportedPerDatabaseMinDtus *[]ElasticPoolPerDatabaseMinDtuCapability `json:"supportedPerDatabaseMinDtus,omitempty"` +} + +// ElasticPoolPerDatabaseMinDtuCapability the minimum per-database DTU capability. +type ElasticPoolPerDatabaseMinDtuCapability struct { + // Limit - READ-ONLY; The maximum DTUs per database. + Limit *int64 `json:"limit,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` +} + +// ElasticPoolProperties represents the properties of an elastic pool. +type ElasticPoolProperties struct { + // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). + CreationDate *date.Time `json:"creationDate,omitempty"` + // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' + State ElasticPoolState `json:"state,omitempty"` + // Edition - The edition of the elastic pool. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' + Edition ElasticPoolEdition `json:"edition,omitempty"` + // Dtu - The total shared DTU for the database elastic pool. + Dtu *int32 `json:"dtu,omitempty"` + // DatabaseDtuMax - The maximum DTU any one database can consume. + DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` + // DatabaseDtuMin - The minimum DTU all databases are guaranteed. + DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` + // StorageMB - Gets storage limit for the database elastic pool in MB. + StorageMB *int32 `json:"storageMB,omitempty"` + // ZoneRedundant - Whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ElasticPoolsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ElasticPoolsCreateOrUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.CreateOrUpdateResponder(ep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") + } + } + return +} + +// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ElasticPoolsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ElasticPoolsUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.UpdateResponder(ep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") + } + } + return +} + +// ElasticPoolUpdate represents an elastic pool update. +type ElasticPoolUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ElasticPoolProperties - The properties representing the resource. + *ElasticPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolUpdate. +func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epu.Tags != nil { + objectMap["tags"] = epu.Tags + } + if epu.ElasticPoolProperties != nil { + objectMap["properties"] = epu.ElasticPoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. +func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + epu.Tags = tags + } + case "properties": + if v != nil { + var elasticPoolProperties ElasticPoolProperties + err = json.Unmarshal(*v, &elasticPoolProperties) + if err != nil { + return err + } + epu.ElasticPoolProperties = &elasticPoolProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + epu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + epu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epu.Type = &typeVar + } + } + } + + return nil +} + +// ExportRequest export database parameters. +type ExportRequest struct { + // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - The storage uri to use. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - The name of the SQL administrator. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - The password of the SQL administrator. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// ExtensionListResult represents the response to a list extensions request. +type ExtensionListResult struct { + autorest.Response `json:"-"` + // Value - The list of extensions. + Value *[]interface{} `json:"value,omitempty"` +} + +// FirewallRule represents a server firewall rule. +type FirewallRule struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Kind of server that contains this firewall rule. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Location of the server that contains this firewall rule. + Location *string `json:"location,omitempty"` + // FirewallRuleProperties - The properties representing the resource. + *FirewallRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallRule. +func (fr FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fr.FirewallRuleProperties != nil { + objectMap["properties"] = fr.FirewallRuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. +func (fr *FirewallRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fr.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fr.Location = &location + } + case "properties": + if v != nil { + var firewallRuleProperties FirewallRuleProperties + err = json.Unmarshal(*v, &firewallRuleProperties) + if err != nil { + return err + } + fr.FirewallRuleProperties = &firewallRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fr.Type = &typeVar + } + } + } + + return nil +} + +// FirewallRuleListResult represents the response to a List Firewall Rules request. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + // Value - The list of server firewall rules. + Value *[]FirewallRule `json:"value,omitempty"` +} + +// FirewallRuleProperties represents the properties of a server firewall rule. +type FirewallRuleProperties struct { + // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + StartIPAddress *string `json:"startIpAddress,omitempty"` + // EndIPAddress - 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' to represent all Azure-internal IP addresses. + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// GeoBackupPolicy a database geo backup policy. +type GeoBackupPolicy struct { + autorest.Response `json:"-"` + // GeoBackupPolicyProperties - The properties of the geo backup policy. + *GeoBackupPolicyProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Backup policy location. + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoBackupPolicy. +func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gbp.GeoBackupPolicyProperties != nil { + objectMap["properties"] = gbp.GeoBackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. +func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var geoBackupPolicyProperties GeoBackupPolicyProperties + err = json.Unmarshal(*v, &geoBackupPolicyProperties) + if err != nil { + return err + } + gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + gbp.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gbp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gbp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gbp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gbp.Type = &typeVar + } + } + } + + return nil +} + +// GeoBackupPolicyListResult the response to a list geo backup policies request. +type GeoBackupPolicyListResult struct { + autorest.Response `json:"-"` + // Value - The list of geo backup policies. + Value *[]GeoBackupPolicy `json:"value,omitempty"` +} + +// GeoBackupPolicyProperties the properties of the geo backup policy. +type GeoBackupPolicyProperties struct { + // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' + State GeoBackupPolicyState `json:"state,omitempty"` + // StorageType - READ-ONLY; The storage type of the geo backup policy. + StorageType *string `json:"storageType,omitempty"` +} + +// ImportExportResponse response for Import/Export Get operation. +type ImportExportResponse struct { + autorest.Response `json:"-"` + // ImportExportResponseProperties - The import/export operation properties. + *ImportExportResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImportExportResponse. +func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ier.ImportExportResponseProperties != nil { + objectMap["properties"] = ier.ImportExportResponseProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImportExportResponse struct. +func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var importExportResponseProperties ImportExportResponseProperties + err = json.Unmarshal(*v, &importExportResponseProperties) + if err != nil { + return err + } + ier.ImportExportResponseProperties = &importExportResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ier.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ier.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ier.Type = &typeVar + } + } + } + + return nil +} + +// ImportExportResponseProperties response for Import/Export Status operation. +type ImportExportResponseProperties struct { + // RequestType - READ-ONLY; The request type of the operation. + RequestType *string `json:"requestType,omitempty"` + // RequestID - READ-ONLY; The request type of the operation. + RequestID *uuid.UUID `json:"requestId,omitempty"` + // ServerName - READ-ONLY; The name of the server. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - READ-ONLY; The name of the database. + DatabaseName *string `json:"databaseName,omitempty"` + // Status - READ-ONLY; The status message returned from the server. + Status *string `json:"status,omitempty"` + // LastModifiedTime - READ-ONLY; The operation status last modified time. + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + // QueuedTime - READ-ONLY; The operation queued time. + QueuedTime *string `json:"queuedTime,omitempty"` + // BlobURI - READ-ONLY; The blob uri. + BlobURI *string `json:"blobUri,omitempty"` + // ErrorMessage - READ-ONLY; The error message returned from the server. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// ImportExtensionProperties represents the properties for an import operation +type ImportExtensionProperties struct { + // OperationMode - The type of import operation being performed. This is always Import. + OperationMode *string `json:"operationMode,omitempty"` + // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - The storage uri to use. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - The name of the SQL administrator. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - The password of the SQL administrator. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// ImportExtensionRequest import database parameters. +type ImportExtensionRequest struct { + // Name - The name of the extension. + Name *string `json:"name,omitempty"` + // Type - The type of the extension. + Type *string `json:"type,omitempty"` + // ImportExtensionProperties - Represents the properties of the resource. + *ImportExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImportExtensionRequest. +func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ier.Name != nil { + objectMap["name"] = ier.Name + } + if ier.Type != nil { + objectMap["type"] = ier.Type + } + if ier.ImportExtensionProperties != nil { + objectMap["properties"] = ier.ImportExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImportExtensionRequest struct. +func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ier.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ier.Type = &typeVar + } + case "properties": + if v != nil { + var importExtensionProperties ImportExtensionProperties + err = json.Unmarshal(*v, &importExtensionProperties) + if err != nil { + return err + } + ier.ImportExtensionProperties = &importExtensionProperties + } + } + } + + return nil +} + +// ImportRequest import database parameters. +type ImportRequest struct { + // DatabaseName - The name of the database to import. + DatabaseName *string `json:"databaseName,omitempty"` + // Edition - The edition for the database being created. + // + // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + // + // ```azurecli + // az sql db list-editions -l -o table + // ```` + // + // ```powershell + // Get-AzSqlServerServiceObjective -Location + // ```` + // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' + Edition DatabaseEdition `json:"edition,omitempty"` + // ServiceObjectiveName - The name of the service objective to assign to the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' + ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` + // MaxSizeBytes - The maximum size for the newly imported database. + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - The storage uri to use. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - The name of the SQL administrator. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - The password of the SQL administrator. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// LocationCapabilities the capabilities for a location. +type LocationCapabilities struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; The location name. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Azure SQL Database's status for the location. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedServerVersions - READ-ONLY; The list of supported server versions. + SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` +} + +// MaxSizeCapability the maximum size limits for a database. +type MaxSizeCapability struct { + // Limit - READ-ONLY; The maximum size of the database (see 'unit' for the units). + Limit *int64 `json:"limit,omitempty"` + // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' + Unit MaxSizeUnits `json:"unit,omitempty"` + // Status - READ-ONLY; The status of the maximum size capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` +} + +// Metric database metrics. +type Metric struct { + // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). + EndTime *date.Time `json:"endTime,omitempty"` + // TimeGrain - READ-ONLY; The time step to be used to summarize the metric values. + TimeGrain *string `json:"timeGrain,omitempty"` + // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond' + Unit UnitType `json:"unit,omitempty"` + // Name - READ-ONLY; The name information for the metric. + Name *MetricName `json:"name,omitempty"` + // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. + MetricValues *[]MetricValue `json:"metricValues,omitempty"` +} + +// MetricAvailability a metric availability value. +type MetricAvailability struct { + // Retention - READ-ONLY; The length of retention for the database metric. + Retention *string `json:"retention,omitempty"` + // TimeGrain - READ-ONLY; The granularity of the database metric. + TimeGrain *string `json:"timeGrain,omitempty"` +} + +// MetricDefinition a database metric definition. +type MetricDefinition struct { + // Name - READ-ONLY; The name information for the metric. + Name *MetricName `json:"name,omitempty"` + // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeCount', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeTotal' + PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` + // ResourceURI - READ-ONLY; The resource uri of the database. + ResourceURI *string `json:"resourceUri,omitempty"` + // Unit - READ-ONLY; The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' + Unit UnitDefinitionType `json:"unit,omitempty"` + // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. + MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` +} + +// MetricDefinitionListResult the response to a list database metric definitions request. +type MetricDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - The list of metric definitions for the database. + Value *[]MetricDefinition `json:"value,omitempty"` +} + +// MetricListResult the response to a list database metrics request. +type MetricListResult struct { + autorest.Response `json:"-"` + // Value - The list of metrics for the database. + Value *[]Metric `json:"value,omitempty"` +} + +// MetricName a database metric name. +type MetricName struct { + // Value - READ-ONLY; The name of the database metric. + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; The friendly name of the database metric. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MetricValue represents database metrics. +type MetricValue struct { + // Count - READ-ONLY; The number of values for the metric. + Count *float64 `json:"count,omitempty"` + // Average - READ-ONLY; The average value of the metric. + Average *float64 `json:"average,omitempty"` + // Maximum - READ-ONLY; The max value of the metric. + Maximum *float64 `json:"maximum,omitempty"` + // Minimum - READ-ONLY; The min value of the metric. + Minimum *float64 `json:"minimum,omitempty"` + // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). + Timestamp *date.Time `json:"timestamp,omitempty"` + // Total - READ-ONLY; The total value of the metric. + Total *float64 `json:"total,omitempty"` +} + +// Operation SQL REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft SQL Database. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Server, Database, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationImpact the impact of an operation, both in absolute and relative terms. +type OperationImpact struct { + // Name - READ-ONLY; The name of the impact dimension. + Name *string `json:"name,omitempty"` + // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. + Unit *string `json:"unit,omitempty"` + // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. + ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` + // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) + ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` +} + +// OperationListResult result of the request to list SQL operations. It contains a list of operations and a +// URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of SQL operations supported by the SQL resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// PerformanceLevel a possible performance level of a service objective capability. +type PerformanceLevel struct { + // Unit - READ-ONLY; Unit type used to measure service objective performance level. Possible values include: 'DTU' + Unit PerformanceLevelUnit `json:"unit,omitempty"` + // Value - READ-ONLY; Performance level value. + Value *int32 `json:"value,omitempty"` +} + +// ProxyResource ARM proxy resource. +type ProxyResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// QueryInterval a database query. +type QueryInterval struct { + // IntervalStartTime - READ-ONLY; The start time of the measurement interval (ISO8601 format). + IntervalStartTime *date.Time `json:"intervalStartTime,omitempty"` + // ExecutionCount - READ-ONLY; The number of times the query was executed during this interval. + ExecutionCount *float64 `json:"executionCount,omitempty"` + // Metrics - READ-ONLY; The list of query metrics during this interval. + Metrics *[]QueryMetric `json:"metrics,omitempty"` +} + +// QueryMetric a database query. +type QueryMetric struct { + // Name - READ-ONLY; The name of the metric + Name *string `json:"name,omitempty"` + // DisplayName - READ-ONLY; The name of the metric for display in user interface + DisplayName *string `json:"displayName,omitempty"` + // Unit - READ-ONLY; The unit of measurement. Possible values include: 'Percentage', 'KB', 'Microseconds' + Unit QueryMetricUnit `json:"unit,omitempty"` + // Value - READ-ONLY; The measured value + Value *float64 `json:"value,omitempty"` +} + +// QueryStatistic a database query. +type QueryStatistic struct { + // QueryID - READ-ONLY; The id of the query + QueryID *string `json:"queryId,omitempty"` + // Intervals - READ-ONLY; The list of query intervals. + Intervals *[]QueryInterval `json:"intervals,omitempty"` +} + +// QueryStatisticListResult represents the response to a get query request. +type QueryStatisticListResult struct { + autorest.Response `json:"-"` + // Value - The query. + Value *[]QueryStatistic `json:"value,omitempty"` +} + +// QueryText ... +type QueryText struct { + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // QueryText - READ-ONLY; Query text. + QueryText *string `json:"queryText,omitempty"` +} + +// QueryTextListResult represents the response to a get query text request. +type QueryTextListResult struct { + autorest.Response `json:"-"` + // Value - The query text. + Value *[]QueryText `json:"value,omitempty"` +} + +// RecommendedElasticPool represents a recommended elastic pool. +type RecommendedElasticPool struct { + autorest.Response `json:"-"` + // RecommendedElasticPoolProperties - The properties representing the resource. + *RecommendedElasticPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendedElasticPool. +func (rep RecommendedElasticPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rep.RecommendedElasticPoolProperties != nil { + objectMap["properties"] = rep.RecommendedElasticPoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecommendedElasticPool struct. +func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var recommendedElasticPoolProperties RecommendedElasticPoolProperties + err = json.Unmarshal(*v, &recommendedElasticPoolProperties) + if err != nil { + return err + } + rep.RecommendedElasticPoolProperties = &recommendedElasticPoolProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rep.Type = &typeVar + } + } + } + + return nil +} + +// RecommendedElasticPoolListMetricsResult represents the response to a list recommended elastic pool +// metrics request. +type RecommendedElasticPoolListMetricsResult struct { + autorest.Response `json:"-"` + // Value - The list of recommended elastic pools metrics. + Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` +} + +// RecommendedElasticPoolListResult represents the response to a list recommended elastic pool request. +type RecommendedElasticPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of recommended elastic pools hosted in the server. + Value *[]RecommendedElasticPool `json:"value,omitempty"` +} + +// RecommendedElasticPoolMetric represents recommended elastic pool metric. +type RecommendedElasticPoolMetric struct { + // DateTime - The time of metric (ISO8601 format). + DateTime *date.Time `json:"dateTime,omitempty"` + // Dtu - Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ + Dtu *float64 `json:"dtu,omitempty"` + // SizeGB - Gets or sets size in gigabytes. + SizeGB *float64 `json:"sizeGB,omitempty"` +} + +// RecommendedElasticPoolProperties represents the properties of a recommended elastic pool. +type RecommendedElasticPoolProperties struct { + // DatabaseEdition - READ-ONLY; The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' + DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` + // Dtu - The DTU for the recommended elastic pool. + Dtu *float64 `json:"dtu,omitempty"` + // DatabaseDtuMin - The minimum DTU for the database. + DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` + // DatabaseDtuMax - The maximum DTU for the database. + DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` + // StorageMB - Gets storage size in megabytes. + StorageMB *float64 `json:"storageMB,omitempty"` + // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). + ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` + // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). + ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` + // MaxObservedDtu - READ-ONLY; Gets maximum observed DTU. + MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` + // MaxObservedStorageMB - READ-ONLY; Gets maximum observed storage in megabytes. + MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` + // Databases - READ-ONLY; The list of databases in this pool. Expanded property + Databases *[]Database `json:"databases,omitempty"` + // Metrics - READ-ONLY; The list of databases housed in the server. Expanded property + Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` +} + +// RecommendedIndex represents a database recommended index. +type RecommendedIndex struct { + // RecommendedIndexProperties - READ-ONLY; The properties representing the resource. + *RecommendedIndexProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendedIndex. +func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. +func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") - return + return err } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") - return + for k, v := range m { + switch k { + case "properties": + if v != nil { + var recommendedIndexProperties RecommendedIndexProperties + err = json.Unmarshal(*v, &recommendedIndexProperties) + if err != nil { + return err + } + ri.RecommendedIndexProperties = &recommendedIndexProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ri.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ri.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ri.Type = &typeVar + } + } } - ar.Response = future.Response() - return + + return nil } -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.Future +// RecommendedIndexProperties represents the properties of a database recommended index. +type RecommendedIndexProperties struct { + // Action - READ-ONLY; The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' + Action RecommendedIndexAction `json:"action,omitempty"` + // State - READ-ONLY; The current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' + State RecommendedIndexState `json:"state,omitempty"` + // Created - READ-ONLY; The UTC datetime showing when this resource was created (ISO8601 format). + Created *date.Time `json:"created,omitempty"` + // LastModified - READ-ONLY; The UTC datetime of when was this resource last changed (ISO8601 format). + LastModified *date.Time `json:"lastModified,omitempty"` + // IndexType - READ-ONLY; The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTEREDCOLUMNSTORE' + IndexType RecommendedIndexType `json:"indexType,omitempty"` + // Schema - READ-ONLY; The schema where table to build index over resides + Schema *string `json:"schema,omitempty"` + // Table - READ-ONLY; The table on which to build index. + Table *string `json:"table,omitempty"` + // Columns - READ-ONLY; Columns over which to build index + Columns *[]string `json:"columns,omitempty"` + // IncludedColumns - READ-ONLY; The list of column names to be included in the index + IncludedColumns *[]string `json:"includedColumns,omitempty"` + // IndexScript - READ-ONLY; The full build index script + IndexScript *string `json:"indexScript,omitempty"` + // EstimatedImpact - READ-ONLY; The estimated impact of doing recommended index action. + EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` + // ReportedImpact - READ-ONLY; The values reported after index action is complete. + ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return +// RecoverableDatabase a recoverable database +type RecoverableDatabase struct { + autorest.Response `json:"-"` + // RecoverableDatabaseProperties - The properties of a recoverable database + *RecoverableDatabaseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecoverableDatabase. +func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rd.RecoverableDatabaseProperties != nil { + objectMap["properties"] = rd.RecoverableDatabaseProperties } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") - return + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecoverableDatabase struct. +func (rd *RecoverableDatabase) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "properties": + if v != nil { + var recoverableDatabaseProperties RecoverableDatabaseProperties + err = json.Unmarshal(*v, &recoverableDatabaseProperties) + if err != nil { + return err + } + rd.RecoverableDatabaseProperties = &recoverableDatabaseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rd.Type = &typeVar + } } } - return + + return nil } -// DatabaseUpdate represents a database update. -type DatabaseUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // DatabaseProperties - The properties representing the resource. - *DatabaseProperties `json:"properties,omitempty"` +// RecoverableDatabaseListResult the response to a list recoverable databases request +type RecoverableDatabaseListResult struct { + autorest.Response `json:"-"` + // Value - A list of recoverable databases + Value *[]RecoverableDatabase `json:"value,omitempty"` +} + +// RecoverableDatabaseProperties the properties of a recoverable database +type RecoverableDatabaseProperties struct { + // Edition - READ-ONLY; The edition of the database + Edition *string `json:"edition,omitempty"` + // ServiceLevelObjective - READ-ONLY; The service level objective name of the database + ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` + // ElasticPoolName - READ-ONLY; The elastic pool name of the database + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) + LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` +} + +// ReplicationLink represents a database replication link. +type ReplicationLink struct { + autorest.Response `json:"-"` + // Location - READ-ONLY; Location of the server that contains this firewall rule. + Location *string `json:"location,omitempty"` + // ReplicationLinkProperties - The properties representing the resource. + *ReplicationLinkProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1087,20 +4292,17 @@ type DatabaseUpdate struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Tags != nil { - objectMap["tags"] = du.Tags - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties +// MarshalJSON is the custom marshaler for ReplicationLink. +func (rl ReplicationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rl.ReplicationLinkProperties != nil { + objectMap["properties"] = rl.ReplicationLinkProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. +func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1108,23 +4310,23 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - du.Tags = tags + rl.Location = &location } case "properties": if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) + var replicationLinkProperties ReplicationLinkProperties + err = json.Unmarshal(*v, &replicationLinkProperties) if err != nil { return err } - du.DatabaseProperties = &databaseProperties + rl.ReplicationLinkProperties = &replicationLinkProperties } case "id": if v != nil { @@ -1133,7 +4335,7 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - du.ID = &ID + rl.ID = &ID } case "name": if v != nil { @@ -1142,7 +4344,7 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - du.Name = &name + rl.Name = &name } case "type": if v != nil { @@ -1151,7 +4353,7 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - du.Type = &typeVar + rl.Type = &typeVar } } } @@ -1159,17 +4361,100 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { return nil } -// ElasticPool represents a database elastic pool. -type ElasticPool struct { +// ReplicationLinkListResult represents the response to a List database replication link request. +type ReplicationLinkListResult struct { autorest.Response `json:"-"` - // ElasticPoolProperties - The properties representing the resource. - *ElasticPoolProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - Resource location. + // Value - The list of database replication links housed in the database. + Value *[]ReplicationLink `json:"value,omitempty"` +} + +// ReplicationLinkProperties represents the properties of a database replication link. +type ReplicationLinkProperties struct { + // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. + IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` + // ReplicationMode - READ-ONLY; Replication mode of this replication link. + ReplicationMode *string `json:"replicationMode,omitempty"` + // PartnerServer - READ-ONLY; The name of the server hosting the partner database. + PartnerServer *string `json:"partnerServer,omitempty"` + // PartnerDatabase - READ-ONLY; The name of the partner database. + PartnerDatabase *string `json:"partnerDatabase,omitempty"` + // PartnerLocation - READ-ONLY; The Azure Region of the partner database. + PartnerLocation *string `json:"partnerLocation,omitempty"` + // Role - READ-ONLY; The role of the database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' + Role ReplicationRole `json:"role,omitempty"` + // PartnerRole - READ-ONLY; The role of the partner database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' + PartnerRole ReplicationRole `json:"partnerRole,omitempty"` + // StartTime - READ-ONLY; The start time for the replication link. + StartTime *date.Time `json:"startTime,omitempty"` + // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' + ReplicationState ReplicationState `json:"replicationState,omitempty"` +} + +// ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ReplicationLinksFailoverAllowDataLossFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ReplicationLinksFailoverAllowDataLossFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") + return + } + ar.Response = future.Response() + return +} + +// ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ReplicationLinksFailoverFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ReplicationLinksFailoverFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") + return + } + ar.Response = future.Response() + return +} + +// Resource ARM resource. +type Resource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// RestorableDroppedDatabase a restorable dropped database +type RestorableDroppedDatabase struct { + autorest.Response `json:"-"` + // Location - READ-ONLY; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + // RestorableDroppedDatabaseProperties - The properties of a restorable dropped database + *RestorableDroppedDatabaseProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1178,23 +4463,17 @@ type ElasticPool struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPool. -func (ep ElasticPool) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for RestorableDroppedDatabase. +func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ep.ElasticPoolProperties != nil { - objectMap["properties"] = ep.ElasticPoolProperties - } - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags + if rdd.RestorableDroppedDatabaseProperties != nil { + objectMap["properties"] = rdd.RestorableDroppedDatabaseProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. -func (ep *ElasticPool) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for RestorableDroppedDatabase struct. +func (rdd *RestorableDroppedDatabase) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1202,24 +4481,6 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "properties": - if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - ep.ElasticPoolProperties = &elasticPoolProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ep.Kind = &kind - } case "location": if v != nil { var location string @@ -1227,16 +4488,16 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - ep.Location = &location + rdd.Location = &location } - case "tags": + case "properties": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var restorableDroppedDatabaseProperties RestorableDroppedDatabaseProperties + err = json.Unmarshal(*v, &restorableDroppedDatabaseProperties) if err != nil { return err } - ep.Tags = tags + rdd.RestorableDroppedDatabaseProperties = &restorableDroppedDatabaseProperties } case "id": if v != nil { @@ -1245,7 +4506,7 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - ep.ID = &ID + rdd.ID = &ID } case "name": if v != nil { @@ -1254,7 +4515,7 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - ep.Name = &name + rdd.Name = &name } case "type": if v != nil { @@ -1263,7 +4524,7 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - ep.Type = &typeVar + rdd.Type = &typeVar } } } @@ -1271,12 +4532,37 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { return nil } -// ElasticPoolActivity represents the activity on an elastic pool. -type ElasticPoolActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolActivityProperties - The properties representing the resource. - *ElasticPoolActivityProperties `json:"properties,omitempty"` +// RestorableDroppedDatabaseListResult the response to a list restorable dropped databases request +type RestorableDroppedDatabaseListResult struct { + autorest.Response `json:"-"` + // Value - A list of restorable dropped databases + Value *[]RestorableDroppedDatabase `json:"value,omitempty"` +} + +// RestorableDroppedDatabaseProperties the properties of a restorable dropped database +type RestorableDroppedDatabaseProperties struct { + // DatabaseName - READ-ONLY; The name of the database + DatabaseName *string `json:"databaseName,omitempty"` + // Edition - READ-ONLY; The edition of the database + Edition *string `json:"edition,omitempty"` + // MaxSizeBytes - READ-ONLY; The max size in bytes of the database + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + // ServiceLevelObjective - READ-ONLY; The service level objective name of the database + ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` + // ElasticPoolName - READ-ONLY; The elastic pool name of the database + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) + CreationDate *date.Time `json:"creationDate,omitempty"` + // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) + DeletionDate *date.Time `json:"deletionDate,omitempty"` + // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` +} + +// RestorePoint a database restore point. +type RestorePoint struct { + // RestorePointProperties - The properties of the restore point. + *RestorePointProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1285,20 +4571,17 @@ type ElasticPoolActivity struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolActivity. -func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for RestorePoint. +func (rp RestorePoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epa.Location != nil { - objectMap["location"] = epa.Location - } - if epa.ElasticPoolActivityProperties != nil { - objectMap["properties"] = epa.ElasticPoolActivityProperties + if rp.RestorePointProperties != nil { + objectMap["properties"] = rp.RestorePointProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. -func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. +func (rp *RestorePoint) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1306,23 +4589,14 @@ func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - epa.Location = &location - } case "properties": if v != nil { - var elasticPoolActivityProperties ElasticPoolActivityProperties - err = json.Unmarshal(*v, &elasticPoolActivityProperties) + var restorePointProperties RestorePointProperties + err = json.Unmarshal(*v, &restorePointProperties) if err != nil { return err } - epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties + rp.RestorePointProperties = &restorePointProperties } case "id": if v != nil { @@ -1331,7 +4605,7 @@ func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epa.ID = &ID + rp.ID = &ID } case "name": if v != nil { @@ -1340,7 +4614,7 @@ func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epa.Name = &name + rp.Name = &name } case "type": if v != nil { @@ -1349,71 +4623,42 @@ func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epa.Type = &typeVar + rp.Type = &typeVar } } } - return nil -} - -// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. -type ElasticPoolActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool activities. - Value *[]ElasticPoolActivity `json:"value,omitempty"` -} - -// ElasticPoolActivityProperties represents the properties of an elastic pool. -type ElasticPoolActivityProperties struct { - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - // ElasticPoolName - READ-ONLY; The name of the elastic pool. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` - // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` - // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` - // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` - // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` + return nil } -// ElasticPoolDatabaseActivity represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - // Location - The geo-location where the resource lives +// RestorePointListResult the response to a list database restore points request. +type RestorePointListResult struct { + autorest.Response `json:"-"` + // Value - The list of database restore points. + Value *[]RestorePoint `json:"value,omitempty"` +} + +// RestorePointProperties represents the properties of a database restore point. +type RestorePointProperties struct { + // RestorePointType - READ-ONLY; The restore point type of the database restore point. Possible values include: 'DISCRETE', 'CONTINUOUS' + RestorePointType RestorePointType `json:"restorePointType,omitempty"` + // RestorePointCreationDate - READ-ONLY; Restore point creation time (ISO8601 format). Populated when restorePointType = CONTINUOUS. Null otherwise. + RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` + // EarliestRestoreDate - READ-ONLY; Earliest restore time (ISO8601 format). Populated when restorePointType = DISCRETE. Null otherwise. + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` +} + +// Server represents a server. +type Server struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Kind of sql server. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ServerProperties - Represents the properties of the resource. + *ServerProperties `json:"properties,omitempty"` + // Location - Resource location. Location *string `json:"location,omitempty"` - // ElasticPoolDatabaseActivityProperties - The properties representing the resource. - *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1422,20 +4667,23 @@ type ElasticPoolDatabaseActivity struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. -func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Server. +func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epda.Location != nil { - objectMap["location"] = epda.Location + if s.ServerProperties != nil { + objectMap["properties"] = s.ServerProperties } - if epda.ElasticPoolDatabaseActivityProperties != nil { - objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. -func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for Server struct. +func (s *Server) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1443,6 +4691,24 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + s.Kind = &kind + } + case "properties": + if v != nil { + var serverProperties ServerProperties + err = json.Unmarshal(*v, &serverProperties) + if err != nil { + return err + } + s.ServerProperties = &serverProperties + } case "location": if v != nil { var location string @@ -1450,16 +4716,16 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epda.Location = &location + s.Location = &location } - case "properties": + case "tags": if v != nil { - var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties - err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties + s.Tags = tags } case "id": if v != nil { @@ -1468,7 +4734,7 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epda.ID = &ID + s.ID = &ID } case "name": if v != nil { @@ -1477,7 +4743,7 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epda.Name = &name + s.Name = &name } case "type": if v != nil { @@ -1486,7 +4752,7 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { if err != nil { return err } - epda.Type = &typeVar + s.Type = &typeVar } } } @@ -1494,139 +4760,30 @@ func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { return nil } -// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity -// request. -type ElasticPoolDatabaseActivityListResult struct { +// ServerAdministratorListResult the response to a list Active Directory Administrators request. +type ServerAdministratorListResult struct { autorest.Response `json:"-"` - // Value - The list of elastic pool database activities. - Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` + // Value - The list of server Active Directory Administrators for the server. + Value *[]ServerAzureADAdministrator `json:"value,omitempty"` } -// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` - // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` - // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` +// ServerAdministratorProperties the properties of an server Administrator. +type ServerAdministratorProperties struct { + // AdministratorType - The type of administrator. + AdministratorType *string `json:"administratorType,omitempty"` + // Login - The server administrator login value. + Login *string `json:"login,omitempty"` + // Sid - The server administrator Sid (Secure ID). + Sid *uuid.UUID `json:"sid,omitempty"` + // TenantID - The server Active Directory Administrator tenant id. + TenantID *uuid.UUID `json:"tenantId,omitempty"` } -// ElasticPoolListResult represents the response to a list elastic pool request. -type ElasticPoolListResult struct { +// ServerAzureADAdministrator an server Active Directory Administrator. +type ServerAzureADAdministrator struct { autorest.Response `json:"-"` - // Value - The list of elastic pools hosted in the server. - Value *[]ElasticPool `json:"value,omitempty"` -} - -// ElasticPoolProperties represents the properties of an elastic pool. -type ElasticPoolProperties struct { - // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // State - READ-ONLY; The state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled' - State ElasticPoolState `json:"state,omitempty"` - // Edition - The edition of the elastic pool. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' - Edition ElasticPoolEdition `json:"edition,omitempty"` - // Dtu - The total shared DTU for the database elastic pool. - Dtu *int32 `json:"dtu,omitempty"` - // DatabaseDtuMax - The maximum DTU any one database can consume. - DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` - // DatabaseDtuMin - The minimum DTU all databases are guaranteed. - DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` - // StorageMB - Gets storage limit for the database elastic pool in MB. - StorageMB *int32 `json:"storageMB,omitempty"` - // ZoneRedundant - Whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` -} - -// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ElasticPoolsCreateOrUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ElasticPoolsCreateOrUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ElasticPoolsUpdateFuture) Result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.UpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolUpdate represents an elastic pool update. -type ElasticPoolUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ElasticPoolProperties - The properties representing the resource. - *ElasticPoolProperties `json:"properties,omitempty"` + // ServerAdministratorProperties - The properties of the resource. + *ServerAdministratorProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1635,20 +4792,17 @@ type ElasticPoolUpdate struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolUpdate. -func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerAzureADAdministrator. +func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epu.Tags != nil { - objectMap["tags"] = epu.Tags - } - if epu.ElasticPoolProperties != nil { - objectMap["properties"] = epu.ElasticPoolProperties + if saaa.ServerAdministratorProperties != nil { + objectMap["properties"] = saaa.ServerAdministratorProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. -func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. +func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1656,23 +4810,14 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - epu.Tags = tags - } case "properties": if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) + var serverAdministratorProperties ServerAdministratorProperties + err = json.Unmarshal(*v, &serverAdministratorProperties) if err != nil { return err } - epu.ElasticPoolProperties = &elasticPoolProperties + saaa.ServerAdministratorProperties = &serverAdministratorProperties } case "id": if v != nil { @@ -1681,7 +4826,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - epu.ID = &ID + saaa.ID = &ID } case "name": if v != nil { @@ -1690,7 +4835,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - epu.Name = &name + saaa.Name = &name } case "type": if v != nil { @@ -1699,7 +4844,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { if err != nil { return err } - epu.Type = &typeVar + saaa.Type = &typeVar } } } @@ -1707,31 +4852,73 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { return nil } -// ExportRequest export database parameters. -type ExportRequest struct { - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ServerAzureADAdministratorsCreateOrUpdateFuture struct { + azure.Future } -// FirewallRule represents a server firewall rule. -type FirewallRule struct { +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { + saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerAzureADAdministratorsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerAzureADAdministratorsDeleteFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { + saaa, err = client.DeleteResponder(saaa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", saaa.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerCommunicationLink server communication link. +type ServerCommunicationLink struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of server that contains this firewall rule. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. + // ServerCommunicationLinkProperties - The properties of resource. + *ServerCommunicationLinkProperties `json:"properties,omitempty"` + // Location - READ-ONLY; Communication link location. Location *string `json:"location,omitempty"` - // FirewallRuleProperties - The properties representing the resource. - *FirewallRuleProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Communication link kind. This property is used for Azure Portal metadata. + Kind *string `json:"kind,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1740,17 +4927,17 @@ type FirewallRule struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerCommunicationLink. +func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties + if scl.ServerCommunicationLinkProperties != nil { + objectMap["properties"] = scl.ServerCommunicationLinkProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerCommunicationLink struct. +func (scl *ServerCommunicationLink) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1758,14 +4945,14 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "kind": + case "properties": if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) + var serverCommunicationLinkProperties ServerCommunicationLinkProperties + err = json.Unmarshal(*v, &serverCommunicationLinkProperties) if err != nil { return err } - fr.Kind = &kind + scl.ServerCommunicationLinkProperties = &serverCommunicationLinkProperties } case "location": if v != nil { @@ -1774,16 +4961,16 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.Location = &location + scl.Location = &location } - case "properties": + case "kind": if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) + var kind string + err = json.Unmarshal(*v, &kind) if err != nil { return err } - fr.FirewallRuleProperties = &firewallRuleProperties + scl.Kind = &kind } case "id": if v != nil { @@ -1792,7 +4979,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.ID = &ID + scl.ID = &ID } case "name": if v != nil { @@ -1801,7 +4988,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.Name = &name + scl.Name = &name } case "type": if v != nil { @@ -1810,7 +4997,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.Type = &typeVar + scl.Type = &typeVar } } } @@ -1818,26 +5005,59 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { return nil } -// FirewallRuleListResult represents the response to a List Firewall Rules request. -type FirewallRuleListResult struct { +// ServerCommunicationLinkListResult a list of server communication links. +type ServerCommunicationLinkListResult struct { autorest.Response `json:"-"` - // Value - The list of server firewall rules. - Value *[]FirewallRule `json:"value,omitempty"` + // Value - The list of server communication links. + Value *[]ServerCommunicationLink `json:"value,omitempty"` } -// FirewallRuleProperties represents the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - 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' to represent all Azure-internal IP addresses. - EndIPAddress *string `json:"endIpAddress,omitempty"` +// ServerCommunicationLinkProperties the properties of a server communication link. +type ServerCommunicationLinkProperties struct { + // State - READ-ONLY; The state. + State *string `json:"state,omitempty"` + // PartnerServer - The name of the partner server. + PartnerServer *string `json:"partnerServer,omitempty"` } -// ImportExportResponse response for Import/Export Get operation. -type ImportExportResponse struct { +// ServerCommunicationLinksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServerCommunicationLinksCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerCommunicationLinksCreateOrUpdateFuture) Result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if scl.Response.Response, err = future.GetResult(sender); err == nil && scl.Response.Response.StatusCode != http.StatusNoContent { + scl, err = client.CreateOrUpdateResponder(scl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", scl.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerConnectionPolicy a server secure connection policy. +type ServerConnectionPolicy struct { autorest.Response `json:"-"` - // ImportExportResponseProperties - The import/export operation properties. - *ImportExportResponseProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // ServerConnectionPolicyProperties - The properties of the server secure connection policy. + *ServerConnectionPolicyProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -1846,17 +5066,17 @@ type ImportExportResponse struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ImportExportResponse. -func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerConnectionPolicy. +func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ier.ImportExportResponseProperties != nil { - objectMap["properties"] = ier.ImportExportResponseProperties + if scp.ServerConnectionPolicyProperties != nil { + objectMap["properties"] = scp.ServerConnectionPolicyProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ImportExportResponse struct. -func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerConnectionPolicy struct. +func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1864,14 +5084,32 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + scp.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + scp.Location = &location + } case "properties": if v != nil { - var importExportResponseProperties ImportExportResponseProperties - err = json.Unmarshal(*v, &importExportResponseProperties) + var serverConnectionPolicyProperties ServerConnectionPolicyProperties + err = json.Unmarshal(*v, &serverConnectionPolicyProperties) if err != nil { return err } - ier.ImportExportResponseProperties = &importExportResponseProperties + scp.ServerConnectionPolicyProperties = &serverConnectionPolicyProperties } case "id": if v != nil { @@ -1880,7 +5118,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.ID = &ID + scp.ID = &ID } case "name": if v != nil { @@ -1889,7 +5127,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.Name = &name + scp.Name = &name } case "type": if v != nil { @@ -1898,7 +5136,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.Type = &typeVar + scp.Type = &typeVar } } } @@ -1906,73 +5144,65 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { return nil } -// ImportExportResponseProperties response for Import/Export Status operation. -type ImportExportResponseProperties struct { - // RequestType - READ-ONLY; The request type of the operation. - RequestType *string `json:"requestType,omitempty"` - // RequestID - READ-ONLY; The request type of the operation. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; The name of the database. - DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; The status message returned from the server. - Status *string `json:"status,omitempty"` - // LastModifiedTime - READ-ONLY; The operation status last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - // QueuedTime - READ-ONLY; The operation queued time. - QueuedTime *string `json:"queuedTime,omitempty"` - // BlobURI - READ-ONLY; The blob uri. - BlobURI *string `json:"blobUri,omitempty"` - // ErrorMessage - READ-ONLY; The error message returned from the server. - ErrorMessage *string `json:"errorMessage,omitempty"` +// ServerConnectionPolicyProperties the properties of a server secure connection policy. +type ServerConnectionPolicyProperties struct { + // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' + ConnectionType ServerConnectionType `json:"connectionType,omitempty"` } -// ImportExtensionProperties represents the properties for an import operation -type ImportExtensionProperties struct { - // OperationMode - The type of import operation being performed. This is always Import. - OperationMode *string `json:"operationMode,omitempty"` - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. +// ServerListResult represents the response to a get server request. +type ServerListResult struct { + autorest.Response `json:"-"` + // Value - The list of servers. + Value *[]Server `json:"value,omitempty"` +} + +// ServerProperties represents the properties of a server. +type ServerProperties struct { + // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the server. + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + // Version - The version of the server. Possible values include: 'TwoFullStopZero', 'OneTwoFullStopZero' + Version ServerVersion `json:"version,omitempty"` + // AdministratorLogin - Administrator username for the server. Can only be specified when the server is being created (and is required for creation). AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. + // AdministratorLoginPassword - The administrator login password (required for server creation). AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // ExternalAdministratorSid - READ-ONLY; The ID of the Active Azure Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators. + ExternalAdministratorSid *uuid.UUID `json:"externalAdministratorSid,omitempty"` + // ExternalAdministratorLogin - READ-ONLY; The display name of the Azure Active Directory object with admin permissions on this server. Legacy parameter, always null. To check for Active Directory admin, query .../servers/{serverName}/administrators + ExternalAdministratorLogin *string `json:"externalAdministratorLogin,omitempty"` + // State - READ-ONLY; The state of the server. Possible values include: 'ServerStateReady', 'ServerStateDisabled' + State ServerState `json:"state,omitempty"` } -// ImportExtensionRequest import database parameters. -type ImportExtensionRequest struct { - // Name - The name of the extension. +// ServerTableAuditingPolicy a server table auditing policy. +type ServerTableAuditingPolicy struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Resource kind. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // ServerTableAuditingPolicyProperties - Resource properties. + *ServerTableAuditingPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - The type of the extension. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` - // ImportExtensionProperties - Represents the properties of the resource. - *ImportExtensionProperties `json:"properties,omitempty"` } -// MarshalJSON is the custom marshaler for ImportExtensionRequest. -func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerTableAuditingPolicy. +func (stap ServerTableAuditingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ier.Name != nil { - objectMap["name"] = ier.Name - } - if ier.Type != nil { - objectMap["type"] = ier.Type - } - if ier.ImportExtensionProperties != nil { - objectMap["properties"] = ier.ImportExtensionProperties + if stap.ServerTableAuditingPolicyProperties != nil { + objectMap["properties"] = stap.ServerTableAuditingPolicyProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ImportExtensionRequest struct. -func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerTableAuditingPolicy struct. +func (stap *ServerTableAuditingPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -1980,32 +5210,59 @@ func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "name": + case "kind": if v != nil { - var name string - err = json.Unmarshal(*v, &name) + var kind string + err = json.Unmarshal(*v, &kind) if err != nil { return err } - ier.Name = &name + stap.Kind = &kind } - case "type": + case "location": if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ier.Type = &typeVar + stap.Location = &location } case "properties": if v != nil { - var importExtensionProperties ImportExtensionProperties - err = json.Unmarshal(*v, &importExtensionProperties) + var serverTableAuditingPolicyProperties ServerTableAuditingPolicyProperties + err = json.Unmarshal(*v, &serverTableAuditingPolicyProperties) if err != nil { return err } - ier.ImportExtensionProperties = &importExtensionProperties + stap.ServerTableAuditingPolicyProperties = &serverTableAuditingPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + stap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + stap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + stap.Type = &typeVar } } } @@ -2013,68 +5270,46 @@ func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { return nil } -// ImportRequest import database parameters. -type ImportRequest struct { - // DatabaseName - The name of the database to import. - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - The edition for the database being created. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - Edition DatabaseEdition `json:"edition,omitempty"` - // ServiceObjectiveName - The name of the service objective to assign to the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` - // MaxSizeBytes - The maximum size for the newly imported database. - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` -} - -// OperationImpact the impact of an operation, both in absolute and relative terms. -type OperationImpact struct { - // Name - READ-ONLY; The name of the impact dimension. - Name *string `json:"name,omitempty"` - // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. - Unit *string `json:"unit,omitempty"` - // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` - // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` +// ServerTableAuditingPolicyListResult represents the response to a list server table auditing policies +// request. +type ServerTableAuditingPolicyListResult struct { + autorest.Response `json:"-"` + // Value - The list of server table auditing policies. + Value *[]ServerTableAuditingPolicy `json:"value,omitempty"` } -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// ServerTableAuditingPolicyProperties properties of a server table auditing policy. +type ServerTableAuditingPolicyProperties struct { + // AuditingState - The state of the policy. + AuditingState *string `json:"auditingState,omitempty"` + // AuditLogsTableName - The audit logs table name. + AuditLogsTableName *string `json:"auditLogsTableName,omitempty"` + // EventTypesToAudit - Comma-separated list of event types to audit. + EventTypesToAudit *string `json:"eventTypesToAudit,omitempty"` + // FullAuditLogsTableName - The full audit logs table name. + FullAuditLogsTableName *string `json:"fullAuditLogsTableName,omitempty"` + // RetentionDays - The number of days to keep in the audit logs. + RetentionDays *string `json:"retentionDays,omitempty"` + // StorageAccountKey - The key of the auditing storage account. + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + // StorageAccountName - The table storage account name + StorageAccountName *string `json:"storageAccountName,omitempty"` + // StorageAccountResourceGroupName - The table storage account resource group name + StorageAccountResourceGroupName *string `json:"storageAccountResourceGroupName,omitempty"` + // StorageAccountSecondaryKey - The secondary key of the auditing storage account. + StorageAccountSecondaryKey *string `json:"storageAccountSecondaryKey,omitempty"` + // StorageAccountSubscriptionID - The table storage subscription Id. + StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` + // StorageTableEndpoint - The storage table endpoint. + StorageTableEndpoint *string `json:"storageTableEndpoint,omitempty"` } -// RecommendedElasticPool represents a recommended elastic pool. -type RecommendedElasticPool struct { - autorest.Response `json:"-"` - // RecommendedElasticPoolProperties - The properties representing the resource. - *RecommendedElasticPoolProperties `json:"properties,omitempty"` +// ServerUpdate represents an update to a server. +type ServerUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ServerProperties - Represents the properties of the resource. + *ServerProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -2083,17 +5318,20 @@ type RecommendedElasticPool struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for RecommendedElasticPool. -func (rep RecommendedElasticPool) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerUpdate. +func (su ServerUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rep.RecommendedElasticPoolProperties != nil { - objectMap["properties"] = rep.RecommendedElasticPoolProperties + if su.Tags != nil { + objectMap["tags"] = su.Tags + } + if su.ServerProperties != nil { + objectMap["properties"] = su.ServerProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RecommendedElasticPool struct. -func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerUpdate struct. +func (su *ServerUpdate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2101,14 +5339,23 @@ func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + su.Tags = tags + } case "properties": if v != nil { - var recommendedElasticPoolProperties RecommendedElasticPoolProperties - err = json.Unmarshal(*v, &recommendedElasticPoolProperties) + var serverProperties ServerProperties + err = json.Unmarshal(*v, &serverProperties) if err != nil { return err } - rep.RecommendedElasticPoolProperties = &recommendedElasticPoolProperties + su.ServerProperties = &serverProperties } case "id": if v != nil { @@ -2117,7 +5364,7 @@ func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - rep.ID = &ID + su.ID = &ID } case "name": if v != nil { @@ -2126,7 +5373,7 @@ func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - rep.Name = &name + su.Name = &name } case "type": if v != nil { @@ -2135,7 +5382,7 @@ func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - rep.Type = &typeVar + su.Type = &typeVar } } } @@ -2143,61 +5390,48 @@ func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { return nil } -// RecommendedElasticPoolListMetricsResult represents the response to a list recommended elastic pool -// metrics request. -type RecommendedElasticPoolListMetricsResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools metrics. - Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` +// ServerUsage represents server metrics. +type ServerUsage struct { + // Name - READ-ONLY; Name of the server usage metric. + Name *string `json:"name,omitempty"` + // ResourceName - READ-ONLY; The name of the resource. + ResourceName *string `json:"resourceName,omitempty"` + // DisplayName - READ-ONLY; The metric display name. + DisplayName *string `json:"displayName,omitempty"` + // CurrentValue - READ-ONLY; The current value of the metric. + CurrentValue *float64 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; The current limit of the metric. + Limit *float64 `json:"limit,omitempty"` + // Unit - READ-ONLY; The units of the metric. + Unit *string `json:"unit,omitempty"` + // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). + NextResetTime *date.Time `json:"nextResetTime,omitempty"` } -// RecommendedElasticPoolListResult represents the response to a list recommended elastic pool request. -type RecommendedElasticPoolListResult struct { +// ServerUsageListResult represents the response to a list server metrics request. +type ServerUsageListResult struct { autorest.Response `json:"-"` - // Value - The list of recommended elastic pools hosted in the server. - Value *[]RecommendedElasticPool `json:"value,omitempty"` -} - -// RecommendedElasticPoolMetric represents recommended elastic pool metric. -type RecommendedElasticPoolMetric struct { - // DateTime - The time of metric (ISO8601 format). - DateTime *date.Time `json:"dateTime,omitempty"` - // Dtu - Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - Dtu *float64 `json:"dtu,omitempty"` - // SizeGB - Gets or sets size in gigabytes. - SizeGB *float64 `json:"sizeGB,omitempty"` + // Value - The list of server metrics for the server. + Value *[]ServerUsage `json:"value,omitempty"` } -// RecommendedElasticPoolProperties represents the properties of a recommended elastic pool. -type RecommendedElasticPoolProperties struct { - // DatabaseEdition - READ-ONLY; The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' - DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` - // Dtu - The DTU for the recommended elastic pool. - Dtu *float64 `json:"dtu,omitempty"` - // DatabaseDtuMin - The minimum DTU for the database. - DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` - // DatabaseDtuMax - The maximum DTU for the database. - DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` - // StorageMB - Gets storage size in megabytes. - StorageMB *float64 `json:"storageMB,omitempty"` - // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // MaxObservedDtu - READ-ONLY; Gets maximum observed DTU. - MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` - // MaxObservedStorageMB - READ-ONLY; Gets maximum observed storage in megabytes. - MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` - // Databases - READ-ONLY; The list of databases in this pool. Expanded property - Databases *[]Database `json:"databases,omitempty"` - // Metrics - READ-ONLY; The list of databases housed in the server. Expanded property - Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` +// ServerVersionCapability the server capabilities. +type ServerVersionCapability struct { + // Name - READ-ONLY; The server version name. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the server version. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // SupportedEditions - READ-ONLY; The list of supported database editions. + SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` + // SupportedElasticPoolEditions - READ-ONLY; The list of supported elastic pool editions. + SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` } -// RecommendedIndex represents a database recommended index. -type RecommendedIndex struct { - // RecommendedIndexProperties - READ-ONLY; The properties representing the resource. - *RecommendedIndexProperties `json:"properties,omitempty"` +// ServiceObjective represents a database service objective. +type ServiceObjective struct { + autorest.Response `json:"-"` + // ServiceObjectiveProperties - Represents the properties of the resource. + *ServiceObjectiveProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -2206,14 +5440,17 @@ type RecommendedIndex struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for RecommendedIndex. -func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServiceObjective. +func (so ServiceObjective) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if so.ServiceObjectiveProperties != nil { + objectMap["properties"] = so.ServiceObjectiveProperties + } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. -func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServiceObjective struct. +func (so *ServiceObjective) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2223,12 +5460,12 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var recommendedIndexProperties RecommendedIndexProperties - err = json.Unmarshal(*v, &recommendedIndexProperties) + var serviceObjectiveProperties ServiceObjectiveProperties + err = json.Unmarshal(*v, &serviceObjectiveProperties) if err != nil { return err } - ri.RecommendedIndexProperties = &recommendedIndexProperties + so.ServiceObjectiveProperties = &serviceObjectiveProperties } case "id": if v != nil { @@ -2237,7 +5474,7 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { if err != nil { return err } - ri.ID = &ID + so.ID = &ID } case "name": if v != nil { @@ -2246,7 +5483,7 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { if err != nil { return err } - ri.Name = &name + so.Name = &name } case "type": if v != nil { @@ -2255,7 +5492,7 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { if err != nil { return err } - ri.Type = &typeVar + so.Type = &typeVar } } } @@ -2263,60 +5500,30 @@ func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { return nil } -// RecommendedIndexProperties represents the properties of a database recommended index. -type RecommendedIndexProperties struct { - // Action - READ-ONLY; The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' - Action RecommendedIndexAction `json:"action,omitempty"` - // State - READ-ONLY; The current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' - State RecommendedIndexState `json:"state,omitempty"` - // Created - READ-ONLY; The UTC datetime showing when this resource was created (ISO8601 format). - Created *date.Time `json:"created,omitempty"` - // LastModified - READ-ONLY; The UTC datetime of when was this resource last changed (ISO8601 format). - LastModified *date.Time `json:"lastModified,omitempty"` - // IndexType - READ-ONLY; The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTEREDCOLUMNSTORE' - IndexType RecommendedIndexType `json:"indexType,omitempty"` - // Schema - READ-ONLY; The schema where table to build index over resides - Schema *string `json:"schema,omitempty"` - // Table - READ-ONLY; The table on which to build index. - Table *string `json:"table,omitempty"` - // Columns - READ-ONLY; Columns over which to build index - Columns *[]string `json:"columns,omitempty"` - // IncludedColumns - READ-ONLY; The list of column names to be included in the index - IncludedColumns *[]string `json:"includedColumns,omitempty"` - // IndexScript - READ-ONLY; The full build index script - IndexScript *string `json:"indexScript,omitempty"` - // EstimatedImpact - READ-ONLY; The estimated impact of doing recommended index action. - EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` - // ReportedImpact - READ-ONLY; The values reported after index action is complete. - ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` -} - -// ReplicationLink represents a database replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. - Location *string `json:"location,omitempty"` - // ReplicationLinkProperties - The properties representing the resource. - *ReplicationLinkProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. +// ServiceObjectiveCapability the service objectives capability. +type ServiceObjectiveCapability struct { + // Name - READ-ONLY; The service objective name. Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` + // Status - READ-ONLY; The status of the service objective. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // PerformanceLevel - READ-ONLY; The performance level of the service objective capability. + *PerformanceLevel `json:"performanceLevel,omitempty"` + // ID - READ-ONLY; The unique ID of the service objective. + ID *uuid.UUID `json:"id,omitempty"` + // SupportedMaxSizes - READ-ONLY; The list of supported maximum database sizes for this service objective. + SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` + // IncludedMaxSize - READ-ONLY; The included (free) max size for this service level objective. + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` } -// MarshalJSON is the custom marshaler for ReplicationLink. -func (rl ReplicationLink) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServiceObjectiveCapability. +func (soc ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rl.ReplicationLinkProperties != nil { - objectMap["properties"] = rl.ReplicationLinkProperties - } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. -func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServiceObjectiveCapability struct. +func (soc *ServiceObjectiveCapability) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2324,50 +5531,59 @@ func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "location": + case "name": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var name string + err = json.Unmarshal(*v, &name) if err != nil { return err } - rl.Location = &location + soc.Name = &name } - case "properties": + case "status": if v != nil { - var replicationLinkProperties ReplicationLinkProperties - err = json.Unmarshal(*v, &replicationLinkProperties) + var status CapabilityStatus + err = json.Unmarshal(*v, &status) if err != nil { return err } - rl.ReplicationLinkProperties = &replicationLinkProperties + soc.Status = status + } + case "performanceLevel": + if v != nil { + var performanceLevel PerformanceLevel + err = json.Unmarshal(*v, &performanceLevel) + if err != nil { + return err + } + soc.PerformanceLevel = &performanceLevel } case "id": if v != nil { - var ID string + var ID uuid.UUID err = json.Unmarshal(*v, &ID) if err != nil { return err } - rl.ID = &ID + soc.ID = &ID } - case "name": + case "supportedMaxSizes": if v != nil { - var name string - err = json.Unmarshal(*v, &name) + var supportedMaxSizes []MaxSizeCapability + err = json.Unmarshal(*v, &supportedMaxSizes) if err != nil { return err } - rl.Name = &name + soc.SupportedMaxSizes = &supportedMaxSizes } - case "type": + case "includedMaxSize": if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) + var includedMaxSize MaxSizeCapability + err = json.Unmarshal(*v, &includedMaxSize) if err != nil { return err } - rl.Type = &typeVar + soc.IncludedMaxSize = &includedMaxSize } } } @@ -2375,91 +5591,25 @@ func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { return nil } -// ReplicationLinkListResult represents the response to a List database replication link request. -type ReplicationLinkListResult struct { +// ServiceObjectiveListResult represents the response to a get database service objectives request. +type ServiceObjectiveListResult struct { autorest.Response `json:"-"` - // Value - The list of database replication links housed in the database. - Value *[]ReplicationLink `json:"value,omitempty"` -} - -// ReplicationLinkProperties represents the properties of a database replication link. -type ReplicationLinkProperties struct { - // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - // ReplicationMode - READ-ONLY; Replication mode of this replication link. - ReplicationMode *string `json:"replicationMode,omitempty"` - // PartnerServer - READ-ONLY; The name of the server hosting the partner database. - PartnerServer *string `json:"partnerServer,omitempty"` - // PartnerDatabase - READ-ONLY; The name of the partner database. - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - // PartnerLocation - READ-ONLY; The Azure Region of the partner database. - PartnerLocation *string `json:"partnerLocation,omitempty"` - // Role - READ-ONLY; The role of the database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - Role ReplicationRole `json:"role,omitempty"` - // PartnerRole - READ-ONLY; The role of the partner database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - // StartTime - READ-ONLY; The start time for the replication link. - StartTime *date.Time `json:"startTime,omitempty"` - // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' - ReplicationState ReplicationState `json:"replicationState,omitempty"` + // Value - The list of database service objectives. + Value *[]ServiceObjective `json:"value,omitempty"` } -// ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ReplicationLinksFailoverAllowDataLossFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ReplicationLinksFailoverAllowDataLossFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ReplicationLinksFailoverFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ReplicationLinksFailoverFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// Resource ARM resource. -type Resource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// ServiceObjectiveProperties represents the properties of a database service objective. +type ServiceObjectiveProperties struct { + // ServiceObjectiveName - READ-ONLY; The name for the service objective. + ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` + // IsDefault - READ-ONLY; Gets whether the service level objective is the default service objective. + IsDefault *bool `json:"isDefault,omitempty"` + // IsSystem - READ-ONLY; Gets whether the service level objective is a system service objective. + IsSystem *bool `json:"isSystem,omitempty"` + // Description - READ-ONLY; The description for the service level objective. + Description *string `json:"description,omitempty"` + // Enabled - READ-ONLY; Gets whether the service level objective is enabled. + Enabled *bool `json:"enabled,omitempty"` } // ServiceTierAdvisor represents a Service Tier Advisor. @@ -2591,6 +5741,59 @@ type SloUsageMetric struct { InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` } +// TableAuditingPolicyProperties properties of a table auditing policy. +type TableAuditingPolicyProperties struct { + // AuditingState - The state of the policy. + AuditingState *string `json:"auditingState,omitempty"` + // AuditLogsTableName - The audit logs table name. + AuditLogsTableName *string `json:"auditLogsTableName,omitempty"` + // EventTypesToAudit - Comma-separated list of event types to audit. + EventTypesToAudit *string `json:"eventTypesToAudit,omitempty"` + // FullAuditLogsTableName - The full audit logs table name. + FullAuditLogsTableName *string `json:"fullAuditLogsTableName,omitempty"` + // RetentionDays - The number of days to keep in the audit logs. + RetentionDays *string `json:"retentionDays,omitempty"` + // StorageAccountKey - The key of the auditing storage account. + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + // StorageAccountName - The table storage account name + StorageAccountName *string `json:"storageAccountName,omitempty"` + // StorageAccountResourceGroupName - The table storage account resource group name + StorageAccountResourceGroupName *string `json:"storageAccountResourceGroupName,omitempty"` + // StorageAccountSecondaryKey - The secondary key of the auditing storage account. + StorageAccountSecondaryKey *string `json:"storageAccountSecondaryKey,omitempty"` + // StorageAccountSubscriptionID - The table storage subscription Id. + StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` + // StorageTableEndpoint - The storage table endpoint. + StorageTableEndpoint *string `json:"storageTableEndpoint,omitempty"` +} + +// TopQueries a database query. +type TopQueries struct { + // AggregationFunction - READ-ONLY; The function that is used to aggregate each query's metrics. Possible values include: 'Min', 'Max', 'Avg', 'Sum' + AggregationFunction QueryAggregationFunction `json:"aggregationFunction,omitempty"` + // ExecutionType - READ-ONLY; The execution type that is used to filter the query instances that are returned. Possible values include: 'Any', 'Regular', 'Irregular', 'Aborted', 'Exception' + ExecutionType QueryExecutionType `json:"executionType,omitempty"` + // IntervalType - READ-ONLY; The duration of the interval (ISO8601 duration format). + IntervalType *string `json:"intervalType,omitempty"` + // NumberOfTopQueries - READ-ONLY; The number of requested queries. + NumberOfTopQueries *float64 `json:"numberOfTopQueries,omitempty"` + // ObservationStartTime - READ-ONLY; The start time for queries that are returned (ISO8601 format) + ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` + // ObservationEndTime - READ-ONLY; The end time for queries that are returned (ISO8601 format) + ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` + // ObservedMetric - READ-ONLY; The type of metric to use for ordering the top metrics. Possible values include: 'CPU', 'Io', 'Logio', 'Duration', 'ExecutionCount' + ObservedMetric QueryObservedMetricType `json:"observedMetric,omitempty"` + // Queries - READ-ONLY; The list of queries. + Queries *[]QueryStatistic `json:"queries,omitempty"` +} + +// TopQueriesListResult represents the response to a get top queries request. +type TopQueriesListResult struct { + autorest.Response `json:"-"` + // Value - The list of top queries. + Value *[]TopQueries `json:"value,omitempty"` +} + // TrackedResource ARM tracked top level resource. type TrackedResource struct { // Location - Resource location. @@ -2801,6 +6004,14 @@ type TransparentDataEncryptionActivityProperties struct { PercentComplete *float64 `json:"percentComplete,omitempty"` } +// TransparentDataEncryptionListResult represents the response to a list transparent data encryption +// configurations request. +type TransparentDataEncryptionListResult struct { + autorest.Response `json:"-"` + // Value - The list of transparent data encryption configurations. + Value *[]TransparentDataEncryption `json:"value,omitempty"` +} + // TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. type TransparentDataEncryptionProperties struct { // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' diff --git a/services/sql/mgmt/2014-04-01/sql/operations.go b/services/sql/mgmt/2014-04-01/sql/operations.go new file mode 100644 index 000000000000..18a4cb800c85 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/operations.go @@ -0,0 +1,111 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact +// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and +// delete databases. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available SQL Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Sql/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/queries.go b/services/sql/mgmt/2014-04-01/sql/queries.go new file mode 100644 index 000000000000..c783532b4683 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/queries.go @@ -0,0 +1,123 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QueriesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with +// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete +// databases. +type QueriesClient struct { + BaseClient +} + +// NewQueriesClient creates an instance of the QueriesClient client. +func NewQueriesClient(subscriptionID string) QueriesClient { + return NewQueriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueriesClientWithBaseURI creates an instance of the QueriesClient client. +func NewQueriesClientWithBaseURI(baseURI string, subscriptionID string) QueriesClient { + return QueriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByDatabase gets a list of top queries by database. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client QueriesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TopQueriesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueriesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueriesClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.QueriesClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueriesClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client QueriesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client QueriesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client QueriesClient) ListByDatabaseResponder(resp *http.Response) (result TopQueriesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/querystatistics.go b/services/sql/mgmt/2014-04-01/sql/querystatistics.go new file mode 100644 index 000000000000..4b948db0a3a2 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/querystatistics.go @@ -0,0 +1,125 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QueryStatisticsClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type QueryStatisticsClient struct { + BaseClient +} + +// NewQueryStatisticsClient creates an instance of the QueryStatisticsClient client. +func NewQueryStatisticsClient(subscriptionID string) QueryStatisticsClient { + return NewQueryStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueryStatisticsClientWithBaseURI creates an instance of the QueryStatisticsClient client. +func NewQueryStatisticsClientWithBaseURI(baseURI string, subscriptionID string) QueryStatisticsClient { + return QueryStatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByQuery lists a query's statistics. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// queryID - the id of the query +func (client QueryStatisticsClient) ListByQuery(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (result QueryStatisticListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueryStatisticsClient.ListByQuery") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByQueryPreparer(ctx, resourceGroupName, serverName, databaseName, queryID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueryStatisticsClient", "ListByQuery", nil, "Failure preparing request") + return + } + + resp, err := client.ListByQuerySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.QueryStatisticsClient", "ListByQuery", resp, "Failure sending request") + return + } + + result, err = client.ListByQueryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueryStatisticsClient", "ListByQuery", resp, "Failure responding to request") + } + + return +} + +// ListByQueryPreparer prepares the ListByQuery request. +func (client QueryStatisticsClient) ListByQueryPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "queryId": autorest.Encode("path", queryID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/statistics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByQuerySender sends the ListByQuery request. The method will close the +// http.Response Body if it receives an error. +func (client QueryStatisticsClient) ListByQuerySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByQueryResponder handles the response to the ListByQuery request. The method always +// closes the http.Response Body. +func (client QueryStatisticsClient) ListByQueryResponder(resp *http.Response) (result QueryStatisticListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/querytexts.go b/services/sql/mgmt/2014-04-01/sql/querytexts.go new file mode 100644 index 000000000000..133a7a07db30 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/querytexts.go @@ -0,0 +1,125 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QueryTextsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact +// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and +// delete databases. +type QueryTextsClient struct { + BaseClient +} + +// NewQueryTextsClient creates an instance of the QueryTextsClient client. +func NewQueryTextsClient(subscriptionID string) QueryTextsClient { + return NewQueryTextsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueryTextsClientWithBaseURI creates an instance of the QueryTextsClient client. +func NewQueryTextsClientWithBaseURI(baseURI string, subscriptionID string) QueryTextsClient { + return QueryTextsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByQuery gets a query's text. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// queryID - the id of the query +func (client QueryTextsClient) ListByQuery(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (result QueryTextListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.ListByQuery") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByQueryPreparer(ctx, resourceGroupName, serverName, databaseName, queryID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueryTextsClient", "ListByQuery", nil, "Failure preparing request") + return + } + + resp, err := client.ListByQuerySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.QueryTextsClient", "ListByQuery", resp, "Failure sending request") + return + } + + result, err = client.ListByQueryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.QueryTextsClient", "ListByQuery", resp, "Failure responding to request") + } + + return +} + +// ListByQueryPreparer prepares the ListByQuery request. +func (client QueryTextsClient) ListByQueryPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "queryId": autorest.Encode("path", queryID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/topQueries/{queryId}/queryText", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByQuerySender sends the ListByQuery request. The method will close the +// http.Response Body if it receives an error. +func (client QueryTextsClient) ListByQuerySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByQueryResponder handles the response to the ListByQuery request. The method always +// closes the http.Response Body. +func (client QueryTextsClient) ListByQueryResponder(resp *http.Response) (result QueryTextListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/recoverabledatabases.go b/services/sql/mgmt/2014-04-01/sql/recoverabledatabases.go new file mode 100644 index 000000000000..bfa9b2425b97 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/recoverabledatabases.go @@ -0,0 +1,201 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RecoverableDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type RecoverableDatabasesClient struct { + BaseClient +} + +// NewRecoverableDatabasesClient creates an instance of the RecoverableDatabasesClient client. +func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { + return NewRecoverableDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecoverableDatabasesClientWithBaseURI creates an instance of the RecoverableDatabasesClient client. +func NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { + return RecoverableDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a recoverable database, which is a resource representing a database's geo backup +// Parameters: +// resourceGroupName - the name of the resource group 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 +func (client RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RecoverableDatabase, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecoverableDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RecoverableDatabasesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecoverableDatabasesClient) GetResponder(resp *http.Response) (result RecoverableDatabase, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of recoverable databases +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client RecoverableDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client RecoverableDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client RecoverableDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client RecoverableDatabasesClient) ListByServerResponder(resp *http.Response) (result RecoverableDatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/restorabledroppeddatabases.go b/services/sql/mgmt/2014-04-01/sql/restorabledroppeddatabases.go new file mode 100644 index 000000000000..ee9433fcd23a --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/restorabledroppeddatabases.go @@ -0,0 +1,202 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RestorableDroppedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type RestorableDroppedDatabasesClient struct { + BaseClient +} + +// NewRestorableDroppedDatabasesClient creates an instance of the RestorableDroppedDatabasesClient client. +func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { + return NewRestorableDroppedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRestorableDroppedDatabasesClientWithBaseURI creates an instance of the RestorableDroppedDatabasesClient client. +func NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { + return RestorableDroppedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a deleted database that can be restored +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// restorableDroppededDatabaseID - the id of the deleted database in the form of +// databaseName,deletionTimeInFileTimeFormat +func (client RestorableDroppedDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result RestorableDroppedDatabase, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, restorableDroppededDatabaseID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "restorableDroppededDatabaseId": autorest.Encode("path", restorableDroppededDatabaseID), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RestorableDroppedDatabasesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RestorableDroppedDatabasesClient) GetResponder(resp *http.Response) (result RestorableDroppedDatabase, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of deleted databases that can be restored +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client RestorableDroppedDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RestorableDroppedDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client RestorableDroppedDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client RestorableDroppedDatabasesClient) ListByServerResponder(resp *http.Response) (result RestorableDroppedDatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/restorepoints.go b/services/sql/mgmt/2014-04-01/sql/restorepoints.go new file mode 100644 index 000000000000..a261a52b7584 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/restorepoints.go @@ -0,0 +1,123 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RestorePointsClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type RestorePointsClient struct { + BaseClient +} + +// NewRestorePointsClient creates an instance of the RestorePointsClient client. +func NewRestorePointsClient(subscriptionID string) RestorePointsClient { + return NewRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRestorePointsClientWithBaseURI creates an instance of the RestorePointsClient client. +func NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { + return RestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByDatabase gets a list of database restore points. +// Parameters: +// resourceGroupName - the name of the resource group 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 to get available restore points. +func (client RestorePointsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client RestorePointsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client RestorePointsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client RestorePointsClient) ListByDatabaseResponder(resp *http.Response) (result RestorePointListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/serveradvisors.go b/services/sql/mgmt/2014-04-01/sql/serveradvisors.go new file mode 100644 index 000000000000..9893c9d4ac6c --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/serveradvisors.go @@ -0,0 +1,371 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerAdvisorsClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ServerAdvisorsClient struct { + BaseClient +} + +// NewServerAdvisorsClient creates an instance of the ServerAdvisorsClient client. +func NewServerAdvisorsClient(subscriptionID string) ServerAdvisorsClient { + return NewServerAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerAdvisorsClientWithBaseURI creates an instance of the ServerAdvisorsClient client. +func NewServerAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdvisorsClient { + return ServerAdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a server advisor. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// parameters - the requested advisor resource state. +func (client ServerAdvisorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters Advisor) (result Advisor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdvisorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, advisorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerAdvisorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters Advisor) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "advisorName": autorest.Encode("path", advisorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAdvisorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerAdvisorsClient) CreateOrUpdateResponder(resp *http.Response) (result Advisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a server advisor. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ServerAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (result Advisor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdvisorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, advisorName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerAdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "advisorName": autorest.Encode("path", advisorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAdvisorsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerAdvisorsClient) GetResponder(resp *http.Response) (result Advisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of server advisors. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerAdvisorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result AdvisorListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdvisorsClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerAdvisorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAdvisorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerAdvisorsClient) ListByServerResponder(resp *http.Response) (result AdvisorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a server advisor. +// Parameters: +// resourceGroupName - the name of the resource group 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. +// parameters - the requested advisor resource state. +func (client ServerAdvisorsClient) Update(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters Advisor) (result Advisor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdvisorsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, advisorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAdvisorsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServerAdvisorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters Advisor) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "advisorName": autorest.Encode("path", advisorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAdvisorsClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServerAdvisorsClient) UpdateResponder(resp *http.Response) (result Advisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/serverazureadadministrators.go b/services/sql/mgmt/2014-04-01/sql/serverazureadadministrators.go new file mode 100644 index 000000000000..8f68bc664109 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/serverazureadadministrators.go @@ -0,0 +1,374 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerAzureADAdministratorsClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type ServerAzureADAdministratorsClient struct { + BaseClient +} + +// NewServerAzureADAdministratorsClient creates an instance of the ServerAzureADAdministratorsClient client. +func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { + return NewServerAzureADAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerAzureADAdministratorsClientWithBaseURI creates an instance of the ServerAzureADAdministratorsClient client. +func NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { + return ServerAzureADAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new Server Active Directory Administrator or updates an existing server Active Directory +// Administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// properties - the required parameters for creating or updating an Active Directory Administrator. +func (client ServerAzureADAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (result ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.ServerAdministratorProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.ServerAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerAzureADAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", "activeDirectory"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAzureADAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerAzureADAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing server Active Directory Administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerAzureADAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministratorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServerAzureADAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", "activeDirectory"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAzureADAdministratorsClient) DeleteSender(req *http.Request) (future ServerAzureADAdministratorsDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServerAzureADAdministratorsClient) DeleteResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get returns an server Administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerAzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministrator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerAzureADAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", "activeDirectory"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAzureADAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerAzureADAdministratorsClient) GetResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns a list of server Administrators. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerAzureADAdministratorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerAzureADAdministratorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAzureADAdministratorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerAzureADAdministratorsClient) ListByServerResponder(resp *http.Response) (result ServerAdministratorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/servercommunicationlinks.go b/services/sql/mgmt/2014-04-01/sql/servercommunicationlinks.go new file mode 100644 index 000000000000..8c89241fa93f --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/servercommunicationlinks.go @@ -0,0 +1,373 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerCommunicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type ServerCommunicationLinksClient struct { + BaseClient +} + +// NewServerCommunicationLinksClient creates an instance of the ServerCommunicationLinksClient client. +func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { + return NewServerCommunicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerCommunicationLinksClientWithBaseURI creates an instance of the ServerCommunicationLinksClient client. +func NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { + return ServerCommunicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a server communication link. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ServerCommunicationLinksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (result ServerCommunicationLinksCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties.PartnerServer", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.ServerCommunicationLinksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, communicationLinkName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerCommunicationLinksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "communicationLinkName": autorest.Encode("path", communicationLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + parameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerCommunicationLinksClient) CreateOrUpdateSender(req *http.Request) (future ServerCommunicationLinksCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerCommunicationLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ServerCommunicationLink, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a server communication link. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ServerCommunicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, communicationLinkName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServerCommunicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "communicationLinkName": autorest.Encode("path", communicationLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServerCommunicationLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServerCommunicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a server communication link. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ServerCommunicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result ServerCommunicationLink, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, communicationLinkName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerCommunicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "communicationLinkName": autorest.Encode("path", communicationLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerCommunicationLinksClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerCommunicationLinksClient) GetResponder(resp *http.Response) (result ServerCommunicationLink, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of server communication links. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerCommunicationLinksClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerCommunicationLinkListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerCommunicationLinksClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerCommunicationLinksClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerCommunicationLinksClient) ListByServerResponder(resp *http.Response) (result ServerCommunicationLinkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/serverconnectionpolicies.go b/services/sql/mgmt/2014-04-01/sql/serverconnectionpolicies.go new file mode 100644 index 000000000000..281669c15993 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/serverconnectionpolicies.go @@ -0,0 +1,206 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerConnectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type ServerConnectionPoliciesClient struct { + BaseClient +} + +// NewServerConnectionPoliciesClient creates an instance of the ServerConnectionPoliciesClient client. +func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { + return NewServerConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerConnectionPoliciesClientWithBaseURI creates an instance of the ServerConnectionPoliciesClient client. +func NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { + return ServerConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the server's connection policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for updating a secure connection policy. +func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionPolicyName": autorest.Encode("path", "default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the server's secure connection policy. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionPolicyName": autorest.Encode("path", "default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerConnectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerConnectionPoliciesClient) GetResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/servers.go b/services/sql/mgmt/2014-04-01/sql/servers.go index b3f03509242d..46ff8f9126cb 100644 --- a/services/sql/mgmt/2014-04-01/sql/servers.go +++ b/services/sql/mgmt/2014-04-01/sql/servers.go @@ -125,3 +125,469 @@ func (client ServersClient) CheckNameAvailabilityResponder(resp *http.Response) result.Response = autorest.Response{Response: resp} return } + +// CreateOrUpdate creates or updates a new server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for creating or updating a server. +func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result Server, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a SQL server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns a list of servers. +func (client ServersClient) List(ctx context.Context) (result ServerListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns a list of servers in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the required parameters for updating a server. +func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (result Server, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/servertableauditingpolicies.go b/services/sql/mgmt/2014-04-01/sql/servertableauditingpolicies.go new file mode 100644 index 000000000000..230ddf261780 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/servertableauditingpolicies.go @@ -0,0 +1,285 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerTableAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type ServerTableAuditingPoliciesClient struct { + BaseClient +} + +// NewServerTableAuditingPoliciesClient creates an instance of the ServerTableAuditingPoliciesClient client. +func NewServerTableAuditingPoliciesClient(subscriptionID string) ServerTableAuditingPoliciesClient { + return NewServerTableAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerTableAuditingPoliciesClientWithBaseURI creates an instance of the ServerTableAuditingPoliciesClient client. +func NewServerTableAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerTableAuditingPoliciesClient { + return ServerTableAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a server's table auditing policy. Table auditing is deprecated, use blob auditing +// instead. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// parameters - the server table auditing policy. +func (client ServerTableAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerTableAuditingPolicy) (result ServerTableAuditingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTableAuditingPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerTableAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerTableAuditingPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tableAuditingPolicyName": autorest.Encode("path", "default"), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Kind = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies/{tableAuditingPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTableAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerTableAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerTableAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a server's table auditing policy. Table auditing is deprecated, use blob auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerTableAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerTableAuditingPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTableAuditingPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerTableAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tableAuditingPolicyName": autorest.Encode("path", "default"), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies/{tableAuditingPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTableAuditingPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerTableAuditingPoliciesClient) GetResponder(resp *http.Response) (result ServerTableAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer lists a server's table auditing policies. Table auditing is deprecated, use blob auditing instead. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerTableAuditingPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerTableAuditingPolicyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTableAuditingPoliciesClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTableAuditingPoliciesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerTableAuditingPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTableAuditingPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerTableAuditingPoliciesClient) ListByServerResponder(resp *http.Response) (result ServerTableAuditingPolicyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/serverusages.go b/services/sql/mgmt/2014-04-01/sql/serverusages.go new file mode 100644 index 000000000000..65f3fd8d5b43 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/serverusages.go @@ -0,0 +1,121 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact +// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and +// delete databases. +type ServerUsagesClient struct { + BaseClient +} + +// NewServerUsagesClient creates an instance of the ServerUsagesClient client. +func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { + return NewServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerUsagesClientWithBaseURI creates an instance of the ServerUsagesClient client. +func NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { + return ServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByServer returns server usages. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerUsagesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerUsageListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsagesClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerUsagesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerUsagesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerUsagesClient) ListByServerResponder(resp *http.Response) (result ServerUsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/serviceobjectives.go b/services/sql/mgmt/2014-04-01/sql/serviceobjectives.go new file mode 100644 index 000000000000..971180b812c7 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/serviceobjectives.go @@ -0,0 +1,201 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceObjectivesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ServiceObjectivesClient struct { + BaseClient +} + +// NewServiceObjectivesClient creates an instance of the ServiceObjectivesClient client. +func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { + return NewServiceObjectivesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceObjectivesClientWithBaseURI creates an instance of the ServiceObjectivesClient client. +func NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { + return ServiceObjectivesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a database service objective. +// Parameters: +// resourceGroupName - the name of the resource group 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. +func (client ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, serviceObjectiveName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceObjectivesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "serviceObjectiveName": autorest.Encode("path", serviceObjectiveName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceObjectivesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceObjectivesClient) GetResponder(resp *http.Response) (result ServiceObjective, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns database service objectives. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServiceObjectivesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.ListByServer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServiceObjectivesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceObjectivesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServiceObjectivesClient) ListByServerResponder(resp *http.Response) (result ServiceObjectiveListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/sqlapi/interfaces.go b/services/sql/mgmt/2014-04-01/sql/sqlapi/interfaces.go index 29c023154f3e..0e49e81fd8b6 100644 --- a/services/sql/mgmt/2014-04-01/sql/sqlapi/interfaces.go +++ b/services/sql/mgmt/2014-04-01/sql/sqlapi/interfaces.go @@ -23,13 +23,87 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// ServerAdvisorsClientAPI contains the set of methods on the ServerAdvisorsClient type. +type ServerAdvisorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters sql.Advisor) (result sql.Advisor, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (result sql.Advisor, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.AdvisorListResult, err error) + Update(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters sql.Advisor) (result sql.Advisor, err error) +} + +var _ ServerAdvisorsClientAPI = (*sql.ServerAdvisorsClient)(nil) + +// DatabaseAdvisorsClientAPI contains the set of methods on the DatabaseAdvisorsClient type. +type DatabaseAdvisorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, parameters sql.Advisor) (result sql.Advisor, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string) (result sql.Advisor, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.AdvisorListResult, err error) +} + +var _ DatabaseAdvisorsClientAPI = (*sql.DatabaseAdvisorsClient)(nil) + +// BackupLongTermRetentionPoliciesClientAPI contains the set of methods on the BackupLongTermRetentionPoliciesClient type. +type BackupLongTermRetentionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupLongTermRetentionPolicy) (result sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicy, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicyListResult, err error) +} + +var _ BackupLongTermRetentionPoliciesClientAPI = (*sql.BackupLongTermRetentionPoliciesClient)(nil) + +// BackupLongTermRetentionVaultsClientAPI contains the set of methods on the BackupLongTermRetentionVaultsClient type. +type BackupLongTermRetentionVaultsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.BackupLongTermRetentionVault) (result sql.BackupLongTermRetentionVaultsCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.BackupLongTermRetentionVault, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.BackupLongTermRetentionVaultListResult, err error) +} + +var _ BackupLongTermRetentionVaultsClientAPI = (*sql.BackupLongTermRetentionVaultsClient)(nil) + +// RecoverableDatabasesClientAPI contains the set of methods on the RecoverableDatabasesClient type. +type RecoverableDatabasesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RecoverableDatabase, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RecoverableDatabaseListResult, err error) +} + +var _ RecoverableDatabasesClientAPI = (*sql.RecoverableDatabasesClient)(nil) + +// RestorableDroppedDatabasesClientAPI contains the set of methods on the RestorableDroppedDatabasesClient type. +type RestorableDroppedDatabasesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result sql.RestorableDroppedDatabase, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResult, err error) +} + +var _ RestorableDroppedDatabasesClientAPI = (*sql.RestorableDroppedDatabasesClient)(nil) + +// CapabilitiesClientAPI contains the set of methods on the CapabilitiesClient type. +type CapabilitiesClientAPI interface { + ListByLocation(ctx context.Context, locationID string) (result sql.LocationCapabilities, err error) +} + +var _ CapabilitiesClientAPI = (*sql.CapabilitiesClient)(nil) + // ServersClientAPI contains the set of methods on the ServersClient type. type ServersClientAPI interface { CheckNameAvailability(ctx context.Context, parameters sql.CheckNameAvailabilityRequest) (result sql.CheckNameAvailabilityResponse, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.Server) (result sql.Server, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.Server, err error) + List(ctx context.Context) (result sql.ServerListResult, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ServerListResult, err error) + Update(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerUpdate) (result sql.Server, err error) } var _ ServersClientAPI = (*sql.ServersClient)(nil) +// ServerConnectionPoliciesClientAPI contains the set of methods on the ServerConnectionPoliciesClient type. +type ServerConnectionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerConnectionPolicy) (result sql.ServerConnectionPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicy, err error) +} + +var _ ServerConnectionPoliciesClientAPI = (*sql.ServerConnectionPoliciesClient)(nil) + // DatabasesClientAPI contains the set of methods on the DatabasesClient type. type DatabasesClientAPI interface { CreateImportOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExtensionRequest) (result sql.DatabasesCreateImportOperationFuture, err error) @@ -43,6 +117,8 @@ type DatabasesClientAPI interface { ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResult, err error) ListByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result sql.DatabaseListResult, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (result sql.DatabaseListResult, err error) + ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.MetricDefinitionListResult, err error) + ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.MetricListResult, err error) Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesPauseFuture, err error) Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesResumeFuture, err error) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseUpdate) (result sql.DatabasesUpdateFuture, err error) @@ -50,12 +126,65 @@ type DatabasesClientAPI interface { var _ DatabasesClientAPI = (*sql.DatabasesClient)(nil) +// DatabaseThreatDetectionPoliciesClientAPI contains the set of methods on the DatabaseThreatDetectionPoliciesClient type. +type DatabaseThreatDetectionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseSecurityAlertPolicy) (result sql.DatabaseSecurityAlertPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseSecurityAlertPolicy, err error) +} + +var _ DatabaseThreatDetectionPoliciesClientAPI = (*sql.DatabaseThreatDetectionPoliciesClient)(nil) + +// DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. +type DataMaskingPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DataMaskingPolicy) (result sql.DataMaskingPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingPolicy, err error) +} + +var _ DataMaskingPoliciesClientAPI = (*sql.DataMaskingPoliciesClient)(nil) + +// DataMaskingRulesClientAPI contains the set of methods on the DataMaskingRulesClient type. +type DataMaskingRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters sql.DataMaskingRule) (result sql.DataMaskingRule, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingRuleListResult, err error) +} + +var _ DataMaskingRulesClientAPI = (*sql.DataMaskingRulesClient)(nil) + +// TransparentDataEncryptionConfigurationsClientAPI contains the set of methods on the TransparentDataEncryptionConfigurationsClient type. +type TransparentDataEncryptionConfigurationsClientAPI interface { + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryptionListResult, err error) +} + +var _ TransparentDataEncryptionConfigurationsClientAPI = (*sql.TransparentDataEncryptionConfigurationsClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ExtensionListResult, err error) +} + +var _ ExtensionsClientAPI = (*sql.ExtensionsClient)(nil) + +// DisasterRecoveryConfigurationsClientAPI contains the set of methods on the DisasterRecoveryConfigurationsClient type. +type DisasterRecoveryConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result sql.DisasterRecoveryConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result sql.DisasterRecoveryConfigurationsDeleteFuture, err error) + Failover(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result sql.DisasterRecoveryConfigurationsFailoverFuture, err error) + FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result sql.DisasterRecoveryConfigurationsFailoverAllowDataLossFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, disasterRecoveryConfigurationName string) (result sql.DisasterRecoveryConfiguration, err error) + List(ctx context.Context, resourceGroupName string, serverName string) (result sql.DisasterRecoveryConfigurationListResult, err error) +} + +var _ DisasterRecoveryConfigurationsClientAPI = (*sql.DisasterRecoveryConfigurationsClient)(nil) + // ElasticPoolsClientAPI contains the set of methods on the ElasticPoolsClient type. type ElasticPoolsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPool) (result sql.ElasticPoolsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPool, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ElasticPoolListResult, err error) + ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.MetricDefinitionListResult, err error) + ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result sql.MetricListResult, err error) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPoolUpdate) (result sql.ElasticPoolsUpdateFuture, err error) } @@ -71,6 +200,43 @@ type FirewallRulesClientAPI interface { var _ FirewallRulesClientAPI = (*sql.FirewallRulesClient)(nil) +// GeoBackupPoliciesClientAPI contains the set of methods on the GeoBackupPoliciesClient type. +type GeoBackupPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.GeoBackupPolicy) (result sql.GeoBackupPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicy, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicyListResult, err error) +} + +var _ GeoBackupPoliciesClientAPI = (*sql.GeoBackupPoliciesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result sql.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*sql.OperationsClient)(nil) + +// QueriesClientAPI contains the set of methods on the QueriesClient type. +type QueriesClientAPI interface { + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TopQueriesListResult, err error) +} + +var _ QueriesClientAPI = (*sql.QueriesClient)(nil) + +// QueryStatisticsClientAPI contains the set of methods on the QueryStatisticsClient type. +type QueryStatisticsClientAPI interface { + ListByQuery(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (result sql.QueryStatisticListResult, err error) +} + +var _ QueryStatisticsClientAPI = (*sql.QueryStatisticsClient)(nil) + +// QueryTextsClientAPI contains the set of methods on the QueryTextsClient type. +type QueryTextsClientAPI interface { + ListByQuery(ctx context.Context, resourceGroupName string, serverName string, databaseName string, queryID string) (result sql.QueryTextListResult, err error) +} + +var _ QueryTextsClientAPI = (*sql.QueryTextsClient)(nil) + // RecommendedElasticPoolsClientAPI contains the set of methods on the RecommendedElasticPoolsClient type. type RecommendedElasticPoolsClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result sql.RecommendedElasticPool, err error) @@ -91,6 +257,41 @@ type ReplicationLinksClientAPI interface { var _ ReplicationLinksClientAPI = (*sql.ReplicationLinksClient)(nil) +// RestorePointsClientAPI contains the set of methods on the RestorePointsClient type. +type RestorePointsClientAPI interface { + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RestorePointListResult, err error) +} + +var _ RestorePointsClientAPI = (*sql.RestorePointsClient)(nil) + +// ServerAzureADAdministratorsClientAPI contains the set of methods on the ServerAzureADAdministratorsClient type. +type ServerAzureADAdministratorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties sql.ServerAzureADAdministrator) (result sql.ServerAzureADAdministratorsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministratorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministrator, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAdministratorListResult, err error) +} + +var _ ServerAzureADAdministratorsClientAPI = (*sql.ServerAzureADAdministratorsClient)(nil) + +// ServerCommunicationLinksClientAPI contains the set of methods on the ServerCommunicationLinksClient type. +type ServerCommunicationLinksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters sql.ServerCommunicationLink) (result sql.ServerCommunicationLinksCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result sql.ServerCommunicationLink, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerCommunicationLinkListResult, err error) +} + +var _ ServerCommunicationLinksClientAPI = (*sql.ServerCommunicationLinksClient)(nil) + +// ServiceObjectivesClientAPI contains the set of methods on the ServiceObjectivesClient type. +type ServiceObjectivesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result sql.ServiceObjective, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServiceObjectiveListResult, err error) +} + +var _ ServiceObjectivesClientAPI = (*sql.ServiceObjectivesClient)(nil) + // ElasticPoolActivitiesClientAPI contains the set of methods on the ElasticPoolActivitiesClient type. type ElasticPoolActivitiesClientAPI interface { ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolActivityListResult, err error) @@ -128,10 +329,42 @@ type TransparentDataEncryptionActivitiesClientAPI interface { var _ TransparentDataEncryptionActivitiesClientAPI = (*sql.TransparentDataEncryptionActivitiesClient)(nil) -// DatabaseThreatDetectionPoliciesClientAPI contains the set of methods on the DatabaseThreatDetectionPoliciesClient type. -type DatabaseThreatDetectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseSecurityAlertPolicy) (result sql.DatabaseSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseSecurityAlertPolicy, err error) +// ServerTableAuditingPoliciesClientAPI contains the set of methods on the ServerTableAuditingPoliciesClient type. +type ServerTableAuditingPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerTableAuditingPolicy) (result sql.ServerTableAuditingPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerTableAuditingPolicy, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerTableAuditingPolicyListResult, err error) } -var _ DatabaseThreatDetectionPoliciesClientAPI = (*sql.DatabaseThreatDetectionPoliciesClient)(nil) +var _ ServerTableAuditingPoliciesClientAPI = (*sql.ServerTableAuditingPoliciesClient)(nil) + +// DatabaseTableAuditingPoliciesClientAPI contains the set of methods on the DatabaseTableAuditingPoliciesClient type. +type DatabaseTableAuditingPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseTableAuditingPolicy) (result sql.DatabaseTableAuditingPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseTableAuditingPolicy, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseTableAuditingPolicyListResult, err error) +} + +var _ DatabaseTableAuditingPoliciesClientAPI = (*sql.DatabaseTableAuditingPoliciesClient)(nil) + +// DatabaseConnectionPoliciesClientAPI contains the set of methods on the DatabaseConnectionPoliciesClient type. +type DatabaseConnectionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseConnectionPolicy) (result sql.DatabaseConnectionPolicy, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseConnectionPolicy, err error) +} + +var _ DatabaseConnectionPoliciesClientAPI = (*sql.DatabaseConnectionPoliciesClient)(nil) + +// ServerUsagesClientAPI contains the set of methods on the ServerUsagesClient type. +type ServerUsagesClientAPI interface { + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerUsageListResult, err error) +} + +var _ ServerUsagesClientAPI = (*sql.ServerUsagesClient)(nil) + +// DatabaseUsagesClientAPI contains the set of methods on the DatabaseUsagesClient type. +type DatabaseUsagesClientAPI interface { + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseUsageListResult, err error) +} + +var _ DatabaseUsagesClientAPI = (*sql.DatabaseUsagesClient)(nil) diff --git a/services/sql/mgmt/2014-04-01/sql/transparentdataencryptionconfigurations.go b/services/sql/mgmt/2014-04-01/sql/transparentdataencryptionconfigurations.go new file mode 100644 index 000000000000..8bd126bc0d97 --- /dev/null +++ b/services/sql/mgmt/2014-04-01/sql/transparentdataencryptionconfigurations.go @@ -0,0 +1,126 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TransparentDataEncryptionConfigurationsClient is the the Azure SQL Database management API provides a RESTful set of +// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type TransparentDataEncryptionConfigurationsClient struct { + BaseClient +} + +// NewTransparentDataEncryptionConfigurationsClient creates an instance of the +// TransparentDataEncryptionConfigurationsClient client. +func NewTransparentDataEncryptionConfigurationsClient(subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return NewTransparentDataEncryptionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransparentDataEncryptionConfigurationsClientWithBaseURI creates an instance of the +// TransparentDataEncryptionConfigurationsClient client. +func NewTransparentDataEncryptionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionConfigurationsClient { + return TransparentDataEncryptionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByDatabase gets a list of a database's transparent data encryption configurations. There is only ever one +// element, named 'current', so GetTransparentDataEncryptionConfiguration should be used instead. +// Parameters: +// resourceGroupName - the name of the resource group 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 for which the transparent data encryption applies. +func (client TransparentDataEncryptionConfigurationsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionConfigurationsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionConfigurationsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionConfigurationsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionConfigurationsClient", "ListByDatabase", resp, "Failure responding to request") + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client TransparentDataEncryptionConfigurationsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client TransparentDataEncryptionConfigurationsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client TransparentDataEncryptionConfigurationsClient) ListByDatabaseResponder(resp *http.Response) (result TransparentDataEncryptionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}