From d0eb6a027939a94564af06fb94511df167515e2c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 16 Apr 2019 14:58:21 -0700 Subject: [PATCH] Generated from a2fd1bdd9003acdbe77080a379efed2461665d89 (#4556) Fixing operation id to be named consistently --- .../mgmt/hanaonazure/hanaonazureapi/models.go | 1 - .../hanaonazure/mgmt/hanaonazure/models.go | 9 +- .../hanaonazure/hanainstances.go | 79 ++++++++++++ .../hanaonazure/hanaonazureapi/interfaces.go | 8 +- .../2017-11-03-preview/hanaonazure/models.go | 46 +++---- .../hanaonazure/monitoring.go | 120 ------------------ 6 files changed, 104 insertions(+), 159 deletions(-) delete mode 100644 services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/monitoring.go diff --git a/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/hanaonazureapi/models.go b/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/hanaonazureapi/models.go index 580a7ed3ce87..81bdb3436a03 100644 --- a/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/hanaonazureapi/models.go +++ b/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/hanaonazureapi/models.go @@ -22,5 +22,4 @@ package hanaonazureapi import original "github.com/Azure/azure-sdk-for-go/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi" type HanaInstancesClientAPI = original.HanaInstancesClientAPI -type MonitoringClientAPI = original.MonitoringClientAPI type OperationsClientAPI = original.OperationsClientAPI diff --git a/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/models.go b/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/models.go index ab46abb62f3e..a49bae39164c 100644 --- a/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/models.go +++ b/profiles/preview/preview/hanaonazure/mgmt/hanaonazure/models.go @@ -84,15 +84,14 @@ type ErrorResponse = original.ErrorResponse type HanaInstance = original.HanaInstance type HanaInstanceProperties = original.HanaInstanceProperties type HanaInstancesClient = original.HanaInstancesClient +type HanaInstancesEnableMonitoringFuture = original.HanaInstancesEnableMonitoringFuture type HanaInstancesListResult = original.HanaInstancesListResult type HanaInstancesListResultIterator = original.HanaInstancesListResultIterator type HanaInstancesListResultPage = original.HanaInstancesListResultPage type HanaInstancesRestartFuture = original.HanaInstancesRestartFuture type HardwareProfile = original.HardwareProfile type IPAddress = original.IPAddress -type MonitoringClient = original.MonitoringClient type MonitoringDetails = original.MonitoringDetails -type MonitoringHanaInstancesMethodFuture = original.MonitoringHanaInstancesMethodFuture type NetworkProfile = original.NetworkProfile type OSProfile = original.OSProfile type Operation = original.Operation @@ -117,12 +116,6 @@ func NewHanaInstancesListResultIterator(page HanaInstancesListResultPage) HanaIn func NewHanaInstancesListResultPage(getNextPage func(context.Context, HanaInstancesListResult) (HanaInstancesListResult, error)) HanaInstancesListResultPage { return original.NewHanaInstancesListResultPage(getNextPage) } -func NewMonitoringClient(subscriptionID string) MonitoringClient { - return original.NewMonitoringClient(subscriptionID) -} -func NewMonitoringClientWithBaseURI(baseURI string, subscriptionID string) MonitoringClient { - return original.NewMonitoringClientWithBaseURI(baseURI, subscriptionID) -} func NewOperationsClient(subscriptionID string) OperationsClient { return original.NewOperationsClient(subscriptionID) } diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanainstances.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanainstances.go index f8f903d6d226..b54b850efbdb 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanainstances.go +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanainstances.go @@ -40,6 +40,85 @@ func NewHanaInstancesClientWithBaseURI(baseURI string, subscriptionID string) Ha return HanaInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// EnableMonitoring the operation to add a monitor to an SAP HANA instance. +// Parameters: +// resourceGroupName - name of the resource group. +// hanaInstanceName - name of the SAP HANA on Azure instance. +// monitoringParameter - request body that only contains monitoring attributes +func (client HanaInstancesClient) EnableMonitoring(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter MonitoringDetails) (result HanaInstancesEnableMonitoringFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HanaInstancesClient.EnableMonitoring") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableMonitoringPreparer(ctx, resourceGroupName, hanaInstanceName, monitoringParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesClient", "EnableMonitoring", nil, "Failure preparing request") + return + } + + result, err = client.EnableMonitoringSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesClient", "EnableMonitoring", result.Response(), "Failure sending request") + return + } + + return +} + +// EnableMonitoringPreparer prepares the EnableMonitoring request. +func (client HanaInstancesClient) EnableMonitoringPreparer(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter MonitoringDetails) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hanaInstanceName": autorest.Encode("path", hanaInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-11-03-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring", pathParameters), + autorest.WithJSON(monitoringParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableMonitoringSender sends the EnableMonitoring request. The method will close the +// http.Response Body if it receives an error. +func (client HanaInstancesClient) EnableMonitoringSender(req *http.Request) (future HanaInstancesEnableMonitoringFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// EnableMonitoringResponder handles the response to the EnableMonitoring request. The method always +// closes the http.Response Body. +func (client HanaInstancesClient) EnableMonitoringResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets properties of a SAP HANA instance for the specified subscription, resource group, and instance name. // Parameters: // resourceGroupName - name of the resource group. diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go index 4462128acc40..07c1e2912968 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go @@ -31,6 +31,7 @@ var _ OperationsClientAPI = (*hanaonazure.OperationsClient)(nil) // HanaInstancesClientAPI contains the set of methods on the HanaInstancesClient type. type HanaInstancesClientAPI interface { + EnableMonitoring(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter hanaonazure.MonitoringDetails) (result hanaonazure.HanaInstancesEnableMonitoringFuture, err error) Get(ctx context.Context, resourceGroupName string, hanaInstanceName string) (result hanaonazure.HanaInstance, err error) List(ctx context.Context) (result hanaonazure.HanaInstancesListResultPage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result hanaonazure.HanaInstancesListResultPage, err error) @@ -39,10 +40,3 @@ type HanaInstancesClientAPI interface { } var _ HanaInstancesClientAPI = (*hanaonazure.HanaInstancesClient)(nil) - -// MonitoringClientAPI contains the set of methods on the MonitoringClient type. -type MonitoringClientAPI interface { - HanaInstancesMethod(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter hanaonazure.MonitoringDetails) (result hanaonazure.MonitoringHanaInstancesMethodFuture, err error) -} - -var _ MonitoringClientAPI = (*hanaonazure.MonitoringClient)(nil) diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go index 036e2169a417..5696c9b56e04 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go @@ -292,6 +292,29 @@ type HanaInstanceProperties struct { HwRevision *string `json:"hwRevision,omitempty"` } +// HanaInstancesEnableMonitoringFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type HanaInstancesEnableMonitoringFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *HanaInstancesEnableMonitoringFuture) Result(client HanaInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesEnableMonitoringFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesEnableMonitoringFuture") + return + } + ar.Response = future.Response() + return +} + // HanaInstancesListResult the response from the List HANA Instances operation. type HanaInstancesListResult struct { autorest.Response `json:"-"` @@ -493,29 +516,6 @@ type MonitoringDetails struct { HanaDbPassword *string `json:"hanaDbPassword,omitempty"` } -// MonitoringHanaInstancesMethodFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type MonitoringHanaInstancesMethodFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *MonitoringHanaInstancesMethodFuture) Result(client MonitoringClient) (ar autorest.Response, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.MonitoringHanaInstancesMethodFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("hanaonazure.MonitoringHanaInstancesMethodFuture") - return - } - ar.Response = future.Response() - return -} - // NetworkProfile specifies the network settings for the HANA instance disks. type NetworkProfile struct { // NetworkInterfaces - Specifies the network interfaces for the HANA instance. diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/monitoring.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/monitoring.go deleted file mode 100644 index f5ba87d4045b..000000000000 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/monitoring.go +++ /dev/null @@ -1,120 +0,0 @@ -package hanaonazure - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MonitoringClient is the HANA on Azure Client -type MonitoringClient struct { - BaseClient -} - -// NewMonitoringClient creates an instance of the MonitoringClient client. -func NewMonitoringClient(subscriptionID string) MonitoringClient { - return NewMonitoringClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMonitoringClientWithBaseURI creates an instance of the MonitoringClient client. -func NewMonitoringClientWithBaseURI(baseURI string, subscriptionID string) MonitoringClient { - return MonitoringClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// HanaInstancesMethod the operation to monitor a SAP HANA instance. -// Parameters: -// resourceGroupName - name of the resource group. -// hanaInstanceName - name of the SAP HANA on Azure instance. -// monitoringParameter - request body that only contains monitoring attributes -func (client MonitoringClient) HanaInstancesMethod(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter MonitoringDetails) (result MonitoringHanaInstancesMethodFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringClient.HanaInstancesMethod") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.HanaInstancesMethodPreparer(ctx, resourceGroupName, hanaInstanceName, monitoringParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.MonitoringClient", "HanaInstancesMethod", nil, "Failure preparing request") - return - } - - result, err = client.HanaInstancesMethodSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.MonitoringClient", "HanaInstancesMethod", result.Response(), "Failure sending request") - return - } - - return -} - -// HanaInstancesMethodPreparer prepares the HanaInstancesMethod request. -func (client MonitoringClient) HanaInstancesMethodPreparer(ctx context.Context, resourceGroupName string, hanaInstanceName string, monitoringParameter MonitoringDetails) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hanaInstanceName": autorest.Encode("path", hanaInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring", pathParameters), - autorest.WithJSON(monitoringParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// HanaInstancesMethodSender sends the HanaInstancesMethod request. The method will close the -// http.Response Body if it receives an error. -func (client MonitoringClient) HanaInstancesMethodSender(req *http.Request) (future MonitoringHanaInstancesMethodFuture, err error) { - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// HanaInstancesMethodResponder handles the response to the HanaInstancesMethod request. The method always -// closes the http.Response Body. -func (client MonitoringClient) HanaInstancesMethodResponder(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 -}