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