src

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

api_op_CreateHostedZone.go (9988B)


      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 // Creates a new public or private hosted zone. You create records in a public
     15 // hosted zone to define how you want to route traffic on the internet for a
     16 // domain, such as example.com, and its subdomains (apex.example.com,
     17 // acme.example.com). You create records in a private hosted zone to define how you
     18 // want to route traffic for a domain and its subdomains within one or more Amazon
     19 // Virtual Private Clouds (Amazon VPCs). You can't convert a public hosted zone to
     20 // a private hosted zone or vice versa. Instead, you must create a new hosted zone
     21 // with the same name and create new resource record sets. For more information
     22 // about charges for hosted zones, see Amazon Route 53 Pricing (http://aws.amazon.com/route53/pricing/)
     23 // . Note the following:
     24 //   - You can't create a hosted zone for a top-level domain (TLD) such as .com.
     25 //   - For public hosted zones, Route 53 automatically creates a default SOA
     26 //     record and four NS records for the zone. For more information about SOA and NS
     27 //     records, see NS and SOA Records that Route 53 Creates for a Hosted Zone (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html)
     28 //     in the Amazon Route 53 Developer Guide. If you want to use the same name servers
     29 //     for multiple public hosted zones, you can optionally associate a reusable
     30 //     delegation set with the hosted zone. See the DelegationSetId element.
     31 //   - If your domain is registered with a registrar other than Route 53, you must
     32 //     update the name servers with your registrar to make Route 53 the DNS service for
     33 //     the domain. For more information, see Migrating DNS Service for an Existing
     34 //     Domain to Amazon Route 53 (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html)
     35 //     in the Amazon Route 53 Developer Guide.
     36 //
     37 // When you submit a CreateHostedZone request, the initial status of the hosted
     38 // zone is PENDING . For public hosted zones, this means that the NS and SOA
     39 // records are not yet available on all Route 53 DNS servers. When the NS and SOA
     40 // records are available, the status of the zone changes to INSYNC . The
     41 // CreateHostedZone request requires the caller to have an ec2:DescribeVpcs
     42 // permission. When creating private hosted zones, the Amazon VPC must belong to
     43 // the same partition where the hosted zone is created. A partition is a group of
     44 // Amazon Web Services Regions. Each Amazon Web Services account is scoped to one
     45 // partition. The following are the supported partitions:
     46 //   - aws - Amazon Web Services Regions
     47 //   - aws-cn - China Regions
     48 //   - aws-us-gov - Amazon Web Services GovCloud (US) Region
     49 //
     50 // For more information, see Access Management (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
     51 // in the Amazon Web Services General Reference.
     52 func (c *Client) CreateHostedZone(ctx context.Context, params *CreateHostedZoneInput, optFns ...func(*Options)) (*CreateHostedZoneOutput, error) {
     53 	if params == nil {
     54 		params = &CreateHostedZoneInput{}
     55 	}
     56 
     57 	result, metadata, err := c.invokeOperation(ctx, "CreateHostedZone", params, optFns, c.addOperationCreateHostedZoneMiddlewares)
     58 	if err != nil {
     59 		return nil, err
     60 	}
     61 
     62 	out := result.(*CreateHostedZoneOutput)
     63 	out.ResultMetadata = metadata
     64 	return out, nil
     65 }
     66 
     67 // A complex type that contains information about the request to create a public
     68 // or private hosted zone.
     69 type CreateHostedZoneInput struct {
     70 
     71 	// A unique string that identifies the request and that allows failed
     72 	// CreateHostedZone requests to be retried without the risk of executing the
     73 	// operation twice. You must use a unique CallerReference string every time you
     74 	// submit a CreateHostedZone request. CallerReference can be any unique string,
     75 	// for example, a date/time stamp.
     76 	//
     77 	// This member is required.
     78 	CallerReference *string
     79 
     80 	// The name of the domain. Specify a fully qualified domain name, for example,
     81 	// www.example.com. The trailing dot is optional; Amazon Route 53 assumes that the
     82 	// domain name is fully qualified. This means that Route 53 treats www.example.com
     83 	// (without a trailing dot) and www.example.com. (with a trailing dot) as
     84 	// identical. If you're creating a public hosted zone, this is the name you have
     85 	// registered with your DNS registrar. If your domain name is registered with a
     86 	// registrar other than Route 53, change the name servers for your domain to the
     87 	// set of NameServers that CreateHostedZone returns in DelegationSet .
     88 	//
     89 	// This member is required.
     90 	Name *string
     91 
     92 	// If you want to associate a reusable delegation set with this hosted zone, the
     93 	// ID that Amazon Route 53 assigned to the reusable delegation set when you created
     94 	// it. For more information about reusable delegation sets, see
     95 	// CreateReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html)
     96 	// . If you are using a reusable delegation set to create a public hosted zone for
     97 	// a subdomain, make sure that the parent hosted zone doesn't use one or more of
     98 	// the same name servers. If you have overlapping nameservers, the operation will
     99 	// cause a ConflictingDomainsExist error.
    100 	DelegationSetId *string
    101 
    102 	// (Optional) A complex type that contains the following optional values:
    103 	//   - For public and private hosted zones, an optional comment
    104 	//   - For private hosted zones, an optional PrivateZone element
    105 	// If you don't specify a comment or the PrivateZone element, omit HostedZoneConfig
    106 	// and the other elements.
    107 	HostedZoneConfig *types.HostedZoneConfig
    108 
    109 	// (Private hosted zones only) A complex type that contains information about the
    110 	// Amazon VPC that you're associating with this hosted zone. You can specify only
    111 	// one Amazon VPC when you create a private hosted zone. If you are associating a
    112 	// VPC with a hosted zone with this request, the paramaters VPCId and VPCRegion
    113 	// are also required. To associate additional Amazon VPCs with the hosted zone, use
    114 	// AssociateVPCWithHostedZone (https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html)
    115 	// after you create a hosted zone.
    116 	VPC *types.VPC
    117 
    118 	noSmithyDocumentSerde
    119 }
    120 
    121 // A complex type containing the response information for the hosted zone.
    122 type CreateHostedZoneOutput struct {
    123 
    124 	// A complex type that contains information about the CreateHostedZone request.
    125 	//
    126 	// This member is required.
    127 	ChangeInfo *types.ChangeInfo
    128 
    129 	// A complex type that describes the name servers for this hosted zone.
    130 	//
    131 	// This member is required.
    132 	DelegationSet *types.DelegationSet
    133 
    134 	// A complex type that contains general information about the hosted zone.
    135 	//
    136 	// This member is required.
    137 	HostedZone *types.HostedZone
    138 
    139 	// The unique URL representing the new hosted zone.
    140 	//
    141 	// This member is required.
    142 	Location *string
    143 
    144 	// A complex type that contains information about an Amazon VPC that you
    145 	// associated with this hosted zone.
    146 	VPC *types.VPC
    147 
    148 	// Metadata pertaining to the operation's result.
    149 	ResultMetadata middleware.Metadata
    150 
    151 	noSmithyDocumentSerde
    152 }
    153 
    154 func (c *Client) addOperationCreateHostedZoneMiddlewares(stack *middleware.Stack, options Options) (err error) {
    155 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
    156 		return err
    157 	}
    158 	err = stack.Serialize.Add(&awsRestxml_serializeOpCreateHostedZone{}, middleware.After)
    159 	if err != nil {
    160 		return err
    161 	}
    162 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateHostedZone{}, middleware.After)
    163 	if err != nil {
    164 		return err
    165 	}
    166 	if err := addProtocolFinalizerMiddlewares(stack, options, "CreateHostedZone"); err != nil {
    167 		return fmt.Errorf("add protocol finalizers: %v", err)
    168 	}
    169 
    170 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
    171 		return err
    172 	}
    173 	if err = addSetLoggerMiddleware(stack, options); err != nil {
    174 		return err
    175 	}
    176 	if err = addClientRequestID(stack); err != nil {
    177 		return err
    178 	}
    179 	if err = addComputeContentLength(stack); err != nil {
    180 		return err
    181 	}
    182 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    183 		return err
    184 	}
    185 	if err = addComputePayloadSHA256(stack); err != nil {
    186 		return err
    187 	}
    188 	if err = addRetry(stack, options); err != nil {
    189 		return err
    190 	}
    191 	if err = addRawResponseToMetadata(stack); err != nil {
    192 		return err
    193 	}
    194 	if err = addRecordResponseTiming(stack); err != nil {
    195 		return err
    196 	}
    197 	if err = addClientUserAgent(stack, options); err != nil {
    198 		return err
    199 	}
    200 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    201 		return err
    202 	}
    203 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    204 		return err
    205 	}
    206 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    207 		return err
    208 	}
    209 	if err = addOpCreateHostedZoneValidationMiddleware(stack); err != nil {
    210 		return err
    211 	}
    212 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHostedZone(options.Region), middleware.Before); err != nil {
    213 		return err
    214 	}
    215 	if err = addRecursionDetection(stack); err != nil {
    216 		return err
    217 	}
    218 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    219 		return err
    220 	}
    221 	if err = addResponseErrorMiddleware(stack); err != nil {
    222 		return err
    223 	}
    224 	if err = addSanitizeURLMiddleware(stack); err != nil {
    225 		return err
    226 	}
    227 	if err = addRequestResponseLogging(stack, options); err != nil {
    228 		return err
    229 	}
    230 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    231 		return err
    232 	}
    233 	return nil
    234 }
    235 
    236 func newServiceMetadataMiddleware_opCreateHostedZone(region string) *awsmiddleware.RegisterServiceMetadata {
    237 	return &awsmiddleware.RegisterServiceMetadata{
    238 		Region:        region,
    239 		ServiceID:     ServiceID,
    240 		OperationName: "CreateHostedZone",
    241 	}
    242 }