From 95ace2bc41d387548b0bc7f3ec14a978adb3f69c Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sun, 28 Jun 2020 03:34:20 +0000 Subject: [PATCH] Generated from 7f423cfec1a7f14d825201deb3b03ad3f10240fc Spelling err --- .../mgmt/2015-12-01/features/client.go | 1 - .../mgmt/2015-12-01/features/features.go | 79 ++++++++++++++++++- .../features/featuresapi/interfaces.go | 1 + .../mgmt/2015-12-01/features/version.go | 2 +- 4 files changed, 77 insertions(+), 6 deletions(-) diff --git a/services/resources/mgmt/2015-12-01/features/client.go b/services/resources/mgmt/2015-12-01/features/client.go index a4fb544cd638..c868b34b3581 100644 --- a/services/resources/mgmt/2015-12-01/features/client.go +++ b/services/resources/mgmt/2015-12-01/features/client.go @@ -118,7 +118,6 @@ func (client BaseClient) ListOperationsSender(req *http.Request) (*http.Response func (client BaseClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/resources/mgmt/2015-12-01/features/features.go b/services/resources/mgmt/2015-12-01/features/features.go index 8fe96de7474c..f2108b71a3b9 100644 --- a/services/resources/mgmt/2015-12-01/features/features.go +++ b/services/resources/mgmt/2015-12-01/features/features.go @@ -112,7 +112,6 @@ func (client Client) GetSender(req *http.Request) (*http.Response, error) { func (client Client) GetResponder(resp *http.Response) (result Result, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -187,7 +186,6 @@ func (client Client) ListSender(req *http.Request) (*http.Response, error) { func (client Client) ListResponder(resp *http.Response) (result OperationsListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -296,7 +294,6 @@ func (client Client) ListAllSender(req *http.Request) (*http.Response, error) { func (client Client) ListAllResponder(resp *http.Response) (result OperationsListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -409,7 +406,81 @@ func (client Client) RegisterSender(req *http.Request) (*http.Response, error) { func (client Client) RegisterResponder(resp *http.Response) (result Result, err error) { err = autorest.Respond( resp, - client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Unregister unregisters the preview feature for the subscription. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// featureName - the name of the feature to unregister. +func (client Client) Unregister(ctx context.Context, resourceProviderNamespace string, featureName string) (result Result, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Unregister") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UnregisterPreparer(ctx, resourceProviderNamespace, featureName) + if err != nil { + err = autorest.NewErrorWithError(err, "features.Client", "Unregister", nil, "Failure preparing request") + return + } + + resp, err := client.UnregisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "features.Client", "Unregister", resp, "Failure sending request") + return + } + + result, err = client.UnregisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.Client", "Unregister", resp, "Failure responding to request") + } + + return +} + +// UnregisterPreparer prepares the Unregister request. +func (client Client) UnregisterPreparer(ctx context.Context, resourceProviderNamespace string, featureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/unregister", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UnregisterSender sends the Unregister request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UnregisterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UnregisterResponder handles the response to the Unregister request. The method always +// closes the http.Response Body. +func (client Client) UnregisterResponder(resp *http.Response) (result Result, err error) { + err = autorest.Respond( + resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/resources/mgmt/2015-12-01/features/featuresapi/interfaces.go b/services/resources/mgmt/2015-12-01/features/featuresapi/interfaces.go index f89e4afdff2b..16619210588d 100644 --- a/services/resources/mgmt/2015-12-01/features/featuresapi/interfaces.go +++ b/services/resources/mgmt/2015-12-01/features/featuresapi/interfaces.go @@ -38,6 +38,7 @@ type ClientAPI interface { ListAll(ctx context.Context) (result features.OperationsListResultPage, err error) ListAllComplete(ctx context.Context) (result features.OperationsListResultIterator, err error) Register(ctx context.Context, resourceProviderNamespace string, featureName string) (result features.Result, err error) + Unregister(ctx context.Context, resourceProviderNamespace string, featureName string) (result features.Result, err error) } var _ ClientAPI = (*features.Client)(nil) diff --git a/services/resources/mgmt/2015-12-01/features/version.go b/services/resources/mgmt/2015-12-01/features/version.go index 3f7be1a12938..97ea7225aaf6 100644 --- a/services/resources/mgmt/2015-12-01/features/version.go +++ b/services/resources/mgmt/2015-12-01/features/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " features/2015-12-01" + return "Azure-SDK-For-Go/" + Version() + " features/2015-12-01" } // Version returns the semantic version (see http://semver.org) of the client.