...
1 package compute
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
19
20
21
22 type MachineLearningComputeClient struct {
23 BaseClient
24 }
25
26
27 func NewMachineLearningComputeClient(subscriptionID string) MachineLearningComputeClient {
28 return NewMachineLearningComputeClientWithBaseURI(DefaultBaseURI, subscriptionID)
29 }
30
31
32
33
34 func NewMachineLearningComputeClientWithBaseURI(baseURI string, subscriptionID string) MachineLearningComputeClient {
35 return MachineLearningComputeClient{NewWithBaseURI(baseURI, subscriptionID)}
36 }
37
38
39 func (client MachineLearningComputeClient) ListAvailableOperations(ctx context.Context) (result AvailableOperations, err error) {
40 if tracing.IsEnabled() {
41 ctx = tracing.StartSpan(ctx, fqdn+"/MachineLearningComputeClient.ListAvailableOperations")
42 defer func() {
43 sc := -1
44 if result.Response.Response != nil {
45 sc = result.Response.Response.StatusCode
46 }
47 tracing.EndSpan(ctx, sc, err)
48 }()
49 }
50 req, err := client.ListAvailableOperationsPreparer(ctx)
51 if err != nil {
52 err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", nil, "Failure preparing request")
53 return
54 }
55
56 resp, err := client.ListAvailableOperationsSender(req)
57 if err != nil {
58 result.Response = autorest.Response{Response: resp}
59 err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", resp, "Failure sending request")
60 return
61 }
62
63 result, err = client.ListAvailableOperationsResponder(resp)
64 if err != nil {
65 err = autorest.NewErrorWithError(err, "compute.MachineLearningComputeClient", "ListAvailableOperations", resp, "Failure responding to request")
66 return
67 }
68
69 return
70 }
71
72
73 func (client MachineLearningComputeClient) ListAvailableOperationsPreparer(ctx context.Context) (*http.Request, error) {
74 const APIVersion = "2017-08-01-preview"
75 queryParameters := map[string]interface{}{
76 "api-version": APIVersion,
77 }
78
79 preparer := autorest.CreatePreparer(
80 autorest.AsGet(),
81 autorest.WithBaseURL(client.BaseURI),
82 autorest.WithPath("/providers/Microsoft.MachineLearningCompute/operations"),
83 autorest.WithQueryParameters(queryParameters))
84 return preparer.Prepare((&http.Request{}).WithContext(ctx))
85 }
86
87
88
89 func (client MachineLearningComputeClient) ListAvailableOperationsSender(req *http.Request) (*http.Response, error) {
90 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
91 }
92
93
94
95 func (client MachineLearningComputeClient) ListAvailableOperationsResponder(resp *http.Response) (result AvailableOperations, err error) {
96 err = autorest.Respond(
97 resp,
98 azure.WithErrorUnlessStatusCode(http.StatusOK),
99 autorest.ByUnmarshallingJSON(&result),
100 autorest.ByClosing())
101 result.Response = autorest.Response{Response: resp}
102 return
103 }
104
View as plain text