From 77b188ff891f6bdb3e1d6b7b295aa7f44f676b33 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Wed, 18 Sep 2019 20:53:41 +0000 Subject: [PATCH 1/2] Generated from 59b60e0d33d2074acc71b3fc82a67cd32f7dad58 Add deprecated Extensions_Get for completeness --- .../sql/encryptionprotectors.go | 79 ---- .../sql/managedinstances.go | 116 +++++ .../sql/mgmt/2015-05-01-preview/sql/models.go | 40 +- .../sql/sqlapi/interfaces.go | 2 +- .../sql/encryptionprotectors.go | 79 ---- .../sql/managedinstanceadministrators.go | 413 ------------------ .../sql/managedinstances.go | 116 +++++ .../sql/mgmt/2017-03-01-preview/sql/models.go | 330 +------------- .../sql/sqlapi/interfaces.go | 12 +- .../managedinstanceencryptionprotectors.go | 78 ---- .../sql/mgmt/2017-10-01-preview/sql/models.go | 127 ++---- .../sql/sqlapi/interfaces.go | 1 - 12 files changed, 305 insertions(+), 1088 deletions(-) delete mode 100644 services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go index 4bf6cc3947ab..f0c3e0785901 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go @@ -88,7 +88,6 @@ func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Cont "api-version": APIVersion, } - parameters.Kind = nil parameters.Location = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -320,81 +319,3 @@ func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Contex result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } - -// Revalidate revalidates an existing encryption protector. -// 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 EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go index ffdde71d15ef..ad8ad2c884c5 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go @@ -396,6 +396,122 @@ func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result M return } +// ListByInstancePool gets a list of all managed instances in an instance pool. +// 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. +// instancePoolName - the instance pool name. +func (client ManagedInstancesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") + defer func() { + sc := -1 + if result.milr.Response.Response != nil { + sc = result.milr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstancePoolNextResults + req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstancePoolSender(req) + if err != nil { + result.milr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure sending request") + return + } + + result.milr, err = client.ListByInstancePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure responding to request") + } + + return +} + +// ListByInstancePoolPreparer prepares the ListByInstancePool request. +func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instancePoolName": autorest.Encode("path", instancePoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-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/instancePools/{instancePoolName}/managedInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstancesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) ListByInstancePoolResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstancePoolNextResults retrieves the next set of results, if any. +func (client ManagedInstancesClient) listByInstancePoolNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { + req, err := lastResults.managedInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstancePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstancePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") + 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName) + return +} + // ListByResourceGroup gets a list of managed instances in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go index 418447274f48..cbc26fccfeec 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go @@ -1640,7 +1640,7 @@ type DatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -3022,7 +3022,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { // EncryptionProtector the server encryption protector. type EncryptionProtector struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` @@ -3039,6 +3039,9 @@ type EncryptionProtector struct { // MarshalJSON is the custom marshaler for EncryptionProtector. func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if ep.Kind != nil { + objectMap["kind"] = ep.Kind + } if ep.EncryptionProtectorProperties != nil { objectMap["properties"] = ep.EncryptionProtectorProperties } @@ -3304,29 +3307,6 @@ func (future *EncryptionProtectorsCreateOrUpdateFuture) Result(client Encryption return } -// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsRevalidateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *EncryptionProtectorsRevalidateFuture) Result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - // ExportRequest export database parameters. type ExportRequest struct { // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -7003,17 +6983,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go index f41524b79ca6..b43e1bc3c385 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go @@ -273,7 +273,6 @@ type EncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) - Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) } var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) @@ -297,6 +296,7 @@ type ManagedInstancesClientAPI interface { Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) + ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go index 4bf6cc3947ab..f0c3e0785901 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go @@ -88,7 +88,6 @@ func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Cont "api-version": APIVersion, } - parameters.Kind = nil parameters.Location = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -320,81 +319,3 @@ func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Contex result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } - -// Revalidate revalidates an existing encryption protector. -// 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 EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go deleted file mode 100644 index ce3fa15903af..000000000000 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go +++ /dev/null @@ -1,413 +0,0 @@ -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" -) - -// ManagedInstanceAdministratorsClient 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 ManagedInstanceAdministratorsClient struct { - BaseClient -} - -// NewManagedInstanceAdministratorsClient creates an instance of the ManagedInstanceAdministratorsClient client. -func NewManagedInstanceAdministratorsClient(subscriptionID string) ManagedInstanceAdministratorsClient { - return NewManagedInstanceAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceAdministratorsClientWithBaseURI creates an instance of the ManagedInstanceAdministratorsClient -// client. -func NewManagedInstanceAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceAdministratorsClient { - return ManagedInstanceAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// administratorName - the requested administrator name. -// parameters - the requested administrator parameters. -func (client ManagedInstanceAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters ManagedInstanceAdministrator) (result ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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.ManagedInstanceAdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedInstanceAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedInstanceAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, administratorName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters ManagedInstanceAdministrator) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", administratorName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-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}/administrators/{administratorName}", 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 ManagedInstanceAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceAdministrator, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// administratorName - the administrator name. -func (client ManagedInstanceAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result ManagedInstanceAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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, administratorName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", administratorName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-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}/administrators/{administratorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceAdministratorsClient) DeleteSender(req *http.Request) (future ManagedInstanceAdministratorsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAdministratorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// administratorName - the administrator name. -func (client ManagedInstanceAdministratorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result ManagedInstanceAdministrator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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, administratorName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "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.ManagedInstanceAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", administratorName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-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/managedInstances/{managedInstanceName}/administrators/{administratorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAdministratorsClient) GetResponder(resp *http.Response) (result ManagedInstanceAdministrator, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance administrators. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAdministratorsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.ListByInstance") - defer func() { - sc := -1 - if result.mialr.Response.Response != nil { - sc = result.mialr.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.ManagedInstanceAdministratorsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mialr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mialr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure responding to request") - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceAdministratorsClient) 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 = "2017-03-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/managedInstances/{managedInstanceName}/administrators", 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 ManagedInstanceAdministratorsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAdministratorsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceAdministratorListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - 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 ManagedInstanceAdministratorsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceAdministratorListResult) (result ManagedInstanceAdministratorListResult, err error) { - req, err := lastResults.managedInstanceAdministratorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "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.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceAdministratorsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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/2017-03-01-preview/sql/managedinstances.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go index ffdde71d15ef..ad8ad2c884c5 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go @@ -396,6 +396,122 @@ func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result M return } +// ListByInstancePool gets a list of all managed instances in an instance pool. +// 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. +// instancePoolName - the instance pool name. +func (client ManagedInstancesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") + defer func() { + sc := -1 + if result.milr.Response.Response != nil { + sc = result.milr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstancePoolNextResults + req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstancePoolSender(req) + if err != nil { + result.milr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure sending request") + return + } + + result.milr, err = client.ListByInstancePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure responding to request") + } + + return +} + +// ListByInstancePoolPreparer prepares the ListByInstancePool request. +func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instancePoolName": autorest.Encode("path", instancePoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-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/instancePools/{instancePoolName}/managedInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstancesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) ListByInstancePoolResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstancePoolNextResults retrieves the next set of results, if any. +func (client ManagedInstancesClient) listByInstancePoolNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { + req, err := lastResults.managedInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstancePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstancePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") + 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName) + return +} + // ListByResourceGroup gets a list of managed instances in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go index d13476b207a7..8fa47e4e3402 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go @@ -2179,7 +2179,7 @@ type DatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -4205,7 +4205,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { // EncryptionProtector the server encryption protector. type EncryptionProtector struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` @@ -4222,6 +4222,9 @@ type EncryptionProtector struct { // MarshalJSON is the custom marshaler for EncryptionProtector. func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if ep.Kind != nil { + objectMap["kind"] = ep.Kind + } if ep.EncryptionProtectorProperties != nil { objectMap["properties"] = ep.EncryptionProtectorProperties } @@ -4487,29 +4490,6 @@ func (future *EncryptionProtectorsCreateOrUpdateFuture) Result(client Encryption return } -// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsRevalidateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *EncryptionProtectorsRevalidateFuture) Result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - // ExportRequest export database parameters. type ExportRequest struct { // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -4674,7 +4654,7 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -4864,7 +4844,7 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -8628,290 +8608,6 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { return nil } -// ManagedInstanceAdministrator an Azure SQL managed instance administrator. -type ManagedInstanceAdministrator struct { - autorest.Response `json:"-"` - // ManagedInstanceAdministratorProperties - Resource properties. - *ManagedInstanceAdministratorProperties `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 ManagedInstanceAdministrator. -func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mia.ManagedInstanceAdministratorProperties != nil { - objectMap["properties"] = mia.ManagedInstanceAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. -func (mia *ManagedInstanceAdministrator) 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 managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties - err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) - if err != nil { - return err - } - mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mia.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceAdministratorListResult a list of managed instance administrators. -type ManagedInstanceAdministratorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of -// ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultIterator struct { - i int - page ManagedInstanceAdministratorListResultPage -} - -// 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 *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.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 *ManagedInstanceAdministratorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceAdministratorListResultIterator) 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 ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { - 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 ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { - if !iter.page.NotDone() { - return ManagedInstanceAdministrator{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. -func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { - return ManagedInstanceAdministratorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { - return mialr.Value == nil || len(*mialr.Value) == 0 -} - -// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { - if mialr.NextLink == nil || len(to.String(mialr.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mialr.NextLink))) -} - -// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultPage struct { - fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) - mialr ManagedInstanceAdministratorListResult -} - -// 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 *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - next, err := page.fn(ctx, page.mialr) - if err != nil { - return err - } - page.mialr = next - 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 *ManagedInstanceAdministratorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { - return !page.mialr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { - return page.mialr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { - if page.mialr.IsEmpty() { - return nil - } - return *page.mialr.Value -} - -// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. -func NewManagedInstanceAdministratorListResultPage(getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { - return ManagedInstanceAdministratorListResultPage{fn: getNextPage} -} - -// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. -type ManagedInstanceAdministratorProperties struct { - // AdministratorType - Type of the managed instance administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - Login name of the managed instance administrator. - Login *string `json:"login,omitempty"` - // Sid - SID (object ID) of the managed instance administrator. - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - Tenant ID of the managed instance administrator. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) Result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { - mia, err = client.CreateOrUpdateResponder(mia.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceAdministratorsDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ManagedInstanceAdministratorsDeleteFuture) Result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - // ManagedInstanceListResult a list of managed instances. type ManagedInstanceListResult struct { autorest.Response `json:"-"` @@ -11216,7 +10912,7 @@ type ServerBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -12822,17 +12518,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go index 5813776a86e3..19253bc7bcd3 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go @@ -269,7 +269,6 @@ type EncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) - Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) } var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) @@ -293,6 +292,7 @@ type ManagedInstancesClientAPI interface { Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) + ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) } @@ -578,16 +578,6 @@ type SensitivityLabelsClientAPI interface { var _ SensitivityLabelsClientAPI = (*sql.SensitivityLabelsClient)(nil) -// ManagedInstanceAdministratorsClientAPI contains the set of methods on the ManagedInstanceAdministratorsClient type. -type ManagedInstanceAdministratorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters sql.ManagedInstanceAdministrator) (result sql.ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result sql.ManagedInstanceAdministratorsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result sql.ManagedInstanceAdministrator, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministratorListResultPage, err error) -} - -var _ ManagedInstanceAdministratorsClientAPI = (*sql.ManagedInstanceAdministratorsClient)(nil) - // ServerAutomaticTuningClientAPI contains the set of methods on the ServerAutomaticTuningClient type. type ServerAutomaticTuningClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAutomaticTuning, err error) diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go index 4f0f12f184f1..cf433d5a1242 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go @@ -321,81 +321,3 @@ func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceComplete(c result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) return } - -// Revalidate revalidates an existing encryption protector. -// 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 ManagedInstanceEncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go index 55481992c85a..47a9a57126e2 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go @@ -148,53 +148,51 @@ func PossibleDatabaseReadScaleValues() []DatabaseReadScale { type DatabaseStatus string const ( - // DatabaseStatusAutoClosed ... - DatabaseStatusAutoClosed DatabaseStatus = "AutoClosed" - // DatabaseStatusCopying ... - DatabaseStatusCopying DatabaseStatus = "Copying" - // DatabaseStatusCreating ... - DatabaseStatusCreating DatabaseStatus = "Creating" - // DatabaseStatusDisabled ... - DatabaseStatusDisabled DatabaseStatus = "Disabled" - // DatabaseStatusEmergencyMode ... - DatabaseStatusEmergencyMode DatabaseStatus = "EmergencyMode" - // DatabaseStatusInaccessible ... - DatabaseStatusInaccessible DatabaseStatus = "Inaccessible" - // DatabaseStatusOffline ... - DatabaseStatusOffline DatabaseStatus = "Offline" - // DatabaseStatusOfflineChangingDwPerformanceTiers ... - DatabaseStatusOfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" - // DatabaseStatusOfflineSecondary ... - DatabaseStatusOfflineSecondary DatabaseStatus = "OfflineSecondary" - // DatabaseStatusOnline ... - DatabaseStatusOnline DatabaseStatus = "Online" - // DatabaseStatusOnlineChangingDwPerformanceTiers ... - DatabaseStatusOnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" - // DatabaseStatusPaused ... - DatabaseStatusPaused DatabaseStatus = "Paused" - // DatabaseStatusPausing ... - DatabaseStatusPausing DatabaseStatus = "Pausing" - // DatabaseStatusRecovering ... - DatabaseStatusRecovering DatabaseStatus = "Recovering" - // DatabaseStatusRecoveryPending ... - DatabaseStatusRecoveryPending DatabaseStatus = "RecoveryPending" - // DatabaseStatusRestoring ... - DatabaseStatusRestoring DatabaseStatus = "Restoring" - // DatabaseStatusResuming ... - DatabaseStatusResuming DatabaseStatus = "Resuming" - // DatabaseStatusScaling ... - DatabaseStatusScaling DatabaseStatus = "Scaling" - // DatabaseStatusShutdown ... - DatabaseStatusShutdown DatabaseStatus = "Shutdown" - // DatabaseStatusStandby ... - DatabaseStatusStandby DatabaseStatus = "Standby" - // DatabaseStatusSuspect ... - DatabaseStatusSuspect DatabaseStatus = "Suspect" + // AutoClosed ... + AutoClosed DatabaseStatus = "AutoClosed" + // Copying ... + Copying DatabaseStatus = "Copying" + // Creating ... + Creating DatabaseStatus = "Creating" + // EmergencyMode ... + EmergencyMode DatabaseStatus = "EmergencyMode" + // Inaccessible ... + Inaccessible DatabaseStatus = "Inaccessible" + // Offline ... + Offline DatabaseStatus = "Offline" + // OfflineChangingDwPerformanceTiers ... + OfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" + // OfflineSecondary ... + OfflineSecondary DatabaseStatus = "OfflineSecondary" + // Online ... + Online DatabaseStatus = "Online" + // OnlineChangingDwPerformanceTiers ... + OnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" + // Paused ... + Paused DatabaseStatus = "Paused" + // Pausing ... + Pausing DatabaseStatus = "Pausing" + // Recovering ... + Recovering DatabaseStatus = "Recovering" + // RecoveryPending ... + RecoveryPending DatabaseStatus = "RecoveryPending" + // Restoring ... + Restoring DatabaseStatus = "Restoring" + // Resuming ... + Resuming DatabaseStatus = "Resuming" + // Scaling ... + Scaling DatabaseStatus = "Scaling" + // Shutdown ... + Shutdown DatabaseStatus = "Shutdown" + // Standby ... + Standby DatabaseStatus = "Standby" + // Suspect ... + Suspect DatabaseStatus = "Suspect" ) // PossibleDatabaseStatusValues returns an array of possible values for the DatabaseStatus const type. func PossibleDatabaseStatusValues() []DatabaseStatus { - return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusSuspect} + return []DatabaseStatus{AutoClosed, Copying, Creating, EmergencyMode, Inaccessible, Offline, OfflineChangingDwPerformanceTiers, OfflineSecondary, Online, OnlineChangingDwPerformanceTiers, Paused, Pausing, Recovering, RecoveryPending, Restoring, Resuming, Scaling, Shutdown, Standby, Suspect} } // ElasticPoolLicenseType enumerates the values for elastic pool license type. @@ -1291,7 +1289,7 @@ type DatabaseProperties struct { ElasticPoolID *string `json:"elasticPoolId,omitempty"` // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' + // Status - READ-ONLY; The status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', 'OnlineChangingDwPerformanceTiers' Status DatabaseStatus `json:"status,omitempty"` // DatabaseID - READ-ONLY; The ID of the database. DatabaseID *uuid.UUID `json:"databaseId,omitempty"` @@ -1327,20 +1325,14 @@ 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 *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"` // 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 *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"` } // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -3485,29 +3477,6 @@ func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) Result(cl return } -// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) Result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - // ManagedInstanceFamilyCapability the managed server family capability. type ManagedInstanceFamilyCapability struct { // Name - READ-ONLY; Family name. @@ -4205,17 +4174,17 @@ type ServiceObjectiveCapability struct { Reason *string `json:"reason,omitempty"` } -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go index 9b696e175f46..aa93c1ca8a3f 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go @@ -164,7 +164,6 @@ type ManagedInstanceEncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceEncryptionProtector) (result sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtector, err error) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultPage, err error) - Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) } var _ ManagedInstanceEncryptionProtectorsClientAPI = (*sql.ManagedInstanceEncryptionProtectorsClient)(nil) From ae79823193e30e6a7edcf1d4417a5cb648eeb456 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Wed, 18 Sep 2019 21:52:37 +0000 Subject: [PATCH 2/2] Generated from ceaf6cb4e9635952f016fdef429f76952835b428 Add deprecated Extensions_Get for completeness --- .../sql/encryptionprotectors.go | 79 ++++ .../sql/managedinstances.go | 116 ----- .../sql/mgmt/2015-05-01-preview/sql/models.go | 40 +- .../sql/sqlapi/interfaces.go | 2 +- .../sql/encryptionprotectors.go | 79 ++++ .../sql/managedinstanceadministrators.go | 413 ++++++++++++++++++ .../sql/managedinstances.go | 116 ----- .../sql/mgmt/2017-03-01-preview/sql/models.go | 330 +++++++++++++- .../sql/sqlapi/interfaces.go | 12 +- .../managedinstanceencryptionprotectors.go | 78 ++++ .../sql/mgmt/2017-10-01-preview/sql/models.go | 127 ++++-- .../sql/sqlapi/interfaces.go | 1 + 12 files changed, 1088 insertions(+), 305 deletions(-) create mode 100644 services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go index f0c3e0785901..4bf6cc3947ab 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go @@ -88,6 +88,7 @@ func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Cont "api-version": APIVersion, } + parameters.Kind = nil parameters.Location = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -319,3 +320,81 @@ func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Contex result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } + +// Revalidate revalidates an existing encryption protector. +// 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 EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") + return + } + + result, err = client.RevalidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") + return + } + + return +} + +// RevalidatePreparer prepares the Revalidate request. +func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "encryptionProtectorName": autorest.Encode("path", "current"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevalidateSender sends the Revalidate request. The method will close the +// http.Response Body if it receives an error. +func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RevalidateResponder handles the response to the Revalidate request. The method always +// closes the http.Response Body. +func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go index ad8ad2c884c5..ffdde71d15ef 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go @@ -396,122 +396,6 @@ func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result M return } -// ListByInstancePool gets a list of all managed instances in an instance pool. -// 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. -// instancePoolName - the instance pool name. -func (client ManagedInstancesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstancePoolNextResults - req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure sending request") - return - } - - result.milr, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure responding to request") - } - - return -} - -// ListByInstancePoolPreparer prepares the ListByInstancePool request. -func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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/instancePools/{instancePoolName}/managedInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstancesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always -// closes the http.Response Body. -func (client ManagedInstancesClient) ListByInstancePoolResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstancePoolNextResults retrieves the next set of results, if any. -func (client ManagedInstancesClient) listByInstancePoolNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName) - return -} - // ListByResourceGroup gets a list of managed instances in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go index cbc26fccfeec..418447274f48 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go @@ -1640,7 +1640,7 @@ type DatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -3022,7 +3022,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { // EncryptionProtector the server encryption protector. type EncryptionProtector struct { autorest.Response `json:"-"` - // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` @@ -3039,9 +3039,6 @@ type EncryptionProtector struct { // MarshalJSON is the custom marshaler for EncryptionProtector. func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ep.Kind != nil { - objectMap["kind"] = ep.Kind - } if ep.EncryptionProtectorProperties != nil { objectMap["properties"] = ep.EncryptionProtectorProperties } @@ -3307,6 +3304,29 @@ func (future *EncryptionProtectorsCreateOrUpdateFuture) Result(client Encryption return } +// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EncryptionProtectorsRevalidateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EncryptionProtectorsRevalidateFuture) Result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") + return + } + ar.Response = future.Response() + return +} + // ExportRequest export database parameters. type ExportRequest struct { // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -6983,17 +7003,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku the resource model definition representing SKU +// Sku an ARM Resource SKU. type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. Tier *string `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + // Size - Size of the particular SKU Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + // Capacity - Capacity of the particular SKU. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go index b43e1bc3c385..f41524b79ca6 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go @@ -273,6 +273,7 @@ type EncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) + Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) } var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) @@ -296,7 +297,6 @@ type ManagedInstancesClientAPI interface { Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go index f0c3e0785901..4bf6cc3947ab 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/encryptionprotectors.go @@ -88,6 +88,7 @@ func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Cont "api-version": APIVersion, } + parameters.Kind = nil parameters.Location = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -319,3 +320,81 @@ func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Contex result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } + +// Revalidate revalidates an existing encryption protector. +// 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 EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") + return + } + + result, err = client.RevalidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") + return + } + + return +} + +// RevalidatePreparer prepares the Revalidate request. +func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "encryptionProtectorName": autorest.Encode("path", "current"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevalidateSender sends the Revalidate request. The method will close the +// http.Response Body if it receives an error. +func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RevalidateResponder handles the response to the Revalidate request. The method always +// closes the http.Response Body. +func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go new file mode 100644 index 000000000000..ce3fa15903af --- /dev/null +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstanceadministrators.go @@ -0,0 +1,413 @@ +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" +) + +// ManagedInstanceAdministratorsClient 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 ManagedInstanceAdministratorsClient struct { + BaseClient +} + +// NewManagedInstanceAdministratorsClient creates an instance of the ManagedInstanceAdministratorsClient client. +func NewManagedInstanceAdministratorsClient(subscriptionID string) ManagedInstanceAdministratorsClient { + return NewManagedInstanceAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedInstanceAdministratorsClientWithBaseURI creates an instance of the ManagedInstanceAdministratorsClient +// client. +func NewManagedInstanceAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceAdministratorsClient { + return ManagedInstanceAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a managed instance administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// administratorName - the requested administrator name. +// parameters - the requested administrator parameters. +func (client ManagedInstanceAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters ManagedInstanceAdministrator) (result ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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.ManagedInstanceAdministratorProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ManagedInstanceAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ManagedInstanceAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, administratorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedInstanceAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters ManagedInstanceAdministrator) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", administratorName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-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}/administrators/{administratorName}", 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 ManagedInstanceAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceAdministrator, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a managed instance administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// administratorName - the administrator name. +func (client ManagedInstanceAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result ManagedInstanceAdministratorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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, administratorName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedInstanceAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", administratorName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-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}/administrators/{administratorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceAdministratorsClient) DeleteSender(req *http.Request) (future ManagedInstanceAdministratorsDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAdministratorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a managed instance administrator. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// administratorName - the administrator name. +func (client ManagedInstanceAdministratorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result ManagedInstanceAdministrator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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, administratorName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "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.ManagedInstanceAdministratorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedInstanceAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "administratorName": autorest.Encode("path", administratorName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-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/managedInstances/{managedInstanceName}/administrators/{administratorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAdministratorsClient) GetResponder(resp *http.Response) (result ManagedInstanceAdministrator, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance gets a list of managed instance administrators. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceAdministratorsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.ListByInstance") + defer func() { + sc := -1 + if result.mialr.Response.Response != nil { + sc = result.mialr.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.ManagedInstanceAdministratorsClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.mialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.mialr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure responding to request") + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client ManagedInstanceAdministratorsClient) 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 = "2017-03-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/managedInstances/{managedInstanceName}/administrators", 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 ManagedInstanceAdministratorsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client ManagedInstanceAdministratorsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceAdministratorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 ManagedInstanceAdministratorsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceAdministratorListResult) (result ManagedInstanceAdministratorListResult, err error) { + req, err := lastResults.managedInstanceAdministratorListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "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.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstanceAdministratorsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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/2017-03-01-preview/sql/managedinstances.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go index ad8ad2c884c5..ffdde71d15ef 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/managedinstances.go @@ -396,122 +396,6 @@ func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result M return } -// ListByInstancePool gets a list of all managed instances in an instance pool. -// 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. -// instancePoolName - the instance pool name. -func (client ManagedInstancesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstancePoolNextResults - req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure sending request") - return - } - - result.milr, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure responding to request") - } - - return -} - -// ListByInstancePoolPreparer prepares the ListByInstancePool request. -func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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/instancePools/{instancePoolName}/managedInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstancesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always -// closes the http.Response Body. -func (client ManagedInstancesClient) ListByInstancePoolResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstancePoolNextResults retrieves the next set of results, if any. -func (client ManagedInstancesClient) listByInstancePoolNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName) - return -} - // ListByResourceGroup gets a list of managed instances in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go index 8fa47e4e3402..d13476b207a7 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go @@ -2179,7 +2179,7 @@ type DatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -4205,7 +4205,7 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { // EncryptionProtector the server encryption protector. type EncryptionProtector struct { autorest.Response `json:"-"` - // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` @@ -4222,9 +4222,6 @@ type EncryptionProtector struct { // MarshalJSON is the custom marshaler for EncryptionProtector. func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ep.Kind != nil { - objectMap["kind"] = ep.Kind - } if ep.EncryptionProtectorProperties != nil { objectMap["properties"] = ep.EncryptionProtectorProperties } @@ -4490,6 +4487,29 @@ func (future *EncryptionProtectorsCreateOrUpdateFuture) Result(client Encryption return } +// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EncryptionProtectorsRevalidateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EncryptionProtectorsRevalidateFuture) Result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") + return + } + ar.Response = future.Response() + return +} + // ExportRequest export database parameters. type ExportRequest struct { // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -4654,7 +4674,7 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -4844,7 +4864,7 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -8608,6 +8628,290 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { return nil } +// ManagedInstanceAdministrator an Azure SQL managed instance administrator. +type ManagedInstanceAdministrator struct { + autorest.Response `json:"-"` + // ManagedInstanceAdministratorProperties - Resource properties. + *ManagedInstanceAdministratorProperties `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 ManagedInstanceAdministrator. +func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mia.ManagedInstanceAdministratorProperties != nil { + objectMap["properties"] = mia.ManagedInstanceAdministratorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. +func (mia *ManagedInstanceAdministrator) 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 managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties + err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) + if err != nil { + return err + } + mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mia.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceAdministratorListResult a list of managed instance administrators. +type ManagedInstanceAdministratorListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of +// ManagedInstanceAdministrator values. +type ManagedInstanceAdministratorListResultIterator struct { + i int + page ManagedInstanceAdministratorListResultPage +} + +// 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 *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.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 *ManagedInstanceAdministratorListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceAdministratorListResultIterator) 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 ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { + 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 ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { + if !iter.page.NotDone() { + return ManagedInstanceAdministrator{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. +func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { + return ManagedInstanceAdministratorListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { + return mialr.Value == nil || len(*mialr.Value) == 0 +} + +// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { + if mialr.NextLink == nil || len(to.String(mialr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mialr.NextLink))) +} + +// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. +type ManagedInstanceAdministratorListResultPage struct { + fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) + mialr ManagedInstanceAdministratorListResult +} + +// 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 *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.mialr) + if err != nil { + return err + } + page.mialr = next + 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 *ManagedInstanceAdministratorListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { + return !page.mialr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { + return page.mialr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { + if page.mialr.IsEmpty() { + return nil + } + return *page.mialr.Value +} + +// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. +func NewManagedInstanceAdministratorListResultPage(getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { + return ManagedInstanceAdministratorListResultPage{fn: getNextPage} +} + +// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. +type ManagedInstanceAdministratorProperties struct { + // AdministratorType - Type of the managed instance administrator. + AdministratorType *string `json:"administratorType,omitempty"` + // Login - Login name of the managed instance administrator. + Login *string `json:"login,omitempty"` + // Sid - SID (object ID) of the managed instance administrator. + Sid *uuid.UUID `json:"sid,omitempty"` + // TenantID - Tenant ID of the managed instance administrator. + TenantID *uuid.UUID `json:"tenantId,omitempty"` +} + +// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) Result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { + mia, err = client.CreateOrUpdateResponder(mia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstanceAdministratorsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstanceAdministratorsDeleteFuture) Result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // ManagedInstanceListResult a list of managed instances. type ManagedInstanceListResult struct { autorest.Response `json:"-"` @@ -10912,7 +11216,7 @@ type ServerBlobAuditingPolicyProperties struct { // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. // // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. // Note that for server level audit you should use the 'master' database as {databaseName}. @@ -12518,17 +12822,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku the resource model definition representing SKU +// Sku an ARM Resource SKU. type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. Tier *string `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + // Size - Size of the particular SKU Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + // Capacity - Capacity of the particular SKU. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go index 19253bc7bcd3..5813776a86e3 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/sqlapi/interfaces.go @@ -269,6 +269,7 @@ type EncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) + Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) } var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) @@ -292,7 +293,6 @@ type ManagedInstancesClientAPI interface { Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) } @@ -578,6 +578,16 @@ type SensitivityLabelsClientAPI interface { var _ SensitivityLabelsClientAPI = (*sql.SensitivityLabelsClient)(nil) +// ManagedInstanceAdministratorsClientAPI contains the set of methods on the ManagedInstanceAdministratorsClient type. +type ManagedInstanceAdministratorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string, parameters sql.ManagedInstanceAdministrator) (result sql.ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result sql.ManagedInstanceAdministratorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName string) (result sql.ManagedInstanceAdministrator, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministratorListResultPage, err error) +} + +var _ ManagedInstanceAdministratorsClientAPI = (*sql.ManagedInstanceAdministratorsClient)(nil) + // ServerAutomaticTuningClientAPI contains the set of methods on the ServerAutomaticTuningClient type. type ServerAutomaticTuningClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAutomaticTuning, err error) diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go index cf433d5a1242..4f0f12f184f1 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go @@ -321,3 +321,81 @@ func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceComplete(c result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) return } + +// Revalidate revalidates an existing encryption protector. +// 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 ManagedInstanceEncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.Revalidate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevalidatePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") + return + } + + result, err = client.RevalidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") + return + } + + return +} + +// RevalidatePreparer prepares the Revalidate request. +func (client ManagedInstanceEncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "encryptionProtectorName": autorest.Encode("path", "current"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevalidateSender sends the Revalidate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceEncryptionProtectorsClient) RevalidateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RevalidateResponder handles the response to the Revalidate request. The method always +// closes the http.Response Body. +func (client ManagedInstanceEncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go index 47a9a57126e2..55481992c85a 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go @@ -148,51 +148,53 @@ func PossibleDatabaseReadScaleValues() []DatabaseReadScale { type DatabaseStatus string const ( - // AutoClosed ... - AutoClosed DatabaseStatus = "AutoClosed" - // Copying ... - Copying DatabaseStatus = "Copying" - // Creating ... - Creating DatabaseStatus = "Creating" - // EmergencyMode ... - EmergencyMode DatabaseStatus = "EmergencyMode" - // Inaccessible ... - Inaccessible DatabaseStatus = "Inaccessible" - // Offline ... - Offline DatabaseStatus = "Offline" - // OfflineChangingDwPerformanceTiers ... - OfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" - // OfflineSecondary ... - OfflineSecondary DatabaseStatus = "OfflineSecondary" - // Online ... - Online DatabaseStatus = "Online" - // OnlineChangingDwPerformanceTiers ... - OnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" - // Paused ... - Paused DatabaseStatus = "Paused" - // Pausing ... - Pausing DatabaseStatus = "Pausing" - // Recovering ... - Recovering DatabaseStatus = "Recovering" - // RecoveryPending ... - RecoveryPending DatabaseStatus = "RecoveryPending" - // Restoring ... - Restoring DatabaseStatus = "Restoring" - // Resuming ... - Resuming DatabaseStatus = "Resuming" - // Scaling ... - Scaling DatabaseStatus = "Scaling" - // Shutdown ... - Shutdown DatabaseStatus = "Shutdown" - // Standby ... - Standby DatabaseStatus = "Standby" - // Suspect ... - Suspect DatabaseStatus = "Suspect" + // DatabaseStatusAutoClosed ... + DatabaseStatusAutoClosed DatabaseStatus = "AutoClosed" + // DatabaseStatusCopying ... + DatabaseStatusCopying DatabaseStatus = "Copying" + // DatabaseStatusCreating ... + DatabaseStatusCreating DatabaseStatus = "Creating" + // DatabaseStatusDisabled ... + DatabaseStatusDisabled DatabaseStatus = "Disabled" + // DatabaseStatusEmergencyMode ... + DatabaseStatusEmergencyMode DatabaseStatus = "EmergencyMode" + // DatabaseStatusInaccessible ... + DatabaseStatusInaccessible DatabaseStatus = "Inaccessible" + // DatabaseStatusOffline ... + DatabaseStatusOffline DatabaseStatus = "Offline" + // DatabaseStatusOfflineChangingDwPerformanceTiers ... + DatabaseStatusOfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" + // DatabaseStatusOfflineSecondary ... + DatabaseStatusOfflineSecondary DatabaseStatus = "OfflineSecondary" + // DatabaseStatusOnline ... + DatabaseStatusOnline DatabaseStatus = "Online" + // DatabaseStatusOnlineChangingDwPerformanceTiers ... + DatabaseStatusOnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" + // DatabaseStatusPaused ... + DatabaseStatusPaused DatabaseStatus = "Paused" + // DatabaseStatusPausing ... + DatabaseStatusPausing DatabaseStatus = "Pausing" + // DatabaseStatusRecovering ... + DatabaseStatusRecovering DatabaseStatus = "Recovering" + // DatabaseStatusRecoveryPending ... + DatabaseStatusRecoveryPending DatabaseStatus = "RecoveryPending" + // DatabaseStatusRestoring ... + DatabaseStatusRestoring DatabaseStatus = "Restoring" + // DatabaseStatusResuming ... + DatabaseStatusResuming DatabaseStatus = "Resuming" + // DatabaseStatusScaling ... + DatabaseStatusScaling DatabaseStatus = "Scaling" + // DatabaseStatusShutdown ... + DatabaseStatusShutdown DatabaseStatus = "Shutdown" + // DatabaseStatusStandby ... + DatabaseStatusStandby DatabaseStatus = "Standby" + // DatabaseStatusSuspect ... + DatabaseStatusSuspect DatabaseStatus = "Suspect" ) // PossibleDatabaseStatusValues returns an array of possible values for the DatabaseStatus const type. func PossibleDatabaseStatusValues() []DatabaseStatus { - return []DatabaseStatus{AutoClosed, Copying, Creating, EmergencyMode, Inaccessible, Offline, OfflineChangingDwPerformanceTiers, OfflineSecondary, Online, OnlineChangingDwPerformanceTiers, Paused, Pausing, Recovering, RecoveryPending, Restoring, Resuming, Scaling, Shutdown, Standby, Suspect} + return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusSuspect} } // ElasticPoolLicenseType enumerates the values for elastic pool license type. @@ -1289,7 +1291,7 @@ type DatabaseProperties struct { ElasticPoolID *string `json:"elasticPoolId,omitempty"` // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // Status - READ-ONLY; The status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', 'OnlineChangingDwPerformanceTiers' + // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' Status DatabaseStatus `json:"status,omitempty"` // DatabaseID - READ-ONLY; The ID of the database. DatabaseID *uuid.UUID `json:"databaseId,omitempty"` @@ -1325,14 +1327,20 @@ 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 - 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 - 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 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 *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"` // 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 *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"` } // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -3477,6 +3485,29 @@ func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) Result(cl return } +// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) Result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") + return + } + ar.Response = future.Response() + return +} + // ManagedInstanceFamilyCapability the managed server family capability. type ManagedInstanceFamilyCapability struct { // Name - READ-ONLY; Family name. @@ -4174,17 +4205,17 @@ type ServiceObjectiveCapability struct { Reason *string `json:"reason,omitempty"` } -// Sku the resource model definition representing SKU +// Sku an ARM Resource SKU. type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. Tier *string `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + // Size - Size of the particular SKU Size *string `json:"size,omitempty"` // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + // Capacity - Capacity of the particular SKU. Capacity *int32 `json:"capacity,omitempty"` } diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go index aa93c1ca8a3f..9b696e175f46 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go @@ -164,6 +164,7 @@ type ManagedInstanceEncryptionProtectorsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceEncryptionProtector) (result sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtector, err error) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultPage, err error) + Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) } var _ ManagedInstanceEncryptionProtectorsClientAPI = (*sql.ManagedInstanceEncryptionProtectorsClient)(nil)