1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package customerprofiles
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/customerprofiles/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Creates a domain, which is a container for all customer data, such as customer
16// profile attributes, object types, profile keys, and encryption keys. You can
17// create multiple domains, and each domain can have multiple third-party
18// integrations. Each Amazon Connect instance can be associated with only one
19// domain. Multiple Amazon Connect instances can be associated with one domain. Use
20// this API or UpdateDomain
21// (https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_UpdateDomain.html)
22// to enable identity resolution
23// (https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_GetMatches.html):
24// set Matching to true.
25func (c *Client) CreateDomain(ctx context.Context, params *CreateDomainInput, optFns ...func(*Options)) (*CreateDomainOutput, error) {
26	if params == nil {
27		params = &CreateDomainInput{}
28	}
29
30	result, metadata, err := c.invokeOperation(ctx, "CreateDomain", params, optFns, c.addOperationCreateDomainMiddlewares)
31	if err != nil {
32		return nil, err
33	}
34
35	out := result.(*CreateDomainOutput)
36	out.ResultMetadata = metadata
37	return out, nil
38}
39
40type CreateDomainInput struct {
41
42	// The default number of days until the data within the domain expires.
43	//
44	// This member is required.
45	DefaultExpirationDays *int32
46
47	// The unique name of the domain.
48	//
49	// This member is required.
50	DomainName *string
51
52	// The URL of the SQS dead letter queue, which is used for reporting errors
53	// associated with ingesting data from third party applications. You must set up a
54	// policy on the DeadLetterQueue for the SendMessage operation to enable Amazon
55	// Connect Customer Profiles to send messages to the DeadLetterQueue.
56	DeadLetterQueueUrl *string
57
58	// The default encryption key, which is an AWS managed key, is used when no
59	// specific type of encryption key is specified. It is used to encrypt all data
60	// before it is placed in permanent or semi-permanent storage.
61	DefaultEncryptionKey *string
62
63	// The process of matching duplicate profiles. If Matching = true, Amazon Connect
64	// Customer Profiles starts a weekly batch process every Saturday at 12AM UTC to
65	// detect duplicate profiles in your domains. After that batch process completes,
66	// use the GetMatches
67	// (https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_GetMatches.html)
68	// API to return and review the results.
69	Matching *types.MatchingRequest
70
71	// The tags used to organize, track, or control access for this resource.
72	Tags map[string]string
73
74	noSmithyDocumentSerde
75}
76
77type CreateDomainOutput struct {
78
79	// The timestamp of when the domain was created.
80	//
81	// This member is required.
82	CreatedAt *time.Time
83
84	// The default number of days until the data within the domain expires.
85	//
86	// This member is required.
87	DefaultExpirationDays *int32
88
89	// The unique name of the domain.
90	//
91	// This member is required.
92	DomainName *string
93
94	// The timestamp of when the domain was most recently edited.
95	//
96	// This member is required.
97	LastUpdatedAt *time.Time
98
99	// The URL of the SQS dead letter queue, which is used for reporting errors
100	// associated with ingesting data from third party applications.
101	DeadLetterQueueUrl *string
102
103	// The default encryption key, which is an AWS managed key, is used when no
104	// specific type of encryption key is specified. It is used to encrypt all data
105	// before it is placed in permanent or semi-permanent storage.
106	DefaultEncryptionKey *string
107
108	// The process of matching duplicate profiles. If Matching = true, Amazon Connect
109	// Customer Profiles starts a weekly batch process every Saturday at 12AM UTC to
110	// detect duplicate profiles in your domains. After that batch process completes,
111	// use the GetMatches
112	// (https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_GetMatches.html)
113	// API to return and review the results.
114	Matching *types.MatchingResponse
115
116	// The tags used to organize, track, or control access for this resource.
117	Tags map[string]string
118
119	// Metadata pertaining to the operation's result.
120	ResultMetadata middleware.Metadata
121
122	noSmithyDocumentSerde
123}
124
125func (c *Client) addOperationCreateDomainMiddlewares(stack *middleware.Stack, options Options) (err error) {
126	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateDomain{}, middleware.After)
127	if err != nil {
128		return err
129	}
130	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateDomain{}, middleware.After)
131	if err != nil {
132		return err
133	}
134	if err = addSetLoggerMiddleware(stack, options); err != nil {
135		return err
136	}
137	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
138		return err
139	}
140	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addResolveEndpointMiddleware(stack, options); err != nil {
144		return err
145	}
146	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
147		return err
148	}
149	if err = addRetryMiddlewares(stack, options); err != nil {
150		return err
151	}
152	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
153		return err
154	}
155	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
156		return err
157	}
158	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
159		return err
160	}
161	if err = addClientUserAgent(stack); err != nil {
162		return err
163	}
164	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
165		return err
166	}
167	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
168		return err
169	}
170	if err = addOpCreateDomainValidationMiddleware(stack); err != nil {
171		return err
172	}
173	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDomain(options.Region), middleware.Before); err != nil {
174		return err
175	}
176	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
177		return err
178	}
179	if err = addResponseErrorMiddleware(stack); err != nil {
180		return err
181	}
182	if err = addRequestResponseLogging(stack, options); err != nil {
183		return err
184	}
185	return nil
186}
187
188func newServiceMetadataMiddleware_opCreateDomain(region string) *awsmiddleware.RegisterServiceMetadata {
189	return &awsmiddleware.RegisterServiceMetadata{
190		Region:        region,
191		ServiceID:     ServiceID,
192		SigningName:   "profile",
193		OperationName: "CreateDomain",
194	}
195}
196