...
1 package account
2
3
4
5
6
7
8
9 import (
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
18 type LocationsClient struct {
19 BaseClient
20 }
21
22
23 func NewLocationsClient(subscriptionID string) LocationsClient {
24 return NewLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
25 }
26
27
28
29 func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) LocationsClient {
30 return LocationsClient{NewWithBaseURI(baseURI, subscriptionID)}
31 }
32
33
34
35
36 func (client LocationsClient) GetCapability(ctx context.Context, location string) (result CapabilityInformation, err error) {
37 if tracing.IsEnabled() {
38 ctx = tracing.StartSpan(ctx, fqdn+"/LocationsClient.GetCapability")
39 defer func() {
40 sc := -1
41 if result.Response.Response != nil {
42 sc = result.Response.Response.StatusCode
43 }
44 tracing.EndSpan(ctx, sc, err)
45 }()
46 }
47 req, err := client.GetCapabilityPreparer(ctx, location)
48 if err != nil {
49 err = autorest.NewErrorWithError(err, "account.LocationsClient", "GetCapability", nil, "Failure preparing request")
50 return
51 }
52
53 resp, err := client.GetCapabilitySender(req)
54 if err != nil {
55 result.Response = autorest.Response{Response: resp}
56 err = autorest.NewErrorWithError(err, "account.LocationsClient", "GetCapability", resp, "Failure sending request")
57 return
58 }
59
60 result, err = client.GetCapabilityResponder(resp)
61 if err != nil {
62 err = autorest.NewErrorWithError(err, "account.LocationsClient", "GetCapability", resp, "Failure responding to request")
63 return
64 }
65
66 return
67 }
68
69
70 func (client LocationsClient) GetCapabilityPreparer(ctx context.Context, location string) (*http.Request, error) {
71 pathParameters := map[string]interface{}{
72 "location": autorest.Encode("path", location),
73 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
74 }
75
76 const APIVersion = "2016-11-01"
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.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability", pathParameters),
85 autorest.WithQueryParameters(queryParameters))
86 return preparer.Prepare((&http.Request{}).WithContext(ctx))
87 }
88
89
90
91 func (client LocationsClient) GetCapabilitySender(req *http.Request) (*http.Response, error) {
92 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
93 }
94
95
96
97 func (client LocationsClient) GetCapabilityResponder(resp *http.Response) (result CapabilityInformation, err error) {
98 err = autorest.Respond(
99 resp,
100 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
101 autorest.ByUnmarshallingJSON(&result),
102 autorest.ByClosing())
103 result.Response = autorest.Response{Response: resp}
104 return
105 }
106
View as plain text