src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_GetGeoLocation.go (5726B)


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