1package datafactory 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/tracing" 14 "net/http" 15) 16 17// OperationsClient is the the Azure Data Factory V2 management API provides a RESTful set of web services that 18// interact with Azure Data Factory V2 services. 19type OperationsClient struct { 20 BaseClient 21} 22 23// NewOperationsClient creates an instance of the OperationsClient client. 24func NewOperationsClient(subscriptionID string) OperationsClient { 25 return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this 29// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 30func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { 31 return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// List lists the available Azure Data Factory API operations. 35func (client OperationsClient) List(ctx context.Context) (result OperationListResponse, err error) { 36 if tracing.IsEnabled() { 37 ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") 38 defer func() { 39 sc := -1 40 if result.Response.Response != nil { 41 sc = result.Response.Response.StatusCode 42 } 43 tracing.EndSpan(ctx, sc, err) 44 }() 45 } 46 req, err := client.ListPreparer(ctx) 47 if err != nil { 48 err = autorest.NewErrorWithError(err, "datafactory.OperationsClient", "List", nil, "Failure preparing request") 49 return 50 } 51 52 resp, err := client.ListSender(req) 53 if err != nil { 54 result.Response = autorest.Response{Response: resp} 55 err = autorest.NewErrorWithError(err, "datafactory.OperationsClient", "List", resp, "Failure sending request") 56 return 57 } 58 59 result, err = client.ListResponder(resp) 60 if err != nil { 61 err = autorest.NewErrorWithError(err, "datafactory.OperationsClient", "List", resp, "Failure responding to request") 62 return 63 } 64 65 return 66} 67 68// ListPreparer prepares the List request. 69func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { 70 const APIVersion = "2017-09-01-preview" 71 queryParameters := map[string]interface{}{ 72 "api-version": APIVersion, 73 } 74 75 preparer := autorest.CreatePreparer( 76 autorest.AsGet(), 77 autorest.WithBaseURL(client.BaseURI), 78 autorest.WithPath("/providers/Microsoft.DataFactory/operations"), 79 autorest.WithQueryParameters(queryParameters)) 80 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 81} 82 83// ListSender sends the List request. The method will close the 84// http.Response Body if it receives an error. 85func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { 86 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 87} 88 89// ListResponder handles the response to the List request. The method always 90// closes the http.Response Body. 91func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResponse, err error) { 92 err = autorest.Respond( 93 resp, 94 azure.WithErrorUnlessStatusCode(http.StatusOK), 95 autorest.ByUnmarshallingJSON(&result), 96 autorest.ByClosing()) 97 result.Response = autorest.Response{Response: resp} 98 return 99} 100