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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Transfers a domain from the current AWS account to another AWS account. Note the
14// following:
15//
16// * The AWS account that you're transferring the domain to must accept
17// the transfer. If the other account doesn't accept the transfer within 3 days, we
18// cancel the transfer. See AcceptDomainTransferFromAnotherAwsAccount
19// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_AcceptDomainTransferFromAnotherAwsAccount.html).
20//
21// *
22// You can cancel the transfer before the other account accepts it. See
23// CancelDomainTransferToAnotherAwsAccount
24// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_CancelDomainTransferToAnotherAwsAccount.html).
25//
26// *
27// The other account can reject the transfer. See
28// RejectDomainTransferFromAnotherAwsAccount
29// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_RejectDomainTransferFromAnotherAwsAccount.html).
30//
31// When
32// you transfer a domain from one AWS account to another, Route 53 doesn't transfer
33// the hosted zone that is associated with the domain. DNS resolution isn't
34// affected if the domain and the hosted zone are owned by separate accounts, so
35// transferring the hosted zone is optional. For information about transferring the
36// hosted zone to another AWS account, see Migrating a Hosted Zone to a Different
37// AWS Account
38// (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-migrating.html)
39// in the Amazon Route 53 Developer Guide. Use either ListOperations
40// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_ListOperations.html)
41// or GetOperationDetail
42// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html)
43// to determine whether the operation succeeded. GetOperationDetail
44// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html)
45// provides additional information, for example, Domain Transfer from Aws Account
46// 111122223333 has been cancelled.
47func (c *Client) TransferDomainToAnotherAwsAccount(ctx context.Context, params *TransferDomainToAnotherAwsAccountInput, optFns ...func(*Options)) (*TransferDomainToAnotherAwsAccountOutput, error) {
48	if params == nil {
49		params = &TransferDomainToAnotherAwsAccountInput{}
50	}
51
52	result, metadata, err := c.invokeOperation(ctx, "TransferDomainToAnotherAwsAccount", params, optFns, addOperationTransferDomainToAnotherAwsAccountMiddlewares)
53	if err != nil {
54		return nil, err
55	}
56
57	out := result.(*TransferDomainToAnotherAwsAccountOutput)
58	out.ResultMetadata = metadata
59	return out, nil
60}
61
62// The TransferDomainToAnotherAwsAccount request includes the following elements.
63type TransferDomainToAnotherAwsAccountInput struct {
64
65	// The account ID of the AWS account that you want to transfer the domain to, for
66	// example, 111122223333.
67	//
68	// This member is required.
69	AccountId *string
70
71	// The name of the domain that you want to transfer from the current AWS account to
72	// another account.
73	//
74	// This member is required.
75	DomainName *string
76}
77
78// The TransferDomainToAnotherAwsAccount response includes the following elements.
79type TransferDomainToAnotherAwsAccountOutput struct {
80
81	// Identifier for tracking the progress of the request. To query the operation
82	// status, use GetOperationDetail
83	// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html).
84	OperationId *string
85
86	// To finish transferring a domain to another AWS account, the account that the
87	// domain is being transferred to must submit an
88	// AcceptDomainTransferFromAnotherAwsAccount
89	// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_AcceptDomainTransferFromAnotherAwsAccount.html)
90	// request. The request must include the value of the Password element that was
91	// returned in the TransferDomainToAnotherAwsAccount response.
92	Password *string
93
94	// Metadata pertaining to the operation's result.
95	ResultMetadata middleware.Metadata
96}
97
98func addOperationTransferDomainToAnotherAwsAccountMiddlewares(stack *middleware.Stack, options Options) (err error) {
99	err = stack.Serialize.Add(&awsAwsjson11_serializeOpTransferDomainToAnotherAwsAccount{}, middleware.After)
100	if err != nil {
101		return err
102	}
103	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTransferDomainToAnotherAwsAccount{}, middleware.After)
104	if err != nil {
105		return err
106	}
107	if err = addSetLoggerMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
114		return err
115	}
116	if err = addResolveEndpointMiddleware(stack, options); err != nil {
117		return err
118	}
119	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
120		return err
121	}
122	if err = addRetryMiddlewares(stack, options); err != nil {
123		return err
124	}
125	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
129		return err
130	}
131	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
132		return err
133	}
134	if err = addClientUserAgent(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
138		return err
139	}
140	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addOpTransferDomainToAnotherAwsAccountValidationMiddleware(stack); err != nil {
144		return err
145	}
146	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTransferDomainToAnotherAwsAccount(options.Region), middleware.Before); 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	return nil
159}
160
161func newServiceMetadataMiddleware_opTransferDomainToAnotherAwsAccount(region string) *awsmiddleware.RegisterServiceMetadata {
162	return &awsmiddleware.RegisterServiceMetadata{
163		Region:        region,
164		ServiceID:     ServiceID,
165		SigningName:   "route53domains",
166		OperationName: "TransferDomainToAnotherAwsAccount",
167	}
168}
169