code.dwrz.net

Go monorepo.
Log | Files | Refs

api_op_CreateHostedZone.go (9358B)


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