|
Packit Service |
4d2de5 |
package resources
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// Copyright (c) Microsoft and contributors. All rights reserved.
|
|
Packit Service |
4d2de5 |
//
|
|
Packit Service |
4d2de5 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit Service |
4d2de5 |
// you may not use this file except in compliance with the License.
|
|
Packit Service |
4d2de5 |
// You may obtain a copy of the License at
|
|
Packit Service |
4d2de5 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
4d2de5 |
//
|
|
Packit Service |
4d2de5 |
// Unless required by applicable law or agreed to in writing, software
|
|
Packit Service |
4d2de5 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit Service |
4d2de5 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit Service |
4d2de5 |
//
|
|
Packit Service |
4d2de5 |
// See the License for the specific language governing permissions and
|
|
Packit Service |
4d2de5 |
// limitations under the License.
|
|
Packit Service |
4d2de5 |
//
|
|
Packit Service |
4d2de5 |
// Code generated by Microsoft (R) AutoRest Code Generator.
|
|
Packit Service |
4d2de5 |
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
import (
|
|
Packit Service |
4d2de5 |
"context"
|
|
Packit Service |
4d2de5 |
"github.com/Azure/go-autorest/autorest"
|
|
Packit Service |
4d2de5 |
"github.com/Azure/go-autorest/autorest/azure"
|
|
Packit Service |
4d2de5 |
"github.com/Azure/go-autorest/tracing"
|
|
Packit Service |
4d2de5 |
"net/http"
|
|
Packit Service |
4d2de5 |
)
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// OperationsClient is the provides operations for working with resources and resource groups.
|
|
Packit Service |
4d2de5 |
type OperationsClient struct {
|
|
Packit Service |
4d2de5 |
BaseClient
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// NewOperationsClient creates an instance of the OperationsClient client.
|
|
Packit Service |
4d2de5 |
func NewOperationsClient(subscriptionID string) OperationsClient {
|
|
Packit Service |
4d2de5 |
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this
|
|
Packit Service |
4d2de5 |
// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
|
|
Packit Service |
4d2de5 |
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
|
Packit Service |
4d2de5 |
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// List lists all of the available Microsoft.Resources REST API operations.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) {
|
|
Packit Service |
4d2de5 |
if tracing.IsEnabled() {
|
|
Packit Service |
4d2de5 |
ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List")
|
|
Packit Service |
4d2de5 |
defer func() {
|
|
Packit Service |
4d2de5 |
sc := -1
|
|
Packit Service |
4d2de5 |
if result.olr.Response.Response != nil {
|
|
Packit Service |
4d2de5 |
sc = result.olr.Response.Response.StatusCode
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
tracing.EndSpan(ctx, sc, err)
|
|
Packit Service |
4d2de5 |
}()
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
result.fn = client.listNextResults
|
|
Packit Service |
4d2de5 |
req, err := client.ListPreparer(ctx)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", nil, "Failure preparing request")
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
resp, err := client.ListSender(req)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
result.olr.Response = autorest.Response{Response: resp}
|
|
Packit Service |
4d2de5 |
err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure sending request")
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
result.olr, err = client.ListResponder(resp)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
err = autorest.NewErrorWithError(err, "resources.OperationsClient", "List", resp, "Failure responding to request")
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// ListPreparer prepares the List request.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
|
Packit Service |
4d2de5 |
const APIVersion = "2019-05-01"
|
|
Packit Service |
4d2de5 |
queryParameters := map[string]interface{}{
|
|
Packit Service |
4d2de5 |
"api-version": APIVersion,
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
preparer := autorest.CreatePreparer(
|
|
Packit Service |
4d2de5 |
autorest.AsGet(),
|
|
Packit Service |
4d2de5 |
autorest.WithBaseURL(client.BaseURI),
|
|
Packit Service |
4d2de5 |
autorest.WithPath("/providers/Microsoft.Resources/operations"),
|
|
Packit Service |
4d2de5 |
autorest.WithQueryParameters(queryParameters))
|
|
Packit Service |
4d2de5 |
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// ListSender sends the List request. The method will close the
|
|
Packit Service |
4d2de5 |
// http.Response Body if it receives an error.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
Packit Service |
4d2de5 |
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// ListResponder handles the response to the List request. The method always
|
|
Packit Service |
4d2de5 |
// closes the http.Response Body.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
|
|
Packit Service |
4d2de5 |
err = autorest.Respond(
|
|
Packit Service |
4d2de5 |
resp,
|
|
Packit Service |
4d2de5 |
client.ByInspecting(),
|
|
Packit Service |
4d2de5 |
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
Packit Service |
4d2de5 |
autorest.ByUnmarshallingJSON(&result),
|
|
Packit Service |
4d2de5 |
autorest.ByClosing())
|
|
Packit Service |
4d2de5 |
result.Response = autorest.Response{Response: resp}
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// listNextResults retrieves the next set of results, if any.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) {
|
|
Packit Service |
4d2de5 |
req, err := lastResults.operationListResultPreparer(ctx)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", nil, "Failure preparing next results request")
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
if req == nil {
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
resp, err := client.ListSender(req)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
result.Response = autorest.Response{Response: resp}
|
|
Packit Service |
4d2de5 |
return result, autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure sending next results request")
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
result, err = client.ListResponder(resp)
|
|
Packit Service |
4d2de5 |
if err != nil {
|
|
Packit Service |
4d2de5 |
err = autorest.NewErrorWithError(err, "resources.OperationsClient", "listNextResults", resp, "Failure responding to next results request")
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
|
|
Packit Service |
4d2de5 |
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
|
Packit Service |
4d2de5 |
func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) {
|
|
Packit Service |
4d2de5 |
if tracing.IsEnabled() {
|
|
Packit Service |
4d2de5 |
ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List")
|
|
Packit Service |
4d2de5 |
defer func() {
|
|
Packit Service |
4d2de5 |
sc := -1
|
|
Packit Service |
4d2de5 |
if result.Response().Response.Response != nil {
|
|
Packit Service |
4d2de5 |
sc = result.page.Response().Response.Response.StatusCode
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
tracing.EndSpan(ctx, sc, err)
|
|
Packit Service |
4d2de5 |
}()
|
|
Packit Service |
4d2de5 |
}
|
|
Packit Service |
4d2de5 |
result.page, err = client.List(ctx)
|
|
Packit Service |
4d2de5 |
return
|
|
Packit Service |
4d2de5 |
}
|