1package managementgroups 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/satori/go.uuid" 25 "net/http" 26) 27 28// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 29// OperationsClient is the the Azure Management Groups API enables consolidation of multiple 30// subscriptions/resources into an organizational hierarchy and centrally 31// manage access control, policies, alerting and reporting for those resources. 32type OperationsClient struct { 33 BaseClient 34} 35 36// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 37// NewOperationsClient creates an instance of the OperationsClient client. 38func NewOperationsClient(groupID uuid.UUID) OperationsClient { 39 return NewOperationsClientWithBaseURI(DefaultBaseURI, groupID) 40} 41 42// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 43// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. 44func NewOperationsClientWithBaseURI(baseURI string, groupID uuid.UUID) OperationsClient { 45 return OperationsClient{NewWithBaseURI(baseURI, groupID)} 46} 47 48// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 49// List lists all of the available management REST API operations. 50func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { 51 result.fn = client.listNextResults 52 req, err := client.ListPreparer(ctx) 53 if err != nil { 54 err = autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "List", nil, "Failure preparing request") 55 return 56 } 57 58 resp, err := client.ListSender(req) 59 if err != nil { 60 result.olr.Response = autorest.Response{Response: resp} 61 err = autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "List", resp, "Failure sending request") 62 return 63 } 64 65 result.olr, err = client.ListResponder(resp) 66 if err != nil { 67 err = autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "List", resp, "Failure responding to request") 68 } 69 70 return 71} 72 73// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 74// ListPreparer prepares the List request. 75func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { 76 const APIVersion = "2017-08-31-preview" 77 queryParameters := map[string]interface{}{ 78 "api-version": APIVersion, 79 } 80 81 preparer := autorest.CreatePreparer( 82 autorest.AsGet(), 83 autorest.WithBaseURL(client.BaseURI), 84 autorest.WithPath("/providers/Microsoft.Management/operations"), 85 autorest.WithQueryParameters(queryParameters)) 86 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 87} 88 89// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 90// ListSender sends the List request. The method will close the 91// http.Response Body if it receives an error. 92func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { 93 return autorest.SendWithSender(client, req, 94 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 95} 96 97// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 98// ListResponder handles the response to the List request. The method always 99// closes the http.Response Body. 100func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { 101 err = autorest.Respond( 102 resp, 103 client.ByInspecting(), 104 azure.WithErrorUnlessStatusCode(http.StatusOK), 105 autorest.ByUnmarshallingJSON(&result), 106 autorest.ByClosing()) 107 result.Response = autorest.Response{Response: resp} 108 return 109} 110 111// listNextResults retrieves the next set of results, if any. 112func (client OperationsClient) listNextResults(lastResults OperationListResult) (result OperationListResult, err error) { 113 req, err := lastResults.operationListResultPreparer() 114 if err != nil { 115 return result, autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "listNextResults", nil, "Failure preparing next results request") 116 } 117 if req == nil { 118 return 119 } 120 resp, err := client.ListSender(req) 121 if err != nil { 122 result.Response = autorest.Response{Response: resp} 123 return result, autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "listNextResults", resp, "Failure sending next results request") 124 } 125 result, err = client.ListResponder(resp) 126 if err != nil { 127 err = autorest.NewErrorWithError(err, "managementgroups.OperationsClient", "listNextResults", resp, "Failure responding to next results request") 128 } 129 return 130} 131 132// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-08-31-preview/management instead. 133// ListComplete enumerates all values, automatically crossing page boundaries as required. 134func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { 135 result.page, err = client.List(ctx) 136 return 137} 138