1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package route53domains
4
5import (
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/route53domains/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Transfers a domain from another registrar to Amazon Route 53. When the transfer
15// is complete, the domain is registered either with Amazon Registrar (for .com,
16// .net, and .org domains) or with our registrar associate, Gandi (for all other
17// TLDs). For more information about transferring domains, see the following
18// topics:
19//
20// * For transfer requirements, a detailed procedure, and information
21// about viewing the status of a domain that you're transferring to Route 53, see
22// Transferring Registration for a Domain to Amazon Route 53
23// (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-to-route-53.html)
24// in the Amazon Route 53 Developer Guide.
25//
26// * For information about how to transfer
27// a domain from one AWS account to another, see TransferDomainToAnotherAwsAccount
28// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_TransferDomainToAnotherAwsAccount.html).
29//
30// *
31// For information about how to transfer a domain to another domain registrar, see
32// Transferring a Domain from Amazon Route 53 to Another Registrar
33// (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-from-route-53.html)
34// in the Amazon Route 53 Developer Guide.
35//
36// If the registrar for your domain is
37// also the DNS service provider for the domain, we highly recommend that you
38// transfer your DNS service to Route 53 or to another DNS service provider before
39// you transfer your registration. Some registrars provide free DNS service when
40// you purchase a domain registration. When you transfer the registration, the
41// previous registrar will not renew your domain registration and could end your
42// DNS service at any time. If the registrar for your domain is also the DNS
43// service provider for the domain and you don't transfer DNS service to another
44// provider, your website, email, and the web applications associated with the
45// domain might become unavailable. If the transfer is successful, this method
46// returns an operation ID that you can use to track the progress and completion of
47// the action. If the transfer doesn't complete successfully, the domain registrant
48// will be notified by email.
49func (c *Client) TransferDomain(ctx context.Context, params *TransferDomainInput, optFns ...func(*Options)) (*TransferDomainOutput, error) {
50	if params == nil {
51		params = &TransferDomainInput{}
52	}
53
54	result, metadata, err := c.invokeOperation(ctx, "TransferDomain", params, optFns, addOperationTransferDomainMiddlewares)
55	if err != nil {
56		return nil, err
57	}
58
59	out := result.(*TransferDomainOutput)
60	out.ResultMetadata = metadata
61	return out, nil
62}
63
64// The TransferDomain request includes the following elements.
65type TransferDomainInput struct {
66
67	// Provides detailed contact information.
68	//
69	// This member is required.
70	AdminContact *types.ContactDetail
71
72	// The name of the domain that you want to transfer to Route 53. The top-level
73	// domain (TLD), such as .com, must be a TLD that Route 53 supports. For a list of
74	// supported TLDs, see Domains that You Can Register with Amazon Route 53
75	// (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/registrar-tld-list.html)
76	// in the Amazon Route 53 Developer Guide. The domain name can contain only the
77	// following characters:
78	//
79	// * Letters a through z. Domain names are not case
80	// sensitive.
81	//
82	// * Numbers 0 through 9.
83	//
84	// * Hyphen (-). You can't specify a hyphen at
85	// the beginning or end of a label.
86	//
87	// * Period (.) to separate the labels in the
88	// name, such as the . in example.com.
89	//
90	// This member is required.
91	DomainName *string
92
93	// The number of years that you want to register the domain for. Domains are
94	// registered for a minimum of one year. The maximum period depends on the
95	// top-level domain. Default: 1
96	//
97	// This member is required.
98	DurationInYears *int32
99
100	// Provides detailed contact information.
101	//
102	// This member is required.
103	RegistrantContact *types.ContactDetail
104
105	// Provides detailed contact information.
106	//
107	// This member is required.
108	TechContact *types.ContactDetail
109
110	// The authorization code for the domain. You get this value from the current
111	// registrar.
112	AuthCode *string
113
114	// Indicates whether the domain will be automatically renewed (true) or not
115	// (false). Autorenewal only takes effect after the account is charged. Default:
116	// true
117	AutoRenew *bool
118
119	// Reserved for future use.
120	IdnLangCode *string
121
122	// Contains details for the host and glue IP addresses.
123	Nameservers []types.Nameserver
124
125	// Whether you want to conceal contact information from WHOIS queries. If you
126	// specify true, WHOIS ("who is") queries return contact information either for
127	// Amazon Registrar (for .com, .net, and .org domains) or for our registrar
128	// associate, Gandi (for all other TLDs). If you specify false, WHOIS queries
129	// return the information that you entered for the admin contact. Default: true
130	PrivacyProtectAdminContact *bool
131
132	// Whether you want to conceal contact information from WHOIS queries. If you
133	// specify true, WHOIS ("who is") queries return contact information either for
134	// Amazon Registrar (for .com, .net, and .org domains) or for our registrar
135	// associate, Gandi (for all other TLDs). If you specify false, WHOIS queries
136	// return the information that you entered for the registrant contact (domain
137	// owner). Default: true
138	PrivacyProtectRegistrantContact *bool
139
140	// Whether you want to conceal contact information from WHOIS queries. If you
141	// specify true, WHOIS ("who is") queries return contact information either for
142	// Amazon Registrar (for .com, .net, and .org domains) or for our registrar
143	// associate, Gandi (for all other TLDs). If you specify false, WHOIS queries
144	// return the information that you entered for the technical contact. Default: true
145	PrivacyProtectTechContact *bool
146}
147
148// The TransferDomain response includes the following element.
149type TransferDomainOutput struct {
150
151	// Identifier for tracking the progress of the request. To query the operation
152	// status, use GetOperationDetail
153	// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html).
154	//
155	// This member is required.
156	OperationId *string
157
158	// Metadata pertaining to the operation's result.
159	ResultMetadata middleware.Metadata
160}
161
162func addOperationTransferDomainMiddlewares(stack *middleware.Stack, options Options) (err error) {
163	err = stack.Serialize.Add(&awsAwsjson11_serializeOpTransferDomain{}, middleware.After)
164	if err != nil {
165		return err
166	}
167	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTransferDomain{}, middleware.After)
168	if err != nil {
169		return err
170	}
171	if err = addSetLoggerMiddleware(stack, options); err != nil {
172		return err
173	}
174	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
175		return err
176	}
177	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
178		return err
179	}
180	if err = addResolveEndpointMiddleware(stack, options); err != nil {
181		return err
182	}
183	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
184		return err
185	}
186	if err = addRetryMiddlewares(stack, options); err != nil {
187		return err
188	}
189	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
190		return err
191	}
192	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
193		return err
194	}
195	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
196		return err
197	}
198	if err = addClientUserAgent(stack); err != nil {
199		return err
200	}
201	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
202		return err
203	}
204	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
205		return err
206	}
207	if err = addOpTransferDomainValidationMiddleware(stack); err != nil {
208		return err
209	}
210	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTransferDomain(options.Region), middleware.Before); err != nil {
211		return err
212	}
213	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
214		return err
215	}
216	if err = addResponseErrorMiddleware(stack); err != nil {
217		return err
218	}
219	if err = addRequestResponseLogging(stack, options); err != nil {
220		return err
221	}
222	return nil
223}
224
225func newServiceMetadataMiddleware_opTransferDomain(region string) *awsmiddleware.RegisterServiceMetadata {
226	return &awsmiddleware.RegisterServiceMetadata{
227		Region:        region,
228		ServiceID:     ServiceID,
229		SigningName:   "route53domains",
230		OperationName: "TransferDomain",
231	}
232}
233