diff --git a/profiles/latest/resources/mgmt/locks/models.go b/profiles/latest/resources/mgmt/locks/models.go index 0e564124a5ac..88a51dade141 100644 --- a/profiles/latest/resources/mgmt/locks/models.go +++ b/profiles/latest/resources/mgmt/locks/models.go @@ -21,6 +21,8 @@ package locks import original "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" +type AuthorizationOperationsClient = original.AuthorizationOperationsClient + const ( DefaultBaseURI = original.DefaultBaseURI ) @@ -47,6 +49,12 @@ type OperationListResult = original.OperationListResult type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage +func NewAuthorizationOperationsClient(subscriptionID string) AuthorizationOperationsClient { + return original.NewAuthorizationOperationsClient(subscriptionID) +} +func NewAuthorizationOperationsClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationOperationsClient { + return original.NewAuthorizationOperationsClientWithBaseURI(baseURI, subscriptionID) +} func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } diff --git a/profiles/preview/resources/mgmt/locks/models.go b/profiles/preview/resources/mgmt/locks/models.go index b646f52596f9..7c54760af22f 100644 --- a/profiles/preview/resources/mgmt/locks/models.go +++ b/profiles/preview/resources/mgmt/locks/models.go @@ -21,6 +21,8 @@ package locks import original "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" +type AuthorizationOperationsClient = original.AuthorizationOperationsClient + const ( DefaultBaseURI = original.DefaultBaseURI ) @@ -47,6 +49,12 @@ type OperationListResult = original.OperationListResult type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage +func NewAuthorizationOperationsClient(subscriptionID string) AuthorizationOperationsClient { + return original.NewAuthorizationOperationsClient(subscriptionID) +} +func NewAuthorizationOperationsClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationOperationsClient { + return original.NewAuthorizationOperationsClientWithBaseURI(baseURI, subscriptionID) +} func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } diff --git a/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go b/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go new file mode 100644 index 000000000000..b5490233dd52 --- /dev/null +++ b/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go @@ -0,0 +1,127 @@ +package locks + +// 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" +) + +// AuthorizationOperationsClient is the azure resources can be locked to prevent other users in your organization from +// deleting or modifying resources. +type AuthorizationOperationsClient struct { + BaseClient +} + +// NewAuthorizationOperationsClient creates an instance of the AuthorizationOperationsClient client. +func NewAuthorizationOperationsClient(subscriptionID string) AuthorizationOperationsClient { + return NewAuthorizationOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAuthorizationOperationsClientWithBaseURI creates an instance of the AuthorizationOperationsClient client. +func NewAuthorizationOperationsClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationOperationsClient { + return AuthorizationOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Microsoft.Authorization REST API operations. +func (client AuthorizationOperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AuthorizationOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Authorization/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AuthorizationOperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AuthorizationOperationsClient) listNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AuthorizationOperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} diff --git a/services/resources/mgmt/2016-09-01/locks/client.go b/services/resources/mgmt/2016-09-01/locks/client.go index 2d814e937f96..823e99227488 100644 --- a/services/resources/mgmt/2016-09-01/locks/client.go +++ b/services/resources/mgmt/2016-09-01/locks/client.go @@ -21,10 +21,7 @@ package locks // 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" ) const ( @@ -52,89 +49,3 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { SubscriptionID: subscriptionID, } } - -// ListOperations lists all of the available Microsoft.Authorization REST API operations. -func (client BaseClient) ListOperations(ctx context.Context) (result OperationListResultPage, err error) { - result.fn = client.listOperationsNextResults - req, err := client.ListOperationsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.BaseClient", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.BaseClient", "ListOperations", resp, "Failure sending request") - return - } - - result.olr, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.BaseClient", "ListOperations", resp, "Failure responding to request") - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client BaseClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Authorization/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -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()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOperationsNextResults retrieves the next set of results, if any. -func (client BaseClient) listOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.BaseClient", "listOperationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.BaseClient", "listOperationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.BaseClient", "listOperationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) ListOperationsComplete(ctx context.Context) (result OperationListResultIterator, err error) { - result.page, err = client.ListOperations(ctx) - return -}