1 package backup
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 ProtectionContainerRefreshOperationResultsClient struct {
19 BaseClient
20 }
21
22
23
24 func NewProtectionContainerRefreshOperationResultsClient(subscriptionID string) ProtectionContainerRefreshOperationResultsClient {
25 return NewProtectionContainerRefreshOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30
31 func NewProtectionContainerRefreshOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainerRefreshOperationResultsClient {
32 return ProtectionContainerRefreshOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40
41 func (client ProtectionContainerRefreshOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, operationID string) (result autorest.Response, err error) {
42 if tracing.IsEnabled() {
43 ctx = tracing.StartSpan(ctx, fqdn+"/ProtectionContainerRefreshOperationResultsClient.Get")
44 defer func() {
45 sc := -1
46 if result.Response != nil {
47 sc = result.Response.StatusCode
48 }
49 tracing.EndSpan(ctx, sc, err)
50 }()
51 }
52 req, err := client.GetPreparer(ctx, vaultName, resourceGroupName, fabricName, operationID)
53 if err != nil {
54 err = autorest.NewErrorWithError(err, "backup.ProtectionContainerRefreshOperationResultsClient", "Get", nil, "Failure preparing request")
55 return
56 }
57
58 resp, err := client.GetSender(req)
59 if err != nil {
60 result.Response = resp
61 err = autorest.NewErrorWithError(err, "backup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure sending request")
62 return
63 }
64
65 result, err = client.GetResponder(resp)
66 if err != nil {
67 err = autorest.NewErrorWithError(err, "backup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure responding to request")
68 return
69 }
70
71 return
72 }
73
74
75 func (client ProtectionContainerRefreshOperationResultsClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string, fabricName string, operationID string) (*http.Request, error) {
76 pathParameters := map[string]interface{}{
77 "fabricName": autorest.Encode("path", fabricName),
78 "operationId": autorest.Encode("path", operationID),
79 "resourceGroupName": autorest.Encode("path", resourceGroupName),
80 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
81 "vaultName": autorest.Encode("path", vaultName),
82 }
83
84 const APIVersion = "2021-01-01"
85 queryParameters := map[string]interface{}{
86 "api-version": APIVersion,
87 }
88
89 preparer := autorest.CreatePreparer(
90 autorest.AsGet(),
91 autorest.WithBaseURL(client.BaseURI),
92 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}", pathParameters),
93 autorest.WithQueryParameters(queryParameters))
94 return preparer.Prepare((&http.Request{}).WithContext(ctx))
95 }
96
97
98
99 func (client ProtectionContainerRefreshOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) {
100 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
101 }
102
103
104
105 func (client ProtectionContainerRefreshOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) {
106 err = autorest.Respond(
107 resp,
108 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
109 autorest.ByClosing())
110 result.Response = resp
111 return
112 }
113
View as plain text