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