src

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

api_op_CreateHostedZone.go (8881B)


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