diff --git a/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go index c607fa5a75a6..513b7b8b8924 100644 --- a/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go +++ b/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go @@ -87,7 +87,7 @@ func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -174,7 +174,7 @@ func (client BackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -256,7 +256,7 @@ func (client BackupShortTermRetentionPoliciesClient) ListByDatabasePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -367,7 +367,7 @@ func (client BackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v3.0/sql/databases.go b/services/preview/sql/mgmt/v3.0/sql/databases.go index 2b3d4780ea68..6dc4d40d5814 100644 --- a/services/preview/sql/mgmt/v3.0/sql/databases.go +++ b/services/preview/sql/mgmt/v3.0/sql/databases.go @@ -44,96 +44,6 @@ func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) Databa return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateImportOperation creates an import operation that imports a bacpac into an existing database. The existing -// database must be empty. -// 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 -// parameters - the required parameters for importing a Bacpac into a database. -func (client DatabasesClient) CreateImportOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (result DatabasesCreateImportOperationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateImportOperation") - 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.ImportExtensionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ImportExtensionProperties.OperationMode", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "CreateImportOperation", err.Error()) - } - - req, err := client.CreateImportOperationPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", nil, "Failure preparing request") - return - } - - result, err = client.CreateImportOperationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateImportOperationPreparer prepares the CreateImportOperation request. -func (client DatabasesClient) CreateImportOperationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (*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.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}/extensions/{extensionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateImportOperationSender sends the CreateImportOperation request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateImportOperationSender(req *http.Request) (future DatabasesCreateImportOperationFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// CreateImportOperationResponder handles the response to the CreateImportOperation request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // CreateOrUpdate creates a new database or updates an existing database. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value @@ -187,7 +97,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -269,7 +179,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -305,14 +215,14 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor return } -// Export exports a database to a bacpac. +// Export exports a 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 to be exported. -// parameters - the required parameters for exporting a database. -func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (result DatabasesExportFuture, err error) { +// databaseName - the name of the database. +// parameters - the database export request parameters. +func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportDatabaseDefinition) (result DatabasesExportFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Export") defer func() { @@ -348,7 +258,7 @@ func (client DatabasesClient) Export(ctx context.Context, resourceGroupName stri } // ExportPreparer prepares the Export request. -func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (*http.Request, error) { +func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportDatabaseDefinition) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -356,7 +266,7 @@ func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -385,7 +295,7 @@ func (client DatabasesClient) ExportSender(req *http.Request) (future DatabasesE // ExportResponder handles the response to the Export request. The method always // closes the http.Response Body. -func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportResponse, err error) { +func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportOperationResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), @@ -437,7 +347,7 @@ func (client DatabasesClient) FailoverPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -523,7 +433,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -554,92 +464,6 @@ func (client DatabasesClient) GetResponder(resp *http.Response) (result Database return } -// Import imports a bacpac into a new 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. -// parameters - the required parameters for importing a Bacpac into a database. -func (client DatabasesClient) Import(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (result DatabasesImportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Import") - 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.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MaxSizeBytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Import", err.Error()) - } - - req, err := client.ImportPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", nil, "Failure preparing request") - return - } - - result, err = client.ImportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportPreparer prepares the Import request. -func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (*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.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportSender sends the Import request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ImportSender(req *http.Request) (future DatabasesImportFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// ImportResponder handles the response to the Import request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ImportResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // ListByElasticPool gets a list of databases in an elastic pool. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value @@ -691,7 +515,7 @@ func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -808,7 +632,7 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -876,6 +700,123 @@ func (client DatabasesClient) ListByServerComplete(ctx context.Context, resource return } +// ListInaccessibleByServer gets a list of inaccessible databases in a logical 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 DatabasesClient) ListInaccessibleByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListInaccessibleByServer") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listInaccessibleByServerNextResults + req, err := client.ListInaccessibleByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListInaccessibleByServerSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListInaccessibleByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", resp, "Failure responding to request") + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListInaccessibleByServerPreparer prepares the ListInaccessibleByServer request. +func (client DatabasesClient) ListInaccessibleByServerPreparer(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 = "2019-06-01-preview" + 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}/inaccessibleDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInaccessibleByServerSender sends the ListInaccessibleByServer request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListInaccessibleByServerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInaccessibleByServerResponder handles the response to the ListInaccessibleByServer request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListInaccessibleByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInaccessibleByServerNextResults retrieves the next set of results, if any. +func (client DatabasesClient) listInaccessibleByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { + req, err := lastResults.databaseListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInaccessibleByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInaccessibleByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInaccessibleByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client DatabasesClient) ListInaccessibleByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListInaccessibleByServer") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInaccessibleByServer(ctx, resourceGroupName, serverName) + return +} + // ListMetricDefinitions returns database metric definitions. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value @@ -1075,7 +1016,7 @@ func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1166,7 +1107,7 @@ func (client DatabasesClient) RenamePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1239,7 +1180,7 @@ func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1318,7 +1259,7 @@ func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1398,7 +1339,7 @@ func (client DatabasesClient) UpgradeDataWarehousePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-10-01-preview" + const APIVersion = "2019-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v3.0/sql/enums.go b/services/preview/sql/mgmt/v3.0/sql/enums.go index b0cb497248c1..d91659308aef 100644 --- a/services/preview/sql/mgmt/v3.0/sql/enums.go +++ b/services/preview/sql/mgmt/v3.0/sql/enums.go @@ -17,21 +17,6 @@ package sql // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// AuthenticationType enumerates the values for authentication type. -type AuthenticationType string - -const ( - // ADPassword ... - ADPassword AuthenticationType = "ADPassword" - // SQL ... - SQL AuthenticationType = "SQL" -) - -// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. -func PossibleAuthenticationTypeValues() []AuthenticationType { - return []AuthenticationType{ADPassword, SQL} -} - // AutomaticTuningDisabledReason enumerates the values for automatic tuning disabled reason. type AutomaticTuningDisabledReason string @@ -258,45 +243,6 @@ func PossibleCreateModeValues() []CreateMode { return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreExternalBackup, CreateModeRestoreExternalBackupSecondary, CreateModeRestoreLongTermRetentionBackup, CreateModeSecondary} } -// DatabaseEdition enumerates the values for database edition. -type DatabaseEdition string - -const ( - // Basic ... - Basic DatabaseEdition = "Basic" - // Business ... - Business DatabaseEdition = "Business" - // BusinessCritical ... - BusinessCritical DatabaseEdition = "BusinessCritical" - // DataWarehouse ... - DataWarehouse DatabaseEdition = "DataWarehouse" - // Free ... - Free DatabaseEdition = "Free" - // GeneralPurpose ... - GeneralPurpose DatabaseEdition = "GeneralPurpose" - // Hyperscale ... - Hyperscale DatabaseEdition = "Hyperscale" - // Premium ... - Premium DatabaseEdition = "Premium" - // PremiumRS ... - PremiumRS DatabaseEdition = "PremiumRS" - // Standard ... - Standard DatabaseEdition = "Standard" - // Stretch ... - Stretch DatabaseEdition = "Stretch" - // System ... - System DatabaseEdition = "System" - // System2 ... - System2 DatabaseEdition = "System2" - // Web ... - Web DatabaseEdition = "Web" -) - -// PossibleDatabaseEditionValues returns an array of possible values for the DatabaseEdition const type. -func PossibleDatabaseEditionValues() []DatabaseEdition { - return []DatabaseEdition{Basic, Business, BusinessCritical, DataWarehouse, Free, GeneralPurpose, Hyperscale, Premium, PremiumRS, Standard, Stretch, System, System2, Web} -} - // DatabaseLicenseType enumerates the values for database license type. type DatabaseLicenseType string @@ -539,21 +485,21 @@ func PossibleDataMaskingStateValues() []DataMaskingState { type ElasticPoolEdition string const ( - // ElasticPoolEditionBasic ... - ElasticPoolEditionBasic ElasticPoolEdition = "Basic" - // ElasticPoolEditionBusinessCritical ... - ElasticPoolEditionBusinessCritical ElasticPoolEdition = "BusinessCritical" - // ElasticPoolEditionGeneralPurpose ... - ElasticPoolEditionGeneralPurpose ElasticPoolEdition = "GeneralPurpose" - // ElasticPoolEditionPremium ... - ElasticPoolEditionPremium ElasticPoolEdition = "Premium" - // ElasticPoolEditionStandard ... - ElasticPoolEditionStandard ElasticPoolEdition = "Standard" + // Basic ... + Basic ElasticPoolEdition = "Basic" + // BusinessCritical ... + BusinessCritical ElasticPoolEdition = "BusinessCritical" + // GeneralPurpose ... + GeneralPurpose ElasticPoolEdition = "GeneralPurpose" + // Premium ... + Premium ElasticPoolEdition = "Premium" + // Standard ... + Standard ElasticPoolEdition = "Standard" ) // PossibleElasticPoolEditionValues returns an array of possible values for the ElasticPoolEdition const type. func PossibleElasticPoolEditionValues() []ElasticPoolEdition { - return []ElasticPoolEdition{ElasticPoolEditionBasic, ElasticPoolEditionBusinessCritical, ElasticPoolEditionGeneralPurpose, ElasticPoolEditionPremium, ElasticPoolEditionStandard} + return []ElasticPoolEdition{Basic, BusinessCritical, GeneralPurpose, Premium, Standard} } // ElasticPoolLicenseType enumerates the values for elastic pool license type. @@ -980,15 +926,15 @@ func PossibleMaxSizeUnitValues() []MaxSizeUnit { type OperationOrigin string const ( - // OperationOriginSystem ... - OperationOriginSystem OperationOrigin = "system" - // OperationOriginUser ... - OperationOriginUser OperationOrigin = "user" + // System ... + System OperationOrigin = "system" + // User ... + User OperationOrigin = "user" ) // PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{OperationOriginSystem, OperationOriginUser} + return []OperationOrigin{System, User} } // PauseDelayTimeUnit enumerates the values for pause delay time unit. @@ -1118,6 +1064,29 @@ func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateFailed, ProvisioningStateInProgress, ProvisioningStateSucceeded} } +// ProvisioningState1 enumerates the values for provisioning state 1. +type ProvisioningState1 string + +const ( + // ProvisioningState1Creating ... + ProvisioningState1Creating ProvisioningState1 = "Creating" + // ProvisioningState1Deleting ... + ProvisioningState1Deleting ProvisioningState1 = "Deleting" + // ProvisioningState1Failed ... + ProvisioningState1Failed ProvisioningState1 = "Failed" + // ProvisioningState1Succeeded ... + ProvisioningState1Succeeded ProvisioningState1 = "Succeeded" + // ProvisioningState1Unknown ... + ProvisioningState1Unknown ProvisioningState1 = "Unknown" + // ProvisioningState1Updating ... + ProvisioningState1Updating ProvisioningState1 = "Updating" +) + +// PossibleProvisioningState1Values returns an array of possible values for the ProvisioningState1 const type. +func PossibleProvisioningState1Values() []ProvisioningState1 { + return []ProvisioningState1{ProvisioningState1Creating, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1Succeeded, ProvisioningState1Unknown, ProvisioningState1Updating} +} + // ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. type ReadOnlyEndpointFailoverPolicy string @@ -1615,6 +1584,23 @@ func PossibleStorageAccountTypeValues() []StorageAccountType { return []StorageAccountType{GRS, LRS, ZRS} } +// StorageAccountType1 enumerates the values for storage account type 1. +type StorageAccountType1 string + +const ( + // StorageAccountType1GRS ... + StorageAccountType1GRS StorageAccountType1 = "GRS" + // StorageAccountType1LRS ... + StorageAccountType1LRS StorageAccountType1 = "LRS" + // StorageAccountType1ZRS ... + StorageAccountType1ZRS StorageAccountType1 = "ZRS" +) + +// PossibleStorageAccountType1Values returns an array of possible values for the StorageAccountType1 const type. +func PossibleStorageAccountType1Values() []StorageAccountType1 { + return []StorageAccountType1{StorageAccountType1GRS, StorageAccountType1LRS, StorageAccountType1ZRS} +} + // StorageKeyType enumerates the values for storage key type. type StorageKeyType string diff --git a/services/preview/sql/mgmt/v3.0/sql/importexport.go b/services/preview/sql/mgmt/v3.0/sql/importexport.go new file mode 100644 index 000000000000..26a248a74104 --- /dev/null +++ b/services/preview/sql/mgmt/v3.0/sql/importexport.go @@ -0,0 +1,135 @@ +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" +) + +// ImportExportClient 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 ImportExportClient struct { + BaseClient +} + +// NewImportExportClient creates an instance of the ImportExportClient client. +func NewImportExportClient(subscriptionID string) ImportExportClient { + return NewImportExportClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImportExportClientWithBaseURI creates an instance of the ImportExportClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewImportExportClientWithBaseURI(baseURI string, subscriptionID string) ImportExportClient { + return ImportExportClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Import imports a bacpac into a new 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. +// parameters - the database import request parameters. +func (client ImportExportClient) Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExistingDatabaseDefinition) (result ImportExportImportFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportClient.Import") + 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.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("sql.ImportExportClient", "Import", err.Error()) + } + + req, err := client.ImportPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ImportExportClient", "Import", nil, "Failure preparing request") + return + } + + result, err = client.ImportSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ImportExportClient", "Import", result.Response(), "Failure sending request") + return + } + + return +} + +// ImportPreparer prepares the Import request. +func (client ImportExportClient) ImportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExistingDatabaseDefinition) (*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 = "2020-02-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportSender sends the Import request. The method will close the +// http.Response Body if it receives an error. +func (client ImportExportClient) ImportSender(req *http.Request) (future ImportExportImportFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ImportResponder handles the response to the Import request. The method always +// closes the http.Response Body. +func (client ImportExportClient) ImportResponder(resp *http.Response) (result ImportExportOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go b/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go new file mode 100644 index 000000000000..d4451d31a684 --- /dev/null +++ b/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go @@ -0,0 +1,406 @@ +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" +) + +// ManagedInstanceAzureADOnlyAuthenticationsClient 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 ManagedInstanceAzureADOnlyAuthenticationsClient struct { + BaseClient +} + +// NewManagedInstanceAzureADOnlyAuthenticationsClient creates an instance of the +// ManagedInstanceAzureADOnlyAuthenticationsClient client. +func NewManagedInstanceAzureADOnlyAuthenticationsClient(subscriptionID string) ManagedInstanceAzureADOnlyAuthenticationsClient { + return NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI creates an instance of the +// ManagedInstanceAzureADOnlyAuthenticationsClient client using a custom endpoint. Use this when interacting with an +// Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceAzureADOnlyAuthenticationsClient { + return ManagedInstanceAzureADOnlyAuthenticationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sets Server Active Directory only authentication property or updates an existing server Active +// Directory only authentication property. +// 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. +// managedInstanceName - the name of the managed instance. +// parameters - the required parameters for creating or updating an Active Directory only authentication +// property. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAzureADOnlyAuthentication) (result ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.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.ManagedInstanceAzureADOnlyAuthProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceAzureADOnlyAuthProperties.AzureADOnlyAuthentication", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAzureADOnlyAuthentication) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authenticationName": autorest.Encode("path", "Default"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthentication, err error) { + err = autorest.Respond( + resp, + 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 only authentication property. +// 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. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authenticationName": autorest.Encode("path", "Default"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) DeleteSender(req *http.Request) (future ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ManagedInstanceAzureADOnlyAuthenticationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a specific Azure Active Directory only authentication property. +// 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. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthentication, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.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, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "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.ManagedInstanceAzureADOnlyAuthenticationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authenticationName": autorest.Encode("path", "Default"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) GetResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthentication, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance gets a list of server Azure Active Directory only authentications. +// 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. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.ListByInstance") + defer func() { + sc := -1 + if result.miaaoalr.Response.Response != nil { + sc = result.miaaoalr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstanceNextResults + req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.miaaoalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.miaaoalr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", resp, "Failure responding to request") + } + if result.miaaoalr.hasNextLink() && result.miaaoalr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/managedInstances/{managedInstanceName}/azureADOnlyAuthentications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstanceSender sends the ListByInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstanceNextResults retrieves the next set of results, if any. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceAzureADOnlyAuthListResult) (result ManagedInstanceAzureADOnlyAuthListResult, err error) { + req, err := lastResults.managedInstanceAzureADOnlyAuthListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.ListByInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) + return +} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go b/services/preview/sql/mgmt/v3.0/sql/managedinstances.go index 19ed1ce1a8c7..a4b15b8f71a0 100644 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go +++ b/services/preview/sql/mgmt/v3.0/sql/managedinstances.go @@ -92,7 +92,7 @@ func (client ManagedInstancesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,7 +170,7 @@ func (client ManagedInstancesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -337,7 +337,7 @@ func (client ManagedInstancesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -411,7 +411,7 @@ func (client ManagedInstancesClient) ListPreparer(ctx context.Context) (*http.Re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -528,7 +528,7 @@ func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -643,7 +643,7 @@ func (client ManagedInstancesClient) ListByResourceGroupPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -751,7 +751,7 @@ func (client ManagedInstancesClient) UpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v3.0/sql/models.go b/services/preview/sql/mgmt/v3.0/sql/models.go index 90078f0ca829..ad0066b93126 100644 --- a/services/preview/sql/mgmt/v3.0/sql/models.go +++ b/services/preview/sql/mgmt/v3.0/sql/models.go @@ -857,6 +857,8 @@ func NewBackupShortTermRetentionPolicyListResultPage(getNextPage func(context.Co type BackupShortTermRetentionPolicyProperties struct { // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. RetentionDays *int32 `json:"retentionDays,omitempty"` + // DiffBackupIntervalInHours - The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases. + DiffBackupIntervalInHours *int32 `json:"diffBackupIntervalInHours,omitempty"` } // BaseLongTermRetentionPolicyProperties properties of a long term retention policy @@ -1963,17 +1965,19 @@ type DatabaseProperties struct { MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,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"` - // ReadScale - If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' + // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' ReadScale DatabaseReadScale `json:"readScale,omitempty"` - // ReadReplicaCount - The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. + // ReadReplicaCount - The number of readonly secondary replicas associated with the database. ReadReplicaCount *int32 `json:"readReplicaCount,omitempty"` // CurrentSku - READ-ONLY; The name and tier of the SKU. CurrentSku *Sku `json:"currentSku,omitempty"` // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` + // StorageAccountType - The storage account type used to store backups for this database. Possible values include: 'GRS', 'LRS', 'ZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` // MinCapacity - Minimal capacity that database will always have allocated, if not paused MinCapacity *float64 `json:"minCapacity,omitempty"` - // PausedDate - READ-ONLY; The date when database was paused by user configuration or action (ISO8601 format). Null if the database is ready. + // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. PausedDate *date.Time `json:"pausedDate,omitempty"` // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. ResumedDate *date.Time `json:"resumedDate,omitempty"` @@ -2036,41 +2040,15 @@ func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { if dp.AutoPauseDelay != nil { objectMap["autoPauseDelay"] = dp.AutoPauseDelay } + if dp.StorageAccountType != "" { + objectMap["storageAccountType"] = dp.StorageAccountType + } if dp.MinCapacity != nil { objectMap["minCapacity"] = dp.MinCapacity } return json.Marshal(objectMap) } -// 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 { @@ -2247,7 +2225,7 @@ type DatabasesExportFuture struct { // 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) { +func (future *DatabasesExportFuture) Result(client DatabasesClient) (ieor ImportExportOperationResult, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -2259,10 +2237,10 @@ func (future *DatabasesExportFuture) Result(client DatabasesClient) (ier ImportE 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 ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { + ieor, err = client.ExportResponder(ieor.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ieor.Response.Response, "Failure responding to request") } } return @@ -2291,34 +2269,6 @@ func (future *DatabasesFailoverFuture) Result(client DatabasesClient) (ar autore 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 @@ -4732,20 +4682,22 @@ func (future *EncryptionProtectorsRevalidateFuture) Result(client EncryptionProt return } -// ExportRequest export database parameters. -type ExportRequest struct { - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' +// ExportDatabaseDefinition contains the information necessary to perform export database operation. +type ExportDatabaseDefinition struct { + // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." + // StorageKey - Storage key. StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. + // StorageURI - Storage Uri. StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. + // AdministratorLogin - Administrator login name. AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. + // AdministratorLoginPassword - Administrator login password. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` } // ExtendedDatabaseBlobAuditingPolicy an extended database blob auditing policy. @@ -6163,11 +6115,59 @@ func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ImportExportResponse response for Import/Export Get operation. -type ImportExportResponse struct { +// ImportExistingDatabaseDefinition contains the information necessary to perform import operation for existing +// database. +type ImportExistingDatabaseDefinition struct { + // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - Storage key. + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - Storage Uri. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - Administrator login name. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - Administrator login password. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` +} + +// ImportExportImportFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ImportExportImportFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ImportExportImportFuture) Result(client ImportExportClient) (ieor ImportExportOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ImportExportImportFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ImportExportImportFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { + ieor, err = client.ImportResponder(ieor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ImportExportImportFuture", "Result", ieor.Response.Response, "Failure responding to request") + } + } + return +} + +// ImportExportOperationResult an ImportExport operation result resource. +type ImportExportOperationResult struct { autorest.Response `json:"-"` - // ImportExportResponseProperties - The import/export operation properties. - *ImportExportResponseProperties `json:"properties,omitempty"` + // ImportExportOperationResultProperties - Resource properties. + *ImportExportOperationResultProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -6176,17 +6176,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 ImportExportOperationResult. +func (ieor ImportExportOperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ier.ImportExportResponseProperties != nil { - objectMap["properties"] = ier.ImportExportResponseProperties + if ieor.ImportExportOperationResultProperties != nil { + objectMap["properties"] = ieor.ImportExportOperationResultProperties } 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 ImportExportOperationResult struct. +func (ieor *ImportExportOperationResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -6196,12 +6196,12 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var importExportResponseProperties ImportExportResponseProperties - err = json.Unmarshal(*v, &importExportResponseProperties) + var importExportOperationResultProperties ImportExportOperationResultProperties + err = json.Unmarshal(*v, &importExportOperationResultProperties) if err != nil { return err } - ier.ImportExportResponseProperties = &importExportResponseProperties + ieor.ImportExportOperationResultProperties = &importExportOperationResultProperties } case "id": if v != nil { @@ -6210,7 +6210,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.ID = &ID + ieor.ID = &ID } case "name": if v != nil { @@ -6219,7 +6219,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.Name = &name + ieor.Name = &name } case "type": if v != nil { @@ -6228,7 +6228,7 @@ func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { if err != nil { return err } - ier.Type = &typeVar + ieor.Type = &typeVar } } } @@ -6236,146 +6236,54 @@ 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. +// ImportExportOperationResultProperties contains the operation result properties for import/export operation. +type ImportExportOperationResultProperties struct { + // RequestID - READ-ONLY; Request Id. RequestID *uuid.UUID `json:"requestId,omitempty"` - // ServerName - READ-ONLY; The name of the server. + // RequestType - READ-ONLY; Request type. + RequestType *string `json:"requestType,omitempty"` + // QueuedTime - READ-ONLY; Queued time. + QueuedTime *string `json:"queuedTime,omitempty"` + // LastModifiedTime - READ-ONLY; Last modified time. + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + // BlobURI - READ-ONLY; Blob Uri. + BlobURI *string `json:"blobUri,omitempty"` + // ServerName - READ-ONLY; Server name. ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; The name of the database. + // DatabaseName - READ-ONLY; Database name. DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; The status message returned from the server. + // Status - READ-ONLY; Operation status. 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 - READ-ONLY; Error message. ErrorMessage *string `json:"errorMessage,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Gets the status of private endpoints associated with this request. + PrivateEndpointConnections *[]PrivateEndpointConnectionRequestStatus `json:"privateEndpointConnections,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. +// ImportNewDatabaseDefinition contains the information necessary to perform import operation for new database. +type ImportNewDatabaseDefinition struct { + // DatabaseName - Name of the import database. 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. + // Edition - Edition of the import database. + Edition *string `json:"edition,omitempty"` + // ServiceObjectiveName - Service level objective name of the import database. + ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` + // MaxSizeBytes - Max size in bytes for the import database. MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." + // StorageKey - Storage key. StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. + // StorageURI - Storage Uri. StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. + // AdministratorLogin - Administrator login name. AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. + // AdministratorLoginPassword - Administrator login password. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` } // InstanceFailoverGroup an instance failover group. @@ -11261,34 +11169,11 @@ func (future *ManagedInstanceAdministratorsDeleteFuture) Result(client ManagedIn return } -// ManagedInstanceEditionCapability the managed server capability -type ManagedInstanceEditionCapability struct { - // Name - READ-ONLY; The managed server version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. -func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miec.Reason != nil { - objectMap["reason"] = miec.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtector the managed instance encryption protector. -type ManagedInstanceEncryptionProtector struct { +// ManagedInstanceAzureADOnlyAuthentication azure Active Directory only authentication. +type ManagedInstanceAzureADOnlyAuthentication struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceEncryptionProtectorProperties - Resource properties. - *ManagedInstanceEncryptionProtectorProperties `json:"properties,omitempty"` + // ManagedInstanceAzureADOnlyAuthProperties - Resource properties. + *ManagedInstanceAzureADOnlyAuthProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -11297,17 +11182,17 @@ type ManagedInstanceEncryptionProtector struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtector. -func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthentication. +func (miaaoa ManagedInstanceAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miep.ManagedInstanceEncryptionProtectorProperties != nil { - objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties + if miaaoa.ManagedInstanceAzureADOnlyAuthProperties != nil { + objectMap["properties"] = miaaoa.ManagedInstanceAzureADOnlyAuthProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. -func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAzureADOnlyAuthentication struct. +func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -11315,23 +11200,14 @@ func (miep *ManagedInstanceEncryptionProtector) 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 - } - miep.Kind = &kind - } case "properties": if v != nil { - var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties - err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) + var managedInstanceAzureADOnlyAuthProperties ManagedInstanceAzureADOnlyAuthProperties + err = json.Unmarshal(*v, &managedInstanceAzureADOnlyAuthProperties) if err != nil { return err } - miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties + miaaoa.ManagedInstanceAzureADOnlyAuthProperties = &managedInstanceAzureADOnlyAuthProperties } case "id": if v != nil { @@ -11340,7 +11216,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.ID = &ID + miaaoa.ID = &ID } case "name": if v != nil { @@ -11349,7 +11225,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.Name = &name + miaaoa.Name = &name } case "type": if v != nil { @@ -11358,7 +11234,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.Type = &typeVar + miaaoa.Type = &typeVar } } } @@ -11366,27 +11242,79 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error return nil } -// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. -type ManagedInstanceEncryptionProtectorListResult struct { +// ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) Result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (miaaoa ManagedInstanceAzureADOnlyAuthentication, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if miaaoa.Response.Response, err = future.GetResult(sender); err == nil && miaaoa.Response.Response.StatusCode != http.StatusNoContent { + miaaoa, err = client.CreateOrUpdateResponder(miaaoa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", miaaoa.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) Result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedInstanceAzureADOnlyAuthListResult a list of active directory only authentications. +type ManagedInstanceAzureADOnlyAuthListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` + Value *[]ManagedInstanceAzureADOnlyAuthentication `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of -// ManagedInstanceEncryptionProtector values. -type ManagedInstanceEncryptionProtectorListResultIterator struct { +// ManagedInstanceAzureADOnlyAuthListResultIterator provides access to a complete listing of +// ManagedInstanceAzureADOnlyAuthentication values. +type ManagedInstanceAzureADOnlyAuthListResultIterator struct { i int - page ManagedInstanceEncryptionProtectorListResultPage + page ManagedInstanceAzureADOnlyAuthListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -11411,47 +11339,317 @@ func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContex // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { +func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) NotDone() bool { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Response() ManagedInstanceAzureADOnlyAuthListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Value() ManagedInstanceAzureADOnlyAuthentication { if !iter.page.NotDone() { - return ManagedInstanceEncryptionProtector{} + return ManagedInstanceAzureADOnlyAuthentication{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. -func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { - return ManagedInstanceEncryptionProtectorListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultIterator type. +func NewManagedInstanceAzureADOnlyAuthListResultIterator(page ManagedInstanceAzureADOnlyAuthListResultPage) ManagedInstanceAzureADOnlyAuthListResultIterator { + return ManagedInstanceAzureADOnlyAuthListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { - return mieplr.Value == nil || len(*mieplr.Value) == 0 +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) IsEmpty() bool { + return miaaoalr.Value == nil || len(*miaaoalr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { - return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) hasNextLink() bool { + return miaaoalr.NextLink != nil && len(*miaaoalr.NextLink) != 0 } -// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceAzureADOnlyAuthListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) managedInstanceAzureADOnlyAuthListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miaaoalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(miaaoalr.NextLink))) +} + +// ManagedInstanceAzureADOnlyAuthListResultPage contains a page of ManagedInstanceAzureADOnlyAuthentication +// values. +type ManagedInstanceAzureADOnlyAuthListResultPage struct { + fn func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error) + miaaoalr ManagedInstanceAzureADOnlyAuthListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstanceAzureADOnlyAuthListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.miaaoalr) + if err != nil { + return err + } + page.miaaoalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstanceAzureADOnlyAuthListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceAzureADOnlyAuthListResultPage) NotDone() bool { + return !page.miaaoalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceAzureADOnlyAuthListResultPage) Response() ManagedInstanceAzureADOnlyAuthListResult { + return page.miaaoalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceAzureADOnlyAuthListResultPage) Values() []ManagedInstanceAzureADOnlyAuthentication { + if page.miaaoalr.IsEmpty() { + return nil + } + return *page.miaaoalr.Value +} + +// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultPage type. +func NewManagedInstanceAzureADOnlyAuthListResultPage(getNextPage func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error)) ManagedInstanceAzureADOnlyAuthListResultPage { + return ManagedInstanceAzureADOnlyAuthListResultPage{fn: getNextPage} +} + +// ManagedInstanceAzureADOnlyAuthProperties properties of a active directory only authentication for Managed +// Instance. +type ManagedInstanceAzureADOnlyAuthProperties struct { + // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. + AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` +} + +// ManagedInstanceEditionCapability the managed server capability +type ManagedInstanceEditionCapability struct { + // Name - READ-ONLY; The managed server version name. + Name *string `json:"name,omitempty"` + // SupportedFamilies - READ-ONLY; The supported families. + SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. +func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miec.Reason != nil { + objectMap["reason"] = miec.Reason + } + return json.Marshal(objectMap) +} + +// ManagedInstanceEncryptionProtector the managed instance encryption protector. +type ManagedInstanceEncryptionProtector struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ManagedInstanceEncryptionProtectorProperties - Resource properties. + *ManagedInstanceEncryptionProtectorProperties `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 ManagedInstanceEncryptionProtector. +func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miep.ManagedInstanceEncryptionProtectorProperties != nil { + objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. +func (miep *ManagedInstanceEncryptionProtector) 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 + } + miep.Kind = &kind + } + case "properties": + if v != nil { + var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties + err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) + if err != nil { + return err + } + miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + miep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + miep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + miep.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. +type ManagedInstanceEncryptionProtectorListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of +// ManagedInstanceEncryptionProtector values. +type ManagedInstanceEncryptionProtectorListResultIterator struct { + i int + page ManagedInstanceEncryptionProtectorListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceEncryptionProtectorListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { + if !iter.page.NotDone() { + return ManagedInstanceEncryptionProtector{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. +func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { + return ManagedInstanceEncryptionProtectorListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { + return mieplr.Value == nil || len(*mieplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { + return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 +} + +// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { if !mieplr.hasNextLink() { return nil, nil } @@ -12895,8 +13093,32 @@ type ManagedInstancePairInfo struct { PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` } +// ManagedInstancePrivateLinkServiceConnectionStateProperty ... +type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; The private link service connection description. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkServiceConnectionStateProperty. +func (miplscsp ManagedInstancePrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miplscsp.Status != nil { + objectMap["status"] = miplscsp.Status + } + if miplscsp.Description != nil { + objectMap["description"] = miplscsp.Description + } + return json.Marshal(objectMap) +} + // ManagedInstanceProperties the properties of a managed instance. type ManagedInstanceProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1Deleting', 'ProvisioningState1Updating', 'ProvisioningState1Unknown', 'ProvisioningState1Succeeded', 'ProvisioningState1Failed' + ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` // ManagedInstanceCreateMode - Specifies the mode of database creation. // // Default: Regular instance creation. @@ -12946,6 +13168,8 @@ type ManagedInstanceProperties struct { MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` + // StorageAccountType - The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). Possible values include: 'GRS', 'LRS', 'ZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` } // MarshalJSON is the custom marshaler for ManagedInstanceProperties. @@ -13002,6 +13226,9 @@ func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { if mip.MinimalTLSVersion != nil { objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion } + if mip.StorageAccountType != "" { + objectMap["storageAccountType"] = mip.StorageAccountType + } return json.Marshal(objectMap) } @@ -13947,13 +14174,21 @@ type Name struct { LocalizedValue *string `json:"localizedValue,omitempty"` } +// NetworkIsolationSettings contains the ARM resources for which to create private endpoint connection. +type NetworkIsolationSettings struct { + // StorageAccountResourceID - The resource id for the storage account used to store BACPAC file. If set, private endpoint connection will be created for the storage account. Must match storage account used for StorageUri parameter. + StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + // SQLServerResourceID - The resource id for the SQL server which is the target of this request. If set, private endpoint connection will be created for the SQL server. Must match server which is target of the operation. + SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` +} + // Operation SQL REST API operation definition. type Operation struct { // Name - READ-ONLY; The name of the operation being performed on this particular object. Name *string `json:"name,omitempty"` // Display - READ-ONLY; The localized display information for this particular operation / action. Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' + // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'User', 'System' Origin OperationOrigin `json:"origin,omitempty"` // Properties - READ-ONLY; Additional descriptions for the operation. Properties map[string]interface{} `json:"properties"` @@ -14441,6 +14676,16 @@ func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// PrivateEndpointConnectionRequestStatus contains the private endpoint connection requests status. +type PrivateEndpointConnectionRequestStatus struct { + // PrivateLinkServiceID - READ-ONLY; Resource id for which the private endpoint is created. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + // PrivateEndpointConnectionName - READ-ONLY; The connection name for the private endpoint. + PrivateEndpointConnectionName *string `json:"privateEndpointConnectionName,omitempty"` + // Status - READ-ONLY; Status of this private endpoint connection. + Status *string `json:"status,omitempty"` +} + // PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type PrivateEndpointConnectionsCreateOrUpdateFuture struct { @@ -14827,7 +15072,7 @@ type RecommendedElasticPoolMetric struct { // 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 - READ-ONLY; The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium', 'GeneralPurpose', 'BusinessCritical' DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` // Dtu - The DTU for the recommended elastic pool. Dtu *float64 `json:"dtu,omitempty"` @@ -17708,6 +17953,12 @@ type ServerDNSAliasProperties struct { AzureDNSRecord *string `json:"azureDnsRecord,omitempty"` } +// ServerInfo server info for the server trust group. +type ServerInfo struct { + // ServerID - Server Id. + ServerID *string `json:"serverId,omitempty"` +} + // ServerKey a server key. type ServerKey struct { autorest.Response `json:"-"` @@ -18403,6 +18654,35 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { return nil } +// ServersImportDatabaseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServersImportDatabaseFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServersImportDatabaseFuture) Result(client ServersClient) (ieor ImportExportOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServersImportDatabaseFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { + ieor, err = client.ImportDatabaseResponder(ieor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", ieor.Response.Response, "Failure responding to request") + } + } + return +} + // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ServersUpdateFuture struct { azure.Future @@ -18431,6 +18711,295 @@ func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err e return } +// ServerTrustGroup a server trust group. +type ServerTrustGroup struct { + autorest.Response `json:"-"` + // ServerTrustGroupProperties - Resource properties. + *ServerTrustGroupProperties `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 ServerTrustGroup. +func (stg ServerTrustGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stg.ServerTrustGroupProperties != nil { + objectMap["properties"] = stg.ServerTrustGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServerTrustGroup struct. +func (stg *ServerTrustGroup) 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 serverTrustGroupProperties ServerTrustGroupProperties + err = json.Unmarshal(*v, &serverTrustGroupProperties) + if err != nil { + return err + } + stg.ServerTrustGroupProperties = &serverTrustGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + stg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + stg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + stg.Type = &typeVar + } + } + } + + return nil +} + +// ServerTrustGroupListResult a list of server trust groups. +type ServerTrustGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ServerTrustGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServerTrustGroupListResultIterator provides access to a complete listing of ServerTrustGroup values. +type ServerTrustGroupListResultIterator struct { + i int + page ServerTrustGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServerTrustGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServerTrustGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServerTrustGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServerTrustGroupListResultIterator) Response() ServerTrustGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServerTrustGroupListResultIterator) Value() ServerTrustGroup { + if !iter.page.NotDone() { + return ServerTrustGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServerTrustGroupListResultIterator type. +func NewServerTrustGroupListResultIterator(page ServerTrustGroupListResultPage) ServerTrustGroupListResultIterator { + return ServerTrustGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (stglr ServerTrustGroupListResult) IsEmpty() bool { + return stglr.Value == nil || len(*stglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (stglr ServerTrustGroupListResult) hasNextLink() bool { + return stglr.NextLink != nil && len(*stglr.NextLink) != 0 +} + +// serverTrustGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (stglr ServerTrustGroupListResult) serverTrustGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(stglr.NextLink))) +} + +// ServerTrustGroupListResultPage contains a page of ServerTrustGroup values. +type ServerTrustGroupListResultPage struct { + fn func(context.Context, ServerTrustGroupListResult) (ServerTrustGroupListResult, error) + stglr ServerTrustGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServerTrustGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.stglr) + if err != nil { + return err + } + page.stglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServerTrustGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServerTrustGroupListResultPage) NotDone() bool { + return !page.stglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServerTrustGroupListResultPage) Response() ServerTrustGroupListResult { + return page.stglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServerTrustGroupListResultPage) Values() []ServerTrustGroup { + if page.stglr.IsEmpty() { + return nil + } + return *page.stglr.Value +} + +// Creates a new instance of the ServerTrustGroupListResultPage type. +func NewServerTrustGroupListResultPage(getNextPage func(context.Context, ServerTrustGroupListResult) (ServerTrustGroupListResult, error)) ServerTrustGroupListResultPage { + return ServerTrustGroupListResultPage{fn: getNextPage} +} + +// ServerTrustGroupProperties properties of a server trust group. +type ServerTrustGroupProperties struct { + // GroupMembers - Group members information for the server trust group. + GroupMembers *[]ServerInfo `json:"groupMembers,omitempty"` + // TrustScopes - Trust scope of the server trust group. + TrustScopes *[]string `json:"trustScopes,omitempty"` +} + +// ServerTrustGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerTrustGroupsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerTrustGroupsCreateOrUpdateFuture) Result(client ServerTrustGroupsClient) (stg ServerTrustGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServerTrustGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if stg.Response.Response, err = future.GetResult(sender); err == nil && stg.Response.Response.StatusCode != http.StatusNoContent { + stg, err = client.CreateOrUpdateResponder(stg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsCreateOrUpdateFuture", "Result", stg.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerTrustGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServerTrustGroupsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerTrustGroupsDeleteFuture) Result(client ServerTrustGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ServerTrustGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // ServerUpdate an update request for an Azure SQL Database server. type ServerUpdate struct { // ServerProperties - Resource properties. @@ -19052,8 +19621,8 @@ type SloUsageMetric struct { // StorageCapability the storage account type capability. type StorageCapability struct { - // StorageAccountType - READ-ONLY; The storage account type for the database's backups. Possible values include: 'GRS', 'LRS', 'ZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // StorageAccountType - READ-ONLY; The storage account type for the database's backups. Possible values include: 'StorageAccountType1GRS', 'StorageAccountType1LRS', 'StorageAccountType1ZRS' + StorageAccountType StorageAccountType1 `json:"storageAccountType,omitempty"` // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' Status CapabilityStatus `json:"status,omitempty"` // Reason - The reason for the capability not being available. @@ -20649,6 +21218,8 @@ type SyncGroupProperties struct { Schema *SyncGroupSchema `json:"schema,omitempty"` // UsePrivateLinkConnection - If use private link connection is enabled. UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` + // PrivateEndpointName - READ-ONLY; Private endpoint name of the sync group if use private link connection is enabled. + PrivateEndpointName *string `json:"privateEndpointName,omitempty"` } // MarshalJSON is the custom marshaler for SyncGroupProperties. @@ -21047,6 +21618,8 @@ type SyncMemberProperties struct { SyncMemberAzureDatabaseResourceID *string `json:"syncMemberAzureDatabaseResourceId,omitempty"` // UsePrivateLinkConnection - Whether to use private link connection. UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` + // PrivateEndpointName - READ-ONLY; Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. + PrivateEndpointName *string `json:"privateEndpointName,omitempty"` // ServerName - Server name of the member database in the sync member ServerName *string `json:"serverName,omitempty"` // DatabaseName - Database name of the member database in the sync member. diff --git a/services/preview/sql/mgmt/v3.0/sql/servers.go b/services/preview/sql/mgmt/v3.0/sql/servers.go index 1db7a367a6a6..49ab29ee42fa 100644 --- a/services/preview/sql/mgmt/v3.0/sql/servers.go +++ b/services/preview/sql/mgmt/v3.0/sql/servers.go @@ -356,6 +356,94 @@ func (client ServersClient) GetResponder(resp *http.Response) (result Server, er return } +// ImportDatabase imports a bacpac into a new 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. +// parameters - the database import request parameters. +func (client ServersClient) ImportDatabase(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition) (result ServersImportDatabaseFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ImportDatabase") + 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.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("sql.ServersClient", "ImportDatabase", err.Error()) + } + + req, err := client.ImportDatabasePreparer(ctx, resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ImportDatabase", nil, "Failure preparing request") + return + } + + result, err = client.ImportDatabaseSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ImportDatabase", result.Response(), "Failure sending request") + return + } + + return +} + +// ImportDatabasePreparer prepares the ImportDatabase request. +func (client ServersClient) ImportDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition) (*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 = "2020-02-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportDatabaseSender sends the ImportDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ImportDatabaseSender(req *http.Request) (future ServersImportDatabaseFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ImportDatabaseResponder handles the response to the ImportDatabase request. The method always +// closes the http.Response Body. +func (client ServersClient) ImportDatabaseResponder(resp *http.Response) (result ImportExportOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // List gets a list of all servers in the subscription. func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) { if tracing.IsEnabled() { diff --git a/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go b/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go new file mode 100644 index 000000000000..739f7d8b6501 --- /dev/null +++ b/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go @@ -0,0 +1,525 @@ +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" +) + +// ServerTrustGroupsClient 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 ServerTrustGroupsClient struct { + BaseClient +} + +// NewServerTrustGroupsClient creates an instance of the ServerTrustGroupsClient client. +func NewServerTrustGroupsClient(subscriptionID string) ServerTrustGroupsClient { + return NewServerTrustGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerTrustGroupsClientWithBaseURI creates an instance of the ServerTrustGroupsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewServerTrustGroupsClientWithBaseURI(baseURI string, subscriptionID string) ServerTrustGroupsClient { + return ServerTrustGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a server trust 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. +// locationName - the name of the region where the resource is located. +// serverTrustGroupName - the name of the server trust group. +// parameters - the server trust group parameters. +func (client ServerTrustGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters ServerTrustGroup) (result ServerTrustGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.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.ServerTrustGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ServerTrustGroupProperties.GroupMembers", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ServerTrustGroupProperties.TrustScopes", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("sql.ServerTrustGroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, locationName, serverTrustGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerTrustGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters ServerTrustGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) CreateOrUpdateSender(req *http.Request) (future ServerTrustGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ServerTrustGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerTrustGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a server trust 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. +// locationName - the name of the region where the resource is located. +// serverTrustGroupName - the name of the server trust group. +func (client ServerTrustGroupsClient) Delete(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result ServerTrustGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, locationName, serverTrustGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServerTrustGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) DeleteSender(req *http.Request) (future ServerTrustGroupsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ServerTrustGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a server trust 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. +// locationName - the name of the region where the resource is located. +// serverTrustGroupName - the name of the server trust group. +func (client ServerTrustGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result ServerTrustGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.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, locationName, serverTrustGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "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.ServerTrustGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerTrustGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerTrustGroupsClient) GetResponder(resp *http.Response) (result ServerTrustGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance gets a server trust groups by instance name. +// 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. +// managedInstanceName - the name of the managed instance. +func (client ServerTrustGroupsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByInstance") + defer func() { + sc := -1 + if result.stglr.Response.Response != nil { + sc = result.stglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstanceNextResults + req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.stglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.stglr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", resp, "Failure responding to request") + } + if result.stglr.hasNextLink() && result.stglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client ServerTrustGroupsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/managedInstances/{managedInstanceName}/serverTrustGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstanceSender sends the ListByInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTrustGroupsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client ServerTrustGroupsClient) ListByInstanceResponder(resp *http.Response) (result ServerTrustGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstanceNextResults retrieves the next set of results, if any. +func (client ServerTrustGroupsClient) listByInstanceNextResults(ctx context.Context, lastResults ServerTrustGroupListResult) (result ServerTrustGroupListResult, err error) { + req, err := lastResults.serverTrustGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServerTrustGroupsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) + return +} + +// ListByLocation lists a server trust 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. +// locationName - the name of the region where the resource is located. +func (client ServerTrustGroupsClient) ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result ServerTrustGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByLocation") + defer func() { + sc := -1 + if result.stglr.Response.Response != nil { + sc = result.stglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByLocationNextResults + req, err := client.ListByLocationPreparer(ctx, resourceGroupName, locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.stglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", resp, "Failure sending request") + return + } + + result.stglr, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", resp, "Failure responding to request") + } + if result.stglr.hasNextLink() && result.stglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client ServerTrustGroupsClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + 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/locations/{locationName}/serverTrustGroups", 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 ServerTrustGroupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client ServerTrustGroupsClient) ListByLocationResponder(resp *http.Response) (result ServerTrustGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByLocationNextResults retrieves the next set of results, if any. +func (client ServerTrustGroupsClient) listByLocationNextResults(ctx context.Context, lastResults ServerTrustGroupListResult) (result ServerTrustGroupListResult, err error) { + req, err := lastResults.serverTrustGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServerTrustGroupsClient) ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result ServerTrustGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByLocation(ctx, resourceGroupName, locationName) + return +} diff --git a/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go index 0d02f7ddc843..ff3902765e8d 100644 --- a/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go @@ -94,17 +94,17 @@ var _ GeoBackupPoliciesClientAPI = (*sql.GeoBackupPoliciesClient)(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) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.Database) (result sql.DatabasesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesDeleteFuture, err error) - Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ExportRequest) (result sql.DatabasesExportFuture, err error) + Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ExportDatabaseDefinition) (result sql.DatabasesExportFuture, err error) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, replicaType sql.ReplicaType) (result sql.DatabasesFailoverFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.Database, err error) - Import(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ImportRequest) (result sql.DatabasesImportFuture, err error) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultPage, err error) ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultIterator, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultPage, err error) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultIterator, err error) + ListInaccessibleByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultPage, err error) + ListInaccessibleByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultIterator, 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) @@ -703,17 +703,6 @@ type InstanceFailoverGroupsClientAPI interface { var _ InstanceFailoverGroupsClientAPI = (*sql.InstanceFailoverGroupsClient)(nil) -// BackupShortTermRetentionPoliciesClientAPI contains the set of methods on the BackupShortTermRetentionPoliciesClient type. -type BackupShortTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesUpdateFuture, err error) -} - -var _ BackupShortTermRetentionPoliciesClientAPI = (*sql.BackupShortTermRetentionPoliciesClient)(nil) - // TdeCertificatesClientAPI contains the set of methods on the TdeCertificatesClient type. type TdeCertificatesClientAPI interface { Create(ctx context.Context, resourceGroupName string, serverName string, parameters sql.TdeCertificate) (result sql.TdeCertificatesCreateFuture, err error) @@ -818,23 +807,6 @@ type UsagesClientAPI interface { var _ UsagesClientAPI = (*sql.UsagesClient)(nil) -// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. -type ManagedInstancesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) - List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) -} - -var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) - // PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. type PrivateEndpointConnectionsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) @@ -861,6 +833,7 @@ type ServersClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.Server) (result sql.ServersCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServersDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.Server, err error) + ImportDatabase(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ImportNewDatabaseDefinition) (result sql.ServersImportDatabaseFuture, err error) List(ctx context.Context) (result sql.ServerListResultPage, err error) ListComplete(ctx context.Context) (result sql.ServerListResultIterator, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ServerListResultPage, err error) @@ -988,6 +961,34 @@ type SyncMembersClientAPI interface { var _ SyncMembersClientAPI = (*sql.SyncMembersClient)(nil) +// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. +type ManagedInstancesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) + Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) + List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) + ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) + ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) + ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) +} + +var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) + +// BackupShortTermRetentionPoliciesClientAPI contains the set of methods on the BackupShortTermRetentionPoliciesClient type. +type BackupShortTermRetentionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicy, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesUpdateFuture, err error) +} + +var _ BackupShortTermRetentionPoliciesClientAPI = (*sql.BackupShortTermRetentionPoliciesClient)(nil) + // ManagedDatabaseRestoreDetailsClientAPI contains the set of methods on the ManagedDatabaseRestoreDetailsClient type. type ManagedDatabaseRestoreDetailsClientAPI interface { Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseRestoreDetailsResult, err error) @@ -1020,3 +1021,34 @@ type ServerAzureADOnlyAuthenticationsClientAPI interface { } var _ ServerAzureADOnlyAuthenticationsClientAPI = (*sql.ServerAzureADOnlyAuthenticationsClient)(nil) + +// ImportExportClientAPI contains the set of methods on the ImportExportClient type. +type ImportExportClientAPI interface { + Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExistingDatabaseDefinition) (result sql.ImportExportImportFuture, err error) +} + +var _ ImportExportClientAPI = (*sql.ImportExportClient)(nil) + +// ManagedInstanceAzureADOnlyAuthenticationsClientAPI contains the set of methods on the ManagedInstanceAzureADOnlyAuthenticationsClient type. +type ManagedInstanceAzureADOnlyAuthenticationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceAzureADOnlyAuthentication) (result sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthentication, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthListResultIterator, err error) +} + +var _ ManagedInstanceAzureADOnlyAuthenticationsClientAPI = (*sql.ManagedInstanceAzureADOnlyAuthenticationsClient)(nil) + +// ServerTrustGroupsClientAPI contains the set of methods on the ServerTrustGroupsClient type. +type ServerTrustGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters sql.ServerTrustGroup) (result sql.ServerTrustGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result sql.ServerTrustGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result sql.ServerTrustGroup, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustGroupListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustGroupListResultIterator, err error) + ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result sql.ServerTrustGroupListResultPage, err error) + ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result sql.ServerTrustGroupListResultIterator, err error) +} + +var _ ServerTrustGroupsClientAPI = (*sql.ServerTrustGroupsClient)(nil)