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)
12
13// Associates a new key value with a specific profile, such as a Contact Trace
14// Record (CTR) ContactId. A profile object can have a single unique key and any
15// number of additional keys that can be used to identify the profile that it
16// belongs to.
17func (c *Client) AddProfileKey(ctx context.Context, params *AddProfileKeyInput, optFns ...func(*Options)) (*AddProfileKeyOutput, error) {
18	if params == nil {
19		params = &AddProfileKeyInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "AddProfileKey", params, optFns, c.addOperationAddProfileKeyMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*AddProfileKeyOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type AddProfileKeyInput struct {
33
34	// The unique name of the domain.
35	//
36	// This member is required.
37	DomainName *string
38
39	// A searchable identifier of a customer profile.
40	//
41	// This member is required.
42	KeyName *string
43
44	// The unique identifier of a customer profile.
45	//
46	// This member is required.
47	ProfileId *string
48
49	// A list of key values.
50	//
51	// This member is required.
52	Values []string
53
54	noSmithyDocumentSerde
55}
56
57type AddProfileKeyOutput struct {
58
59	// A searchable identifier of a customer profile.
60	KeyName *string
61
62	// A list of key values.
63	Values []string
64
65	// Metadata pertaining to the operation's result.
66	ResultMetadata middleware.Metadata
67
68	noSmithyDocumentSerde
69}
70
71func (c *Client) addOperationAddProfileKeyMiddlewares(stack *middleware.Stack, options Options) (err error) {
72	err = stack.Serialize.Add(&awsRestjson1_serializeOpAddProfileKey{}, middleware.After)
73	if err != nil {
74		return err
75	}
76	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAddProfileKey{}, middleware.After)
77	if err != nil {
78		return err
79	}
80	if err = addSetLoggerMiddleware(stack, options); err != nil {
81		return err
82	}
83	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
84		return err
85	}
86	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
87		return err
88	}
89	if err = addResolveEndpointMiddleware(stack, options); err != nil {
90		return err
91	}
92	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
93		return err
94	}
95	if err = addRetryMiddlewares(stack, options); err != nil {
96		return err
97	}
98	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
102		return err
103	}
104	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
105		return err
106	}
107	if err = addClientUserAgent(stack); err != nil {
108		return err
109	}
110	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
114		return err
115	}
116	if err = addOpAddProfileKeyValidationMiddleware(stack); err != nil {
117		return err
118	}
119	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddProfileKey(options.Region), middleware.Before); err != nil {
120		return err
121	}
122	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addResponseErrorMiddleware(stack); err != nil {
126		return err
127	}
128	if err = addRequestResponseLogging(stack, options); err != nil {
129		return err
130	}
131	return nil
132}
133
134func newServiceMetadataMiddleware_opAddProfileKey(region string) *awsmiddleware.RegisterServiceMetadata {
135	return &awsmiddleware.RegisterServiceMetadata{
136		Region:        region,
137		ServiceID:     ServiceID,
138		SigningName:   "profile",
139		OperationName: "AddProfileKey",
140	}
141}
142