diff --git a/services/sql/mgmt/2015-05-01-preview/sql/models.go b/services/sql/mgmt/2015-05-01-preview/sql/models.go index 1d14c39e10f3..fd13e96a6428 100644 --- a/services/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/services/sql/mgmt/2015-05-01-preview/sql/models.go @@ -4813,139 +4813,6 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } -// RecommendedElasticPool represents a recommented elastic pool. -type RecommendedElasticPool struct { - autorest.Response `json:"-"` - // RecommendedElasticPoolProperties - The properites representing the resource. - *RecommendedElasticPoolProperties `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendedElasticPool. -func (rep RecommendedElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rep.RecommendedElasticPoolProperties != nil { - objectMap["properties"] = rep.RecommendedElasticPoolProperties - } - if rep.ID != nil { - objectMap["id"] = rep.ID - } - if rep.Name != nil { - objectMap["name"] = rep.Name - } - if rep.Type != nil { - objectMap["type"] = rep.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedElasticPool struct. -func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recommendedElasticPoolProperties RecommendedElasticPoolProperties - err = json.Unmarshal(*v, &recommendedElasticPoolProperties) - if err != nil { - return err - } - rep.RecommendedElasticPoolProperties = &recommendedElasticPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rep.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedElasticPoolListMetricsResult represents the response to a list recommended elastic pool metrics -// request. -type RecommendedElasticPoolListMetricsResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools metrics. - Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` -} - -// RecommendedElasticPoolListResult represents the response to a list recommended elastic pool request. -type RecommendedElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools hosted in the server. - Value *[]RecommendedElasticPool `json:"value,omitempty"` -} - -// RecommendedElasticPoolMetric represents recommended elastic pool metric. -type RecommendedElasticPoolMetric struct { - // DateTime - The time of metric (ISO8601 format). - DateTime *date.Time `json:"dateTime,omitempty"` - // Dtu - Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - Dtu *float64 `json:"dtu,omitempty"` - // SizeGB - Gets or sets size in gigabytes. - SizeGB *float64 `json:"sizeGB,omitempty"` -} - -// RecommendedElasticPoolProperties represents the properties of a recommented elastic pool. -type RecommendedElasticPoolProperties struct { - // DatabaseEdition - The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium' - DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` - // Dtu - The DTU for the recommended elastic pool. - Dtu *float64 `json:"dtu,omitempty"` - // DatabaseDtuMin - The minimum DTU for the database. - DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` - // DatabaseDtuMax - The maximum DTU for the database. - DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` - // StorageMB - Gets storage size in megabytes. - StorageMB *float64 `json:"storageMB,omitempty"` - // ObservationPeriodStart - The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // MaxObservedDtu - Gets maximum observed DTU. - MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` - // MaxObservedStorageMB - Gets maximum observed storage in megabytes. - MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` - // Databases - The list of databases in this pool. Expanded property - Databases *[]Database `json:"databases,omitempty"` - // Metrics - The list of databases housed in the server. Expanded property - Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` -} - // RecommendedIndex represents a database recommended index. type RecommendedIndex struct { // RecommendedIndexProperties - The properties representing the resource. diff --git a/services/sql/mgmt/2015-05-01-preview/sql/recommendedelasticpools.go b/services/sql/mgmt/2015-05-01-preview/sql/recommendedelasticpools.go deleted file mode 100644 index 477ef5119e90..000000000000 --- a/services/sql/mgmt/2015-05-01-preview/sql/recommendedelasticpools.go +++ /dev/null @@ -1,247 +0,0 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RecommendedElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RecommendedElasticPoolsClient struct { - BaseClient -} - -// 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 a recommented 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 server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - 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(ctx context.Context, 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), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// 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 -} - -// ListByServer returns 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 server. -func (client RecommendedElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListByServerResponder(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 -} - -// ListMetrics returns recommented 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 server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - 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(ctx context.Context, 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), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// 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 -} diff --git a/services/sql/mgmt/2017-03-01-preview/sql/models.go b/services/sql/mgmt/2017-03-01-preview/sql/models.go index b0aa552ff7d8..27b9581738ef 100644 --- a/services/sql/mgmt/2017-03-01-preview/sql/models.go +++ b/services/sql/mgmt/2017-03-01-preview/sql/models.go @@ -5404,139 +5404,6 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } -// RecommendedElasticPool represents a recommented elastic pool. -type RecommendedElasticPool struct { - autorest.Response `json:"-"` - // RecommendedElasticPoolProperties - The properites representing the resource. - *RecommendedElasticPoolProperties `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendedElasticPool. -func (rep RecommendedElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rep.RecommendedElasticPoolProperties != nil { - objectMap["properties"] = rep.RecommendedElasticPoolProperties - } - if rep.ID != nil { - objectMap["id"] = rep.ID - } - if rep.Name != nil { - objectMap["name"] = rep.Name - } - if rep.Type != nil { - objectMap["type"] = rep.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedElasticPool struct. -func (rep *RecommendedElasticPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recommendedElasticPoolProperties RecommendedElasticPoolProperties - err = json.Unmarshal(*v, &recommendedElasticPoolProperties) - if err != nil { - return err - } - rep.RecommendedElasticPoolProperties = &recommendedElasticPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rep.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedElasticPoolListMetricsResult represents the response to a list recommended elastic pool metrics -// request. -type RecommendedElasticPoolListMetricsResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools metrics. - Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` -} - -// RecommendedElasticPoolListResult represents the response to a list recommended elastic pool request. -type RecommendedElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools hosted in the server. - Value *[]RecommendedElasticPool `json:"value,omitempty"` -} - -// RecommendedElasticPoolMetric represents recommended elastic pool metric. -type RecommendedElasticPoolMetric struct { - // DateTime - The time of metric (ISO8601 format). - DateTime *date.Time `json:"dateTime,omitempty"` - // Dtu - Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - Dtu *float64 `json:"dtu,omitempty"` - // SizeGB - Gets or sets size in gigabytes. - SizeGB *float64 `json:"sizeGB,omitempty"` -} - -// RecommendedElasticPoolProperties represents the properties of a recommented elastic pool. -type RecommendedElasticPoolProperties struct { - // DatabaseEdition - The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium' - DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` - // Dtu - The DTU for the recommended elastic pool. - Dtu *float64 `json:"dtu,omitempty"` - // DatabaseDtuMin - The minimum DTU for the database. - DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` - // DatabaseDtuMax - The maximum DTU for the database. - DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` - // StorageMB - Gets storage size in megabytes. - StorageMB *float64 `json:"storageMB,omitempty"` - // ObservationPeriodStart - The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // MaxObservedDtu - Gets maximum observed DTU. - MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` - // MaxObservedStorageMB - Gets maximum observed storage in megabytes. - MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` - // Databases - The list of databases in this pool. Expanded property - Databases *[]Database `json:"databases,omitempty"` - // Metrics - The list of databases housed in the server. Expanded property - Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` -} - // RecommendedIndex represents a database recommended index. type RecommendedIndex struct { // RecommendedIndexProperties - The properties representing the resource. diff --git a/services/sql/mgmt/2017-03-01-preview/sql/recommendedelasticpools.go b/services/sql/mgmt/2017-03-01-preview/sql/recommendedelasticpools.go deleted file mode 100644 index 477ef5119e90..000000000000 --- a/services/sql/mgmt/2017-03-01-preview/sql/recommendedelasticpools.go +++ /dev/null @@ -1,247 +0,0 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RecommendedElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RecommendedElasticPoolsClient struct { - BaseClient -} - -// 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 a recommented 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 server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - 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(ctx context.Context, 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), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// 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 -} - -// ListByServer returns 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 server. -func (client RecommendedElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListByServerResponder(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 -} - -// ListMetrics returns recommented 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 server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - 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(ctx context.Context, 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), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// 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 -}