Added vendor dependency to github.com/Azure/azure-sdk-for-go/arm/sql

This commit is contained in:
Dominik Lekse 2017-04-30 11:42:02 +02:00
parent 15704cc6ee
commit f17c5ee664
8 changed files with 3386 additions and 0 deletions

View File

@ -0,0 +1,59 @@
// Package sql implements the Azure ARM Sql service API version 2014-04-01.
//
// Provides create, read, update and delete functionality for Azure SQL
// resources including servers, databases, elastic pools, recommendations,
// operations, and usage metrics.
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// APIVersion is the version of the Sql
APIVersion = "2014-04-01"
// DefaultBaseURI is the default URI used for the service Sql
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Sql.
type ManagementClient struct {
autorest.Client
BaseURI string
APIVersion string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
APIVersion: APIVersion,
SubscriptionID: subscriptionID,
}
}

View File

@ -0,0 +1,934 @@
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// DatabasesClient is the provides create, read, update and delete
// functionality for Azure SQL resources including servers, databases,
// elastic pools, recommendations, operations, and usage metrics.
type DatabasesClient struct {
ManagementClient
}
// NewDatabasesClient creates an instance of the DatabasesClient client.
func NewDatabasesClient(subscriptionID string) DatabasesClient {
return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient
// client.
func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient {
return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates a new Azure SQL database or updates an existing
// Azure SQL database. Location is a required property in the request body,
// and it must be the same as the location of the SQL server. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database to be operated on (updated or
// created). parameters is the required parameters for creating or updating a
// database.
func (client DatabasesClient) CreateOrUpdate(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client DatabasesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// CreateOrUpdateTransparentDataEncryptionConfiguration creates or updates an
// Azure SQL Database Transparent Data Encryption Operation.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database for which setting the Transparent
// Data Encryption applies. parameters is the required parameters for
// creating or updating transparent data encryption.
func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) {
req, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure responding to request")
}
return
}
// CreateOrUpdateTransparentDataEncryptionConfigurationPreparer prepares the CreateOrUpdateTransparentDataEncryptionConfiguration request.
func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateTransparentDataEncryptionConfigurationSender sends the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateTransparentDataEncryptionConfigurationResponder handles the response to the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method always
// closes the http.Response Body.
func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes an Azure SQL database.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database to be deleted.
func (client DatabasesClient) Delete(resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client DatabasesClient) DeletePreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets information about an Azure SQL database.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database to be retrieved. expand is the comma
// separated list of child objects to expand in the response. Possible
// properties: serviceTierAdvisors, upgradeHint, transparentDataEncryption.
func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) {
req, err := client.GetPreparer(resourceGroupName, serverName, databaseName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client DatabasesClient) GetPreparer(resourceGroupName string, serverName string, databaseName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetServiceTierAdvisor gets information about a service tier advisor.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of database. serviceTierAdvisorName is the name of service
// tier advisor.
func (client DatabasesClient) GetServiceTierAdvisor(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) {
req, err := client.GetServiceTierAdvisorPreparer(resourceGroupName, serverName, databaseName, serviceTierAdvisorName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", nil, "Failure preparing request")
}
resp, err := client.GetServiceTierAdvisorSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure sending request")
}
result, err = client.GetServiceTierAdvisorResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure responding to request")
}
return
}
// GetServiceTierAdvisorPreparer prepares the GetServiceTierAdvisor request.
func (client DatabasesClient) GetServiceTierAdvisorPreparer(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"serviceTierAdvisorName": autorest.Encode("path", serviceTierAdvisorName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetServiceTierAdvisorSender sends the GetServiceTierAdvisor request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) GetServiceTierAdvisorSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetServiceTierAdvisorResponder handles the response to the GetServiceTierAdvisor request. The method always
// closes the http.Response Body.
func (client DatabasesClient) GetServiceTierAdvisorResponder(resp *http.Response) (result ServiceTierAdvisor, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetTransparentDataEncryptionConfiguration gets an Azure SQL Database
// Transparent Data Encryption Response.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database for which the Transparent Data
// Encryption applies.
func (client DatabasesClient) GetTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) {
req, err := client.GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", nil, "Failure preparing request")
}
resp, err := client.GetTransparentDataEncryptionConfigurationSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure sending request")
}
result, err = client.GetTransparentDataEncryptionConfigurationResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure responding to request")
}
return
}
// GetTransparentDataEncryptionConfigurationPreparer prepares the GetTransparentDataEncryptionConfiguration request.
func (client DatabasesClient) GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetTransparentDataEncryptionConfigurationSender sends the GetTransparentDataEncryptionConfiguration request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) GetTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetTransparentDataEncryptionConfigurationResponder handles the response to the GetTransparentDataEncryptionConfiguration request. The method always
// closes the http.Response Body.
func (client DatabasesClient) GetTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByServer returns information about an Azure SQL database.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client DatabasesClient) ListByServer(resourceGroupName string, serverName string) (result DatabaseListResult, err error) {
req, err := client.ListByServerPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request")
}
resp, err := client.ListByServerSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request")
}
result, err = client.ListByServerResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request")
}
return
}
// ListByServerPreparer prepares the ListByServer request.
func (client DatabasesClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByServerSender sends the ListByServer request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByServerResponder handles the response to the ListByServer request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListRestorePoints returns a list of Azure SQL database restore points.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database from which to retrieve available
// restore points.
func (client DatabasesClient) ListRestorePoints(resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) {
req, err := client.ListRestorePointsPreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", nil, "Failure preparing request")
}
resp, err := client.ListRestorePointsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure sending request")
}
result, err = client.ListRestorePointsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure responding to request")
}
return
}
// ListRestorePointsPreparer prepares the ListRestorePoints request.
func (client DatabasesClient) ListRestorePointsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListRestorePointsSender sends the ListRestorePoints request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ListRestorePointsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListRestorePointsResponder handles the response to the ListRestorePoints request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ListRestorePointsResponder(resp *http.Response) (result RestorePointListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListServiceTierAdvisors returns information about service tier advisors for
// specified database.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of database.
func (client DatabasesClient) ListServiceTierAdvisors(resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) {
req, err := client.ListServiceTierAdvisorsPreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", nil, "Failure preparing request")
}
resp, err := client.ListServiceTierAdvisorsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure sending request")
}
result, err = client.ListServiceTierAdvisorsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure responding to request")
}
return
}
// ListServiceTierAdvisorsPreparer prepares the ListServiceTierAdvisors request.
func (client DatabasesClient) ListServiceTierAdvisorsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListServiceTierAdvisorsSender sends the ListServiceTierAdvisors request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ListServiceTierAdvisorsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListServiceTierAdvisorsResponder handles the response to the ListServiceTierAdvisors request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ListServiceTierAdvisorsResponder(resp *http.Response) (result ServiceTierAdvisorListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListTransparentDataEncryptionActivity returns an Azure SQL Database
// Transparent Data Encryption Activity Response.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database for which the Transparent Data
// Encryption applies.
func (client DatabasesClient) ListTransparentDataEncryptionActivity(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) {
req, err := client.ListTransparentDataEncryptionActivityPreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", nil, "Failure preparing request")
}
resp, err := client.ListTransparentDataEncryptionActivitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure sending request")
}
result, err = client.ListTransparentDataEncryptionActivityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure responding to request")
}
return
}
// ListTransparentDataEncryptionActivityPreparer prepares the ListTransparentDataEncryptionActivity request.
func (client DatabasesClient) ListTransparentDataEncryptionActivityPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListTransparentDataEncryptionActivitySender sends the ListTransparentDataEncryptionActivity request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ListTransparentDataEncryptionActivitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListTransparentDataEncryptionActivityResponder handles the response to the ListTransparentDataEncryptionActivity request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ListTransparentDataEncryptionActivityResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListUsages returns information about Azure SQL database usages.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL database.
func (client DatabasesClient) ListUsages(resourceGroupName string, serverName string, databaseName string) (result DatabaseMetricListResult, err error) {
req, err := client.ListUsagesPreparer(resourceGroupName, serverName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", nil, "Failure preparing request")
}
resp, err := client.ListUsagesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure sending request")
}
result, err = client.ListUsagesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure responding to request")
}
return
}
// ListUsagesPreparer prepares the ListUsages request.
func (client DatabasesClient) ListUsagesPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListUsagesSender sends the ListUsages request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ListUsagesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListUsagesResponder handles the response to the ListUsages request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ListUsagesResponder(resp *http.Response) (result DatabaseMetricListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// PauseDataWarehouse pause an Azure SQL Data Warehouse database. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL Data Warehouse database to pause.
func (client DatabasesClient) PauseDataWarehouse(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.PauseDataWarehousePreparer(resourceGroupName, serverName, databaseName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", nil, "Failure preparing request")
}
resp, err := client.PauseDataWarehouseSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", resp, "Failure sending request")
}
result, err = client.PauseDataWarehouseResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", resp, "Failure responding to request")
}
return
}
// PauseDataWarehousePreparer prepares the PauseDataWarehouse request.
func (client DatabasesClient) PauseDataWarehousePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// PauseDataWarehouseSender sends the PauseDataWarehouse request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) PauseDataWarehouseSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// PauseDataWarehouseResponder handles the response to the PauseDataWarehouse request. The method always
// closes the http.Response Body.
func (client DatabasesClient) PauseDataWarehouseResponder(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
}
// ResumeDataWarehouse resume an Azure SQL Data Warehouse database. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. databaseName
// is the name of the Azure SQL Data Warehouse database to resume.
func (client DatabasesClient) ResumeDataWarehouse(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ResumeDataWarehousePreparer(resourceGroupName, serverName, databaseName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", nil, "Failure preparing request")
}
resp, err := client.ResumeDataWarehouseSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", resp, "Failure sending request")
}
result, err = client.ResumeDataWarehouseResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", resp, "Failure responding to request")
}
return
}
// ResumeDataWarehousePreparer prepares the ResumeDataWarehouse request.
func (client DatabasesClient) ResumeDataWarehousePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// ResumeDataWarehouseSender sends the ResumeDataWarehouse request. The method will close the
// http.Response Body if it receives an error.
func (client DatabasesClient) ResumeDataWarehouseSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ResumeDataWarehouseResponder handles the response to the ResumeDataWarehouse request. The method always
// closes the http.Response Body.
func (client DatabasesClient) ResumeDataWarehouseResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}

View File

@ -0,0 +1,582 @@
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ElasticPoolsClient is the provides create, read, update and delete
// functionality for Azure SQL resources including servers, databases,
// elastic pools, recommendations, operations, and usage metrics.
type ElasticPoolsClient struct {
ManagementClient
}
// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client.
func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient {
return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewElasticPoolsClientWithBaseURI creates an instance of the
// ElasticPoolsClient client.
func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient {
return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates a new Azure SQL elastic pool or updates an existing
// Azure SQL elastic pool. This method may poll for completion. Polling can
// be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool to be operated
// on (Updated or created). parameters is the required parameters for
// creating or updating an Elastic Pool.
func (client ElasticPoolsClient) CreateOrUpdate(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, elasticPoolName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ElasticPoolsClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Delete deletes the Azure SQL elastic pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool to be deleted.
func (client ElasticPoolsClient) Delete(resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, serverName, elasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ElasticPoolsClient) DeletePreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets information about an Azure SQL elastic pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved.
func (client ElasticPoolsClient) Get(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) {
req, err := client.GetPreparer(resourceGroupName, serverName, elasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetDatabase gets information about an Azure SQL database inside of an Azure
// SQL elastic pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved.
// databaseName is the name of the Azure SQL database to be retrieved.
func (client ElasticPoolsClient) GetDatabase(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) {
req, err := client.GetDatabasePreparer(resourceGroupName, serverName, elasticPoolName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", nil, "Failure preparing request")
}
resp, err := client.GetDatabaseSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure sending request")
}
result, err = client.GetDatabaseResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure responding to request")
}
return
}
// GetDatabasePreparer prepares the GetDatabase request.
func (client ElasticPoolsClient) GetDatabasePreparer(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetDatabaseSender sends the GetDatabase request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) GetDatabaseSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetDatabaseResponder handles the response to the GetDatabase request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) GetDatabaseResponder(resp *http.Response) (result Database, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListActivity returns information about Azure SQL elastic pool activities.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool for which to get
// the current activity.
func (client ElasticPoolsClient) ListActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) {
req, err := client.ListActivityPreparer(resourceGroupName, serverName, elasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", nil, "Failure preparing request")
}
resp, err := client.ListActivitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure sending request")
}
result, err = client.ListActivityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure responding to request")
}
return
}
// ListActivityPreparer prepares the ListActivity request.
func (client ElasticPoolsClient) ListActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListActivitySender sends the ListActivity request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) ListActivitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListActivityResponder handles the response to the ListActivity request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) ListActivityResponder(resp *http.Response) (result ElasticPoolActivityListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByServer returns information about Azure SQL elastic pools.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) {
req, err := client.ListByServerPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request")
}
resp, err := client.ListByServerSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request")
}
result, err = client.ListByServerResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request")
}
return
}
// ListByServerPreparer prepares the ListByServer request.
func (client ElasticPoolsClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByServerSender sends the ListByServer request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByServerResponder handles the response to the ListByServer request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListDatabaseActivity returns information about activity on Azure SQL
// databases inside of an Azure SQL elastic pool.
//
// elasticPoolName is the name of the Azure SQL Elastic Pool.
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ElasticPoolsClient) ListDatabaseActivity(elasticPoolName string, resourceGroupName string, serverName string) (result ElasticPoolDatabaseActivityListResult, err error) {
req, err := client.ListDatabaseActivityPreparer(elasticPoolName, resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", nil, "Failure preparing request")
}
resp, err := client.ListDatabaseActivitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure sending request")
}
result, err = client.ListDatabaseActivityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure responding to request")
}
return
}
// ListDatabaseActivityPreparer prepares the ListDatabaseActivity request.
func (client ElasticPoolsClient) ListDatabaseActivityPreparer(elasticPoolName string, resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListDatabaseActivitySender sends the ListDatabaseActivity request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) ListDatabaseActivitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListDatabaseActivityResponder handles the response to the ListDatabaseActivity request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) ListDatabaseActivityResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListDatabases returns information about an Azure SQL database inside of an
// Azure SQL elastic pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved.
func (client ElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) {
req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, elasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", nil, "Failure preparing request")
}
resp, err := client.ListDatabasesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure sending request")
}
result, err = client.ListDatabasesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure responding to request")
}
return
}
// ListDatabasesPreparer prepares the ListDatabases request.
func (client ElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"elasticPoolName": autorest.Encode("path", elasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListDatabasesSender sends the ListDatabases request. The method will close the
// http.Response Body if it receives an error.
func (client ElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListDatabasesResponder handles the response to the ListDatabases request. The method always
// closes the http.Response Body.
func (client ElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -0,0 +1,810 @@
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/satori/uuid"
)
// CreateMode enumerates the values for create mode.
type CreateMode string
const (
// Copy specifies the copy state for create mode.
Copy CreateMode = "Copy"
// Default specifies the default state for create mode.
Default CreateMode = "Default"
// NonReadableSecondary specifies the non readable secondary state for
// create mode.
NonReadableSecondary CreateMode = "NonReadableSecondary"
// OnlineSecondary specifies the online secondary state for create mode.
OnlineSecondary CreateMode = "OnlineSecondary"
// PointInTimeRestore specifies the point in time restore state for create
// mode.
PointInTimeRestore CreateMode = "PointInTimeRestore"
// Recovery specifies the recovery state for create mode.
Recovery CreateMode = "Recovery"
// Restore specifies the restore state for create mode.
Restore CreateMode = "Restore"
)
// DatabaseEditions enumerates the values for database editions.
type DatabaseEditions string
const (
// Basic specifies the basic state for database editions.
Basic DatabaseEditions = "Basic"
// Business specifies the business state for database editions.
Business DatabaseEditions = "Business"
// DataWarehouse specifies the data warehouse state for database editions.
DataWarehouse DatabaseEditions = "DataWarehouse"
// Free specifies the free state for database editions.
Free DatabaseEditions = "Free"
// Premium specifies the premium state for database editions.
Premium DatabaseEditions = "Premium"
// Standard specifies the standard state for database editions.
Standard DatabaseEditions = "Standard"
// Stretch specifies the stretch state for database editions.
Stretch DatabaseEditions = "Stretch"
// Web specifies the web state for database editions.
Web DatabaseEditions = "Web"
)
// ElasticPoolEditions enumerates the values for elastic pool editions.
type ElasticPoolEditions string
const (
// ElasticPoolEditionsBasic specifies the elastic pool editions basic
// state for elastic pool editions.
ElasticPoolEditionsBasic ElasticPoolEditions = "Basic"
// ElasticPoolEditionsPremium specifies the elastic pool editions premium
// state for elastic pool editions.
ElasticPoolEditionsPremium ElasticPoolEditions = "Premium"
// ElasticPoolEditionsStandard specifies the elastic pool editions
// standard state for elastic pool editions.
ElasticPoolEditionsStandard ElasticPoolEditions = "Standard"
)
// ElasticPoolState enumerates the values for elastic pool state.
type ElasticPoolState string
const (
// Creating specifies the creating state for elastic pool state.
Creating ElasticPoolState = "Creating"
// Disabled specifies the disabled state for elastic pool state.
Disabled ElasticPoolState = "Disabled"
// Ready specifies the ready state for elastic pool state.
Ready ElasticPoolState = "Ready"
)
// RecommendedIndexActions enumerates the values for recommended index actions.
type RecommendedIndexActions string
const (
// Create specifies the create state for recommended index actions.
Create RecommendedIndexActions = "Create"
// Drop specifies the drop state for recommended index actions.
Drop RecommendedIndexActions = "Drop"
// Rebuild specifies the rebuild state for recommended index actions.
Rebuild RecommendedIndexActions = "Rebuild"
)
// RecommendedIndexStates enumerates the values for recommended index states.
type RecommendedIndexStates string
const (
// Active specifies the active state for recommended index states.
Active RecommendedIndexStates = "Active"
// Blocked specifies the blocked state for recommended index states.
Blocked RecommendedIndexStates = "Blocked"
// Executing specifies the executing state for recommended index states.
Executing RecommendedIndexStates = "Executing"
// Expired specifies the expired state for recommended index states.
Expired RecommendedIndexStates = "Expired"
// Ignored specifies the ignored state for recommended index states.
Ignored RecommendedIndexStates = "Ignored"
// Pending specifies the pending state for recommended index states.
Pending RecommendedIndexStates = "Pending"
// PendingRevert specifies the pending revert state for recommended index
// states.
PendingRevert RecommendedIndexStates = "Pending Revert"
// Reverted specifies the reverted state for recommended index states.
Reverted RecommendedIndexStates = "Reverted"
// Reverting specifies the reverting state for recommended index states.
Reverting RecommendedIndexStates = "Reverting"
// Success specifies the success state for recommended index states.
Success RecommendedIndexStates = "Success"
// Verifying specifies the verifying state for recommended index states.
Verifying RecommendedIndexStates = "Verifying"
)
// RecommendedIndexTypes enumerates the values for recommended index types.
type RecommendedIndexTypes string
const (
// CLUSTERED specifies the clustered state for recommended index types.
CLUSTERED RecommendedIndexTypes = "CLUSTERED"
// CLUSTEREDCOLUMNSTORE specifies the clusteredcolumnstore state for
// recommended index types.
CLUSTEREDCOLUMNSTORE RecommendedIndexTypes = "CLUSTERED COLUMNSTORE"
// COLUMNSTORE specifies the columnstore state for recommended index types.
COLUMNSTORE RecommendedIndexTypes = "COLUMNSTORE"
// NONCLUSTERED specifies the nonclustered state for recommended index
// types.
NONCLUSTERED RecommendedIndexTypes = "NONCLUSTERED"
)
// RestorePointTypes enumerates the values for restore point types.
type RestorePointTypes string
const (
// CONTINUOUS specifies the continuous state for restore point types.
CONTINUOUS RestorePointTypes = "CONTINUOUS"
// DISCRETE specifies the discrete state for restore point types.
DISCRETE RestorePointTypes = "DISCRETE"
)
// ServerVersion enumerates the values for server version.
type ServerVersion string
const (
// OneTwoFullStopZero specifies the one two full stop zero state for
// server version.
OneTwoFullStopZero ServerVersion = "12.0"
// TwoFullStopZero specifies the two full stop zero state for server
// version.
TwoFullStopZero ServerVersion = "2.0"
)
// ServiceObjectiveName enumerates the values for service objective name.
type ServiceObjectiveName string
const (
// ServiceObjectiveNameBasic specifies the service objective name basic
// state for service objective name.
ServiceObjectiveNameBasic ServiceObjectiveName = "Basic"
// ServiceObjectiveNameP1 specifies the service objective name p1 state
// for service objective name.
ServiceObjectiveNameP1 ServiceObjectiveName = "P1"
// ServiceObjectiveNameP2 specifies the service objective name p2 state
// for service objective name.
ServiceObjectiveNameP2 ServiceObjectiveName = "P2"
// ServiceObjectiveNameP3 specifies the service objective name p3 state
// for service objective name.
ServiceObjectiveNameP3 ServiceObjectiveName = "P3"
// ServiceObjectiveNameS0 specifies the service objective name s0 state
// for service objective name.
ServiceObjectiveNameS0 ServiceObjectiveName = "S0"
// ServiceObjectiveNameS1 specifies the service objective name s1 state
// for service objective name.
ServiceObjectiveNameS1 ServiceObjectiveName = "S1"
// ServiceObjectiveNameS2 specifies the service objective name s2 state
// for service objective name.
ServiceObjectiveNameS2 ServiceObjectiveName = "S2"
// ServiceObjectiveNameS3 specifies the service objective name s3 state
// for service objective name.
ServiceObjectiveNameS3 ServiceObjectiveName = "S3"
)
// TableType enumerates the values for table type.
type TableType string
const (
// BaseTable specifies the base table state for table type.
BaseTable TableType = "BaseTable"
// View specifies the view state for table type.
View TableType = "View"
)
// TargetDatabaseEditions enumerates the values for target database editions.
type TargetDatabaseEditions string
const (
// TargetDatabaseEditionsBasic specifies the target database editions
// basic state for target database editions.
TargetDatabaseEditionsBasic TargetDatabaseEditions = "Basic"
// TargetDatabaseEditionsDataWarehouse specifies the target database
// editions data warehouse state for target database editions.
TargetDatabaseEditionsDataWarehouse TargetDatabaseEditions = "DataWarehouse"
// TargetDatabaseEditionsFree specifies the target database editions free
// state for target database editions.
TargetDatabaseEditionsFree TargetDatabaseEditions = "Free"
// TargetDatabaseEditionsPremium specifies the target database editions
// premium state for target database editions.
TargetDatabaseEditionsPremium TargetDatabaseEditions = "Premium"
// TargetDatabaseEditionsStandard specifies the target database editions
// standard state for target database editions.
TargetDatabaseEditionsStandard TargetDatabaseEditions = "Standard"
// TargetDatabaseEditionsStretch specifies the target database editions
// stretch state for target database editions.
TargetDatabaseEditionsStretch TargetDatabaseEditions = "Stretch"
)
// TargetElasticPoolEditions enumerates the values for target elastic pool
// editions.
type TargetElasticPoolEditions string
const (
// TargetElasticPoolEditionsBasic specifies the target elastic pool
// editions basic state for target elastic pool editions.
TargetElasticPoolEditionsBasic TargetElasticPoolEditions = "Basic"
// TargetElasticPoolEditionsPremium specifies the target elastic pool
// editions premium state for target elastic pool editions.
TargetElasticPoolEditionsPremium TargetElasticPoolEditions = "Premium"
// TargetElasticPoolEditionsStandard specifies the target elastic pool
// editions standard state for target elastic pool editions.
TargetElasticPoolEditionsStandard TargetElasticPoolEditions = "Standard"
)
// TransparentDataEncryptionActivityStates enumerates the values for
// transparent data encryption activity states.
type TransparentDataEncryptionActivityStates string
const (
// Decrypting specifies the decrypting state for transparent data
// encryption activity states.
Decrypting TransparentDataEncryptionActivityStates = "Decrypting"
// Encrypting specifies the encrypting state for transparent data
// encryption activity states.
Encrypting TransparentDataEncryptionActivityStates = "Encrypting"
)
// TransparentDataEncryptionStates enumerates the values for transparent data
// encryption states.
type TransparentDataEncryptionStates string
const (
// TransparentDataEncryptionStatesDisabled specifies the transparent data
// encryption states disabled state for transparent data encryption
// states.
TransparentDataEncryptionStatesDisabled TransparentDataEncryptionStates = "Disabled"
// TransparentDataEncryptionStatesEnabled specifies the transparent data
// encryption states enabled state for transparent data encryption states.
TransparentDataEncryptionStatesEnabled TransparentDataEncryptionStates = "Enabled"
)
// Column is represents an Azure SQL Database table column.
type Column struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ColumnProperties `json:"properties,omitempty"`
}
// ColumnProperties is represents the properties of an Azure SQL Database
// table column.
type ColumnProperties struct {
ColumnType *string `json:"columnType,omitempty"`
}
// Database is represents an Azure SQL Database.
type Database struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*DatabaseProperties `json:"properties,omitempty"`
}
// DatabaseListResult is represents the response to a List Azure SQL Database
// request.
type DatabaseListResult struct {
autorest.Response `json:"-"`
Value *[]Database `json:"value,omitempty"`
}
// DatabaseMetric is represents Azure SQL Database metrics.
type DatabaseMetric struct {
ResourceName *string `json:"resourceName,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
CurrentValue *float64 `json:"currentValue,omitempty"`
Limit *float64 `json:"limit,omitempty"`
Unit *string `json:"unit,omitempty"`
NextResetTime *date.Time `json:"nextResetTime,omitempty"`
}
// DatabaseMetricListResult is represents the response to a List Azure SQL
// Database metrics request.
type DatabaseMetricListResult struct {
autorest.Response `json:"-"`
Value *[]DatabaseMetric `json:"value,omitempty"`
}
// DatabaseProperties is represents the properties of an Azure SQL Database.
type DatabaseProperties struct {
Collation *string `json:"collation,omitempty"`
CreationDate *date.Time `json:"creationDate,omitempty"`
ContainmentState *int64 `json:"containmentState,omitempty"`
CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"`
DatabaseID *string `json:"databaseId,omitempty"`
EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
CreateMode CreateMode `json:"createMode,omitempty"`
SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"`
Edition DatabaseEditions `json:"edition,omitempty"`
MaxSizeBytes *string `json:"maxSizeBytes,omitempty"`
RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"`
RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"`
ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"`
Status *string `json:"status,omitempty"`
ElasticPoolName *string `json:"elasticPoolName,omitempty"`
DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"`
ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"`
UpgradeHint *UpgradeHint `json:"upgradeHint,omitempty"`
Schemas *[]Schema `json:"schemas,omitempty"`
TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"`
RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"`
}
// ElasticPool is represents an Azure SQL Database elastic pool.
type ElasticPool struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ElasticPoolProperties `json:"properties,omitempty"`
}
// ElasticPoolActivity is represents the activity on an Azure SQL Elastic Pool.
type ElasticPoolActivity struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ElasticPoolActivityProperties `json:"properties,omitempty"`
}
// ElasticPoolActivityListResult is represents the response to a List Azure
// SQL Elastic Pool Activity request.
type ElasticPoolActivityListResult struct {
autorest.Response `json:"-"`
Value *[]ElasticPoolActivity `json:"value,omitempty"`
}
// ElasticPoolActivityProperties is represents the properties of an Azure SQL
// Elastic Pool.
type ElasticPoolActivityProperties struct {
EndTime *date.Time `json:"endTime,omitempty"`
ErrorCode *int32 `json:"errorCode,omitempty"`
ErrorMessage *string `json:"errorMessage,omitempty"`
ErrorSeverity *int32 `json:"errorSeverity,omitempty"`
Operation *string `json:"operation,omitempty"`
OperationID *string `json:"operationId,omitempty"`
PercentComplete *int32 `json:"percentComplete,omitempty"`
RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"`
RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"`
RequestedDtu *int32 `json:"requestedDtu,omitempty"`
RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"`
RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"`
ElasticPoolName *string `json:"elasticPoolName,omitempty"`
ServerName *string `json:"serverName,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
State *string `json:"state,omitempty"`
}
// ElasticPoolDatabaseActivity is represents the activity on an Azure SQL
// Elastic Pool.
type ElasticPoolDatabaseActivity struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"`
}
// ElasticPoolDatabaseActivityListResult is represents the response to a List
// Azure SQL Elastic Pool Database Activity request.
type ElasticPoolDatabaseActivityListResult struct {
autorest.Response `json:"-"`
Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"`
}
// ElasticPoolDatabaseActivityProperties is represents the properties of an
// Azure SQL Elastic Pool Database Activity.
type ElasticPoolDatabaseActivityProperties struct {
DatabaseName *string `json:"databaseName,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
ErrorCode *int32 `json:"errorCode,omitempty"`
ErrorMessage *string `json:"errorMessage,omitempty"`
ErrorSeverity *int32 `json:"errorSeverity,omitempty"`
Operation *string `json:"operation,omitempty"`
OperationID *string `json:"operationId,omitempty"`
PercentComplete *int32 `json:"percentComplete,omitempty"`
RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"`
CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"`
CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"`
RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"`
ServerName *string `json:"serverName,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
State *string `json:"state,omitempty"`
}
// ElasticPoolListResult is represents the response to a List Azure SQL
// Elastic Pool request.
type ElasticPoolListResult struct {
autorest.Response `json:"-"`
Value *[]ElasticPool `json:"value,omitempty"`
}
// ElasticPoolProperties is represents the properties of an Azure SQL Elastic
// Pool.
type ElasticPoolProperties struct {
CreationDate *date.Time `json:"creationDate,omitempty"`
State ElasticPoolState `json:"state,omitempty"`
Edition ElasticPoolEditions `json:"edition,omitempty"`
Dtu *int32 `json:"dtu,omitempty"`
DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"`
DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"`
StorageMB *int32 `json:"storageMB,omitempty"`
}
// OperationImpact is represents impact of an operation, both in absolute and
// relative terms.
type OperationImpact struct {
Name *string `json:"name,omitempty"`
Unit *string `json:"unit,omitempty"`
ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"`
ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"`
}
// RecommendedDatabaseProperties is represents the properties of a recommended
// Azure SQL Database being upgraded.
type RecommendedDatabaseProperties struct {
Name *string `json:"Name,omitempty"`
TargetEdition TargetDatabaseEditions `json:"TargetEdition,omitempty"`
TargetServiceLevelObjective *string `json:"TargetServiceLevelObjective,omitempty"`
}
// RecommendedElasticPool is represents an Azure SQL Recommended Elastic Pool.
type RecommendedElasticPool struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*RecommendedElasticPoolProperties `json:"properties,omitempty"`
}
// RecommendedElasticPoolListMetricsResult is represents the response to a
// List Azure SQL Recommended Elastic Pool metrics request.
type RecommendedElasticPoolListMetricsResult struct {
autorest.Response `json:"-"`
Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"`
}
// RecommendedElasticPoolListResult is represents the response to a List Azure
// SQL Recommended Elastic Pool request.
type RecommendedElasticPoolListResult struct {
autorest.Response `json:"-"`
Value *[]RecommendedElasticPool `json:"value,omitempty"`
}
// RecommendedElasticPoolMetric is represents Azure SQL recommended elastic
// pool metric.
type RecommendedElasticPoolMetric struct {
DateTime *date.Time `json:"dateTime,omitempty"`
Dtu *float64 `json:"dtu,omitempty"`
SizeGB *float64 `json:"sizeGB,omitempty"`
}
// RecommendedElasticPoolProperties is represents the properties of an Azure
// SQL Recommended Elastic Pool.
type RecommendedElasticPoolProperties struct {
DatabaseEdition ElasticPoolEditions `json:"databaseEdition,omitempty"`
Dtu *float64 `json:"dtu,omitempty"`
DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"`
DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"`
StorageMB *float64 `json:"storageMB,omitempty"`
ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"`
ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"`
MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"`
MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"`
Databases *[]Database `json:"databases,omitempty"`
Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"`
}
// RecommendedIndex is represents an Azure SQL Database recommended index.
type RecommendedIndex struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*RecommendedIndexProperties `json:"properties,omitempty"`
}
// RecommendedIndexProperties is represents the properties of an Azure SQL
// Database recommended index.
type RecommendedIndexProperties struct {
Action RecommendedIndexActions `json:"action,omitempty"`
State RecommendedIndexStates `json:"state,omitempty"`
Created *date.Time `json:"created,omitempty"`
LastModified *date.Time `json:"lastModified,omitempty"`
IndexType RecommendedIndexTypes `json:"indexType,omitempty"`
Schema *string `json:"schema,omitempty"`
Table *string `json:"table,omitempty"`
Columns *[]string `json:"columns,omitempty"`
IncludedColumns *[]string `json:"includedColumns,omitempty"`
IndexScript *string `json:"indexScript,omitempty"`
EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"`
ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"`
}
// Resource is resource properties
type Resource struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// RestorePoint is represents an Azure SQL Database restore point.
type RestorePoint struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*RestorePointProperties `json:"properties,omitempty"`
}
// RestorePointListResult is represents the response to a List Azure SQL
// Database restore points request.
type RestorePointListResult struct {
autorest.Response `json:"-"`
Value *[]RestorePoint `json:"value,omitempty"`
}
// RestorePointProperties is represents the properties of an Azure SQL
// Database restore point.
type RestorePointProperties struct {
RestorePointType RestorePointTypes `json:"restorePointType,omitempty"`
RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"`
EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
}
// Schema is represents an Azure SQL Database schema.
type Schema struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*SchemaProperties `json:"properties,omitempty"`
}
// SchemaProperties is represents the properties of an Azure SQL Database
// schema.
type SchemaProperties struct {
Tables *[]Table `json:"tables,omitempty"`
}
// Server is represents an Azure SQL server.
type Server struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ServerProperties `json:"properties,omitempty"`
}
// ServerListResult is represents the response to a Get Azure SQL server
// request.
type ServerListResult struct {
autorest.Response `json:"-"`
Value *[]Server `json:"value,omitempty"`
}
// ServerMetric is represents Azure SQL server metrics.
type ServerMetric struct {
ResourceName *string `json:"resourceName,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
CurrentValue *float64 `json:"currentValue,omitempty"`
Limit *float64 `json:"limit,omitempty"`
Unit *string `json:"unit,omitempty"`
NextResetTime *date.Time `json:"nextResetTime,omitempty"`
}
// ServerMetricListResult is represents the response to a List Azure SQL
// server metrics request.
type ServerMetricListResult struct {
autorest.Response `json:"-"`
Value *[]ServerMetric `json:"value,omitempty"`
}
// ServerProperties is represents the properties of an Azure SQL server.
type ServerProperties struct {
FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
Version ServerVersion `json:"version,omitempty"`
AdministratorLogin *string `json:"administratorLogin,omitempty"`
AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
}
// ServiceObjective is represents an Azure SQL Database Service Objective.
type ServiceObjective struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
*ServiceObjectiveProperties `json:"properties,omitempty"`
}
// ServiceObjectiveListResult is represents the response to a Get Azure SQL
// Database Service Objectives request.
type ServiceObjectiveListResult struct {
autorest.Response `json:"-"`
Value *[]ServiceObjective `json:"value,omitempty"`
}
// ServiceObjectiveProperties is represents the properties of an Azure SQL
// Database Service Objective.
type ServiceObjectiveProperties struct {
ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"`
IsDefault *bool `json:"isDefault,omitempty"`
IsSystem *bool `json:"isSystem,omitempty"`
Description *string `json:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
// ServiceTierAdvisor is represents a Service Tier Advisor.
type ServiceTierAdvisor struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
*ServiceTierAdvisorProperties `json:"properties,omitempty"`
}
// ServiceTierAdvisorListResult is represents the response to a list service
// tier advisor request.
type ServiceTierAdvisorListResult struct {
autorest.Response `json:"-"`
Value *[]ServiceTierAdvisor `json:"value,omitempty"`
}
// ServiceTierAdvisorProperties is represents the properties of a Service Tier
// Advisor.
type ServiceTierAdvisorProperties struct {
ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"`
ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"`
ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"`
MinDtu *float64 `json:"minDtu,omitempty"`
AvgDtu *float64 `json:"avgDtu,omitempty"`
MaxDtu *float64 `json:"maxDtu,omitempty"`
MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"`
ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"`
CurrentServiceLevelObjective *uuid.UUID `json:"currentServiceLevelObjective,omitempty"`
CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"`
UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"`
UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"`
DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"`
DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"`
DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"`
DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"`
OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"`
OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"`
Confidence *float64 `json:"confidence,omitempty"`
}
// SloUsageMetric is represents a Slo Usage Metric.
type SloUsageMetric struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"`
ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"`
InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"`
}
// SubResource is subresource properties
type SubResource struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
}
// Table is represents an Azure SQL Database table.
type Table struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*TableProperties `json:"properties,omitempty"`
}
// TableProperties is represents the properties of an Azure SQL Database table.
type TableProperties struct {
TableType TableType `json:"tableType,omitempty"`
Columns *[]Column `json:"columns,omitempty"`
RecommendedIndexes *[]RecommendedIndex `json:"recommendedIndexes,omitempty"`
}
// TransparentDataEncryption is represents an Azure SQL Database Transparent
// Data Encryption .
type TransparentDataEncryption struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
*TransparentDataEncryptionProperties `json:"properties,omitempty"`
}
// TransparentDataEncryptionActivity is represents an Azure SQL Database
// Transparent Data Encryption Scan.
type TransparentDataEncryptionActivity struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
*TransparentDataEncryptionActivityProperties `json:"properties,omitempty"`
}
// TransparentDataEncryptionActivityListResult is represents the response to a
// List Azure SQL Database Transparent Data Encryption Activity request.
type TransparentDataEncryptionActivityListResult struct {
autorest.Response `json:"-"`
Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"`
}
// TransparentDataEncryptionActivityProperties is represents the properties of
// an Azure SQL Database Transparent Data Encryption Scan.
type TransparentDataEncryptionActivityProperties struct {
Status TransparentDataEncryptionActivityStates `json:"status,omitempty"`
PercentComplete *float64 `json:"percentComplete,omitempty"`
}
// TransparentDataEncryptionProperties is represents the properties of an
// Azure SQL Database Transparent Data Encryption.
type TransparentDataEncryptionProperties struct {
Status TransparentDataEncryptionStates `json:"status,omitempty"`
}
// UpgradeHint is represents a Upgrade Hint.
type UpgradeHint struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
TargetServiceLevelObjective *string `json:"targetServiceLevelObjective,omitempty"`
TargetServiceLevelObjectiveID *uuid.UUID `json:"targetServiceLevelObjectiveId,omitempty"`
}
// UpgradeRecommendedElasticPoolProperties is represents the properties of a
// Azure SQL Recommended Elastic Pool being upgraded.
type UpgradeRecommendedElasticPoolProperties struct {
Name *string `json:"Name,omitempty"`
Edition TargetElasticPoolEditions `json:"Edition,omitempty"`
Dtu *int32 `json:"Dtu,omitempty"`
StorageMb *int32 `json:"StorageMb,omitempty"`
DatabaseDtuMin *int32 `json:"DatabaseDtuMin,omitempty"`
DatabaseDtuMax *int32 `json:"DatabaseDtuMax,omitempty"`
DatabaseCollection *[]string `json:"DatabaseCollection,omitempty"`
IncludeAllDatabases *bool `json:"IncludeAllDatabases,omitempty"`
}

View File

@ -0,0 +1,380 @@
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// RecommendedElasticPoolsClient is the provides create, read, update and
// delete functionality for Azure SQL resources including servers, databases,
// elastic pools, recommendations, operations, and usage metrics.
type RecommendedElasticPoolsClient struct {
ManagementClient
}
// NewRecommendedElasticPoolsClient creates an instance of the
// RecommendedElasticPoolsClient client.
func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient {
return NewRecommendedElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewRecommendedElasticPoolsClientWithBaseURI creates an instance of the
// RecommendedElasticPoolsClient client.
func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient {
return RecommendedElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets information about an Azure SQL Recommended Elastic Pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// recommendedElasticPoolName is the name of the Azure SQL Recommended
// Elastic Pool to be retrieved.
func (client RecommendedElasticPoolsClient) Get(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) {
req, err := client.GetPreparer(resourceGroupName, serverName, recommendedElasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client RecommendedElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client RecommendedElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client RecommendedElasticPoolsClient) GetResponder(resp *http.Response) (result RecommendedElasticPool, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetDatabases gets information about an Azure SQL database inside of an
// Azure SQL Recommended Elastic Pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// recommendedElasticPoolName is the name of the Azure SQL Elastic Pool to be
// retrieved. databaseName is the name of the Azure SQL database to be
// retrieved.
func (client RecommendedElasticPoolsClient) GetDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) {
req, err := client.GetDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName, databaseName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", nil, "Failure preparing request")
}
resp, err := client.GetDatabasesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure sending request")
}
result, err = client.GetDatabasesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure responding to request")
}
return
}
// GetDatabasesPreparer prepares the GetDatabases request.
func (client RecommendedElasticPoolsClient) GetDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"databaseName": autorest.Encode("path", databaseName),
"recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetDatabasesSender sends the GetDatabases request. The method will close the
// http.Response Body if it receives an error.
func (client RecommendedElasticPoolsClient) GetDatabasesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetDatabasesResponder handles the response to the GetDatabases request. The method always
// closes the http.Response Body.
func (client RecommendedElasticPoolsClient) GetDatabasesResponder(resp *http.Response) (result Database, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List returns information about Azure SQL Recommended Elastic Pools.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client RecommendedElasticPoolsClient) List(resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client RecommendedElasticPoolsClient) ListPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client RecommendedElasticPoolsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client RecommendedElasticPoolsClient) ListResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListDatabases returns information about an Azure SQL database inside of an
// Azure SQL Recommended Elastic Pool.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// recommendedElasticPoolName is the name of the Azure SQL Recommended
// Elastic Pool to be retrieved.
func (client RecommendedElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) {
req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", nil, "Failure preparing request")
}
resp, err := client.ListDatabasesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure sending request")
}
result, err = client.ListDatabasesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure responding to request")
}
return
}
// ListDatabasesPreparer prepares the ListDatabases request.
func (client RecommendedElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListDatabasesSender sends the ListDatabases request. The method will close the
// http.Response Body if it receives an error.
func (client RecommendedElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListDatabasesResponder handles the response to the ListDatabases request. The method always
// closes the http.Response Body.
func (client RecommendedElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListMetrics returns information about an recommended elastic pool metrics.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// recommendedElasticPoolName is the name of the Azure SQL Recommended
// Elastic Pool to be retrieved.
func (client RecommendedElasticPoolsClient) ListMetrics(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) {
req, err := client.ListMetricsPreparer(resourceGroupName, serverName, recommendedElasticPoolName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request")
}
resp, err := client.ListMetricsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request")
}
result, err = client.ListMetricsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure responding to request")
}
return
}
// ListMetricsPreparer prepares the ListMetrics request.
func (client RecommendedElasticPoolsClient) ListMetricsPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListMetricsSender sends the ListMetrics request. The method will close the
// http.Response Body if it receives an error.
func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListMetricsResponder handles the response to the ListMetrics request. The method always
// closes the http.Response Body.
func (client RecommendedElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result RecommendedElasticPoolListMetricsResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -0,0 +1,553 @@
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 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ServersClient is the provides create, read, update and delete functionality
// for Azure SQL resources including servers, databases, elastic pools,
// recommendations, operations, and usage metrics.
type ServersClient struct {
ManagementClient
}
// NewServersClient creates an instance of the ServersClient client.
func NewServersClient(subscriptionID string) ServersClient {
return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewServersClientWithBaseURI creates an instance of the ServersClient client.
func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient {
return ServersClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates a new Azure SQL server.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server. parameters is
// the required parameters for creating or updating a server.
func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters Server) (result Server, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, parameters Server) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a SQL server.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ServersClient) Delete(resourceGroupName string, serverName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ServersClient) DeletePreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// GetByResourceGroup gets information about an Azure SQL server.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ServersClient) GetByResourceGroup(resourceGroupName string, serverName string) (result Server, err error) {
req, err := client.GetByResourceGroupPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", nil, "Failure preparing request")
}
resp, err := client.GetByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", resp, "Failure sending request")
}
result, err = client.GetByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", resp, "Failure responding to request")
}
return
}
// GetByResourceGroupPreparer prepares the GetByResourceGroup request.
func (client ServersClient) GetByResourceGroupPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetByResourceGroupSender sends the GetByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) GetByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetByResourceGroupResponder handles the response to the GetByResourceGroup request. The method always
// closes the http.Response Body.
func (client ServersClient) GetByResourceGroupResponder(resp *http.Response) (result Server, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetServiceObjective gets information about an Azure SQL database Service
// Objective.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
// serviceObjectiveName is the name of the service objective to retrieve.
func (client ServersClient) GetServiceObjective(resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) {
req, err := client.GetServiceObjectivePreparer(resourceGroupName, serverName, serviceObjectiveName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", nil, "Failure preparing request")
}
resp, err := client.GetServiceObjectiveSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure sending request")
}
result, err = client.GetServiceObjectiveResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure responding to request")
}
return
}
// GetServiceObjectivePreparer prepares the GetServiceObjective request.
func (client ServersClient) GetServiceObjectivePreparer(resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"serviceObjectiveName": autorest.Encode("path", serviceObjectiveName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetServiceObjectiveSender sends the GetServiceObjective request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) GetServiceObjectiveSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetServiceObjectiveResponder handles the response to the GetServiceObjective request. The method always
// closes the http.Response Body.
func (client ServersClient) GetServiceObjectiveResponder(resp *http.Response) (result ServiceObjective, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List returns information about an Azure SQL server.
func (client ServersClient) List() (result ServerListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ServersClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroup returns information about an Azure SQL server.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal.
func (client ServersClient) ListByResourceGroup(resourceGroupName string) (result ServerListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request")
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListServiceObjectives returns information about Azure SQL database Service
// Objectives.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ServersClient) ListServiceObjectives(resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) {
req, err := client.ListServiceObjectivesPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", nil, "Failure preparing request")
}
resp, err := client.ListServiceObjectivesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure sending request")
}
result, err = client.ListServiceObjectivesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure responding to request")
}
return
}
// ListServiceObjectivesPreparer prepares the ListServiceObjectives request.
func (client ServersClient) ListServiceObjectivesPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListServiceObjectivesSender sends the ListServiceObjectives request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) ListServiceObjectivesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListServiceObjectivesResponder handles the response to the ListServiceObjectives request. The method always
// closes the http.Response Body.
func (client ServersClient) ListServiceObjectivesResponder(resp *http.Response) (result ServiceObjectiveListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListUsages returns information about Azure SQL server usage.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. serverName is the name of the Azure SQL server.
func (client ServersClient) ListUsages(resourceGroupName string, serverName string) (result ServerMetricListResult, err error) {
req, err := client.ListUsagesPreparer(resourceGroupName, serverName)
if err != nil {
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", nil, "Failure preparing request")
}
resp, err := client.ListUsagesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure sending request")
}
result, err = client.ListUsagesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure responding to request")
}
return
}
// ListUsagesPreparer prepares the ListUsages request.
func (client ServersClient) ListUsagesPreparer(resourceGroupName string, serverName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serverName": autorest.Encode("path", serverName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListUsagesSender sends the ListUsages request. The method will close the
// http.Response Body if it receives an error.
func (client ServersClient) ListUsagesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListUsagesResponder handles the response to the ListUsages request. The method always
// closes the http.Response Body.
func (client ServersClient) ListUsagesResponder(resp *http.Response) (result ServerMetricListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -0,0 +1,60 @@
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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
const (
major = "8"
minor = "1"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "sql", "2014-04-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

8
vendor/vendor.json vendored
View File

@ -126,6 +126,14 @@
"version": "v8.1.0-beta",
"versionExact": "v8.1.0-beta"
},
{
"checksumSHA1": "xt50hkmkQR7XZOSWZGOaZZvsmxE=",
"path": "github.com/Azure/azure-sdk-for-go/arm/sql",
"revision": "ecf40e315d5ab0ca6d7b3b7f7fbb5c1577814813",
"revisionTime": "2017-03-02T00:14:02Z",
"version": "v8.1.0-beta",
"versionExact": "v8.1.0-beta"
},
{
"checksumSHA1": "m1KzBritgIsQ+s4tAlBGz02iIKo=",
"comment": "v2.1.1-beta-8-gca4d906",