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