api_op_GetGeoLocation.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package route53
4
5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/route53/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13
14 // Gets information about whether a specified geographic location is supported for
15 // Amazon Route 53 geolocation resource record sets.
16 //
17 // Route 53 does not perform authorization for this API because it retrieves
18 // information that is already available to the public.
19 //
20 // Use the following syntax to determine whether a continent is supported for
21 // geolocation:
22 //
23 // GET /2013-04-01/geolocation?continentcode=two-letter abbreviation for a
24 // continent
25 //
26 // Use the following syntax to determine whether a country is supported for
27 // geolocation:
28 //
29 // GET /2013-04-01/geolocation?countrycode=two-character country code
30 //
31 // Use the following syntax to determine whether a subdivision of a country is
32 // supported for geolocation:
33 //
34 // GET /2013-04-01/geolocation?countrycode=two-character country
35 // code&subdivisioncode=subdivision code
36 func (c *Client) GetGeoLocation(ctx context.Context, params *GetGeoLocationInput, optFns ...func(*Options)) (*GetGeoLocationOutput, error) {
37 if params == nil {
38 params = &GetGeoLocationInput{}
39 }
40
41 result, metadata, err := c.invokeOperation(ctx, "GetGeoLocation", params, optFns, c.addOperationGetGeoLocationMiddlewares)
42 if err != nil {
43 return nil, err
44 }
45
46 out := result.(*GetGeoLocationOutput)
47 out.ResultMetadata = metadata
48 return out, nil
49 }
50
51 // A request for information about whether a specified geographic location is
52 // supported for Amazon Route 53 geolocation resource record sets.
53 type GetGeoLocationInput struct {
54
55 // For geolocation resource record sets, a two-letter abbreviation that identifies
56 // a continent. Amazon Route 53 supports the following continent codes:
57 //
58 // - AF: Africa
59 //
60 // - AN: Antarctica
61 //
62 // - AS: Asia
63 //
64 // - EU: Europe
65 //
66 // - OC: Oceania
67 //
68 // - NA: North America
69 //
70 // - SA: South America
71 ContinentCode *string
72
73 // Amazon Route 53 uses the two-letter country codes that are specified in [ISO standard 3166-1 alpha-2].
74 //
75 // Route 53 also supports the country code UA for Ukraine.
76 //
77 // [ISO standard 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
78 CountryCode *string
79
80 // The code for the subdivision, such as a particular state within the United
81 // States. For a list of US state abbreviations, see [Appendix B: Two–Letter State and Possession Abbreviations]on the United States Postal
82 // Service website. For a list of all supported subdivision codes, use the [ListGeoLocations]API.
83 //
84 // [ListGeoLocations]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListGeoLocations.html
85 // [Appendix B: Two–Letter State and Possession Abbreviations]: https://pe.usps.com/text/pub28/28apb.htm
86 SubdivisionCode *string
87
88 noSmithyDocumentSerde
89 }
90
91 // A complex type that contains the response information for the specified
92 // geolocation code.
93 type GetGeoLocationOutput struct {
94
95 // A complex type that contains the codes and full continent, country, and
96 // subdivision names for the specified geolocation code.
97 //
98 // This member is required.
99 GeoLocationDetails *types.GeoLocationDetails
100
101 // Metadata pertaining to the operation's result.
102 ResultMetadata middleware.Metadata
103
104 noSmithyDocumentSerde
105 }
106
107 func (c *Client) addOperationGetGeoLocationMiddlewares(stack *middleware.Stack, options Options) (err error) {
108 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
109 return err
110 }
111 err = stack.Serialize.Add(&awsRestxml_serializeOpGetGeoLocation{}, middleware.After)
112 if err != nil {
113 return err
114 }
115 err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetGeoLocation{}, middleware.After)
116 if err != nil {
117 return err
118 }
119 if err := addProtocolFinalizerMiddlewares(stack, options, "GetGeoLocation"); err != nil {
120 return fmt.Errorf("add protocol finalizers: %v", err)
121 }
122
123 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
124 return err
125 }
126 if err = addSetLoggerMiddleware(stack, options); err != nil {
127 return err
128 }
129 if err = addClientRequestID(stack); err != nil {
130 return err
131 }
132 if err = addComputeContentLength(stack); err != nil {
133 return err
134 }
135 if err = addResolveEndpointMiddleware(stack, options); err != nil {
136 return err
137 }
138 if err = addComputePayloadSHA256(stack); err != nil {
139 return err
140 }
141 if err = addRetry(stack, options); err != nil {
142 return err
143 }
144 if err = addRawResponseToMetadata(stack); err != nil {
145 return err
146 }
147 if err = addRecordResponseTiming(stack); err != nil {
148 return err
149 }
150 if err = addSpanRetryLoop(stack, options); err != nil {
151 return err
152 }
153 if err = addClientUserAgent(stack, options); err != nil {
154 return err
155 }
156 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
157 return err
158 }
159 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
160 return err
161 }
162 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
163 return err
164 }
165 if err = addTimeOffsetBuild(stack, c); err != nil {
166 return err
167 }
168 if err = addUserAgentRetryMode(stack, options); err != nil {
169 return err
170 }
171 if err = addCredentialSource(stack, options); err != nil {
172 return err
173 }
174 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGeoLocation(options.Region), middleware.Before); err != nil {
175 return err
176 }
177 if err = addRecursionDetection(stack); err != nil {
178 return err
179 }
180 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
181 return err
182 }
183 if err = addResponseErrorMiddleware(stack); err != nil {
184 return err
185 }
186 if err = addRequestResponseLogging(stack, options); err != nil {
187 return err
188 }
189 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
190 return err
191 }
192 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
193 return err
194 }
195 if err = addInterceptAttempt(stack, options); err != nil {
196 return err
197 }
198 if err = addInterceptors(stack, options); err != nil {
199 return err
200 }
201 return nil
202 }
203
204 func newServiceMetadataMiddleware_opGetGeoLocation(region string) *awsmiddleware.RegisterServiceMetadata {
205 return &awsmiddleware.RegisterServiceMetadata{
206 Region: region,
207 ServiceID: ServiceID,
208 OperationName: "GetGeoLocation",
209 }
210 }
211