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)
13
14// Creates a standard profile. A standard profile represents the following
15// attributes for a customer profile in a domain.
16func (c *Client) CreateProfile(ctx context.Context, params *CreateProfileInput, optFns ...func(*Options)) (*CreateProfileOutput, error) {
17	if params == nil {
18		params = &CreateProfileInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateProfile", params, optFns, addOperationCreateProfileMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateProfileOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type CreateProfileInput struct {
32
33	// The unique name of the domain.
34	//
35	// This member is required.
36	DomainName *string
37
38	// A unique account number that you have given to the customer.
39	AccountNumber *string
40
41	// Any additional information relevant to the customer’s profile.
42	AdditionalInformation *string
43
44	// A generic address associated with the customer that is not mailing, shipping, or
45	// billing.
46	Address *types.Address
47
48	// A key value pair of attributes of a customer profile.
49	Attributes map[string]string
50
51	// The customer’s billing address.
52	BillingAddress *types.Address
53
54	// The customer’s birth date.
55	BirthDate *string
56
57	// The customer’s business email address.
58	BusinessEmailAddress *string
59
60	// The name of the customer’s business.
61	BusinessName *string
62
63	// The customer’s business phone number.
64	BusinessPhoneNumber *string
65
66	// The customer’s email address, which has not been specified as a personal or
67	// business address.
68	EmailAddress *string
69
70	// The customer’s first name.
71	FirstName *string
72
73	// The gender with which the customer identifies.
74	Gender types.Gender
75
76	// The customer’s home phone number.
77	HomePhoneNumber *string
78
79	// The customer’s last name.
80	LastName *string
81
82	// The customer’s mailing address.
83	MailingAddress *types.Address
84
85	// The customer’s middle name.
86	MiddleName *string
87
88	// The customer’s mobile phone number.
89	MobilePhoneNumber *string
90
91	// The type of profile used to describe the customer.
92	PartyType types.PartyType
93
94	// The customer’s personal email address.
95	PersonalEmailAddress *string
96
97	// The customer’s phone number, which has not been specified as a mobile, home, or
98	// business number.
99	PhoneNumber *string
100
101	// The customer’s shipping address.
102	ShippingAddress *types.Address
103}
104
105type CreateProfileOutput struct {
106
107	// The unique identifier of a customer profile.
108	//
109	// This member is required.
110	ProfileId *string
111
112	// Metadata pertaining to the operation's result.
113	ResultMetadata middleware.Metadata
114}
115
116func addOperationCreateProfileMiddlewares(stack *middleware.Stack, options Options) (err error) {
117	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateProfile{}, middleware.After)
118	if err != nil {
119		return err
120	}
121	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateProfile{}, middleware.After)
122	if err != nil {
123		return err
124	}
125	if err = addSetLoggerMiddleware(stack, options); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addResolveEndpointMiddleware(stack, options); err != nil {
135		return err
136	}
137	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
138		return err
139	}
140	if err = addRetryMiddlewares(stack, options); err != nil {
141		return err
142	}
143	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
144		return err
145	}
146	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
147		return err
148	}
149	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
150		return err
151	}
152	if err = addClientUserAgent(stack); err != nil {
153		return err
154	}
155	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
156		return err
157	}
158	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
159		return err
160	}
161	if err = addOpCreateProfileValidationMiddleware(stack); err != nil {
162		return err
163	}
164	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateProfile(options.Region), middleware.Before); err != nil {
165		return err
166	}
167	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
168		return err
169	}
170	if err = addResponseErrorMiddleware(stack); err != nil {
171		return err
172	}
173	if err = addRequestResponseLogging(stack, options); err != nil {
174		return err
175	}
176	return nil
177}
178
179func newServiceMetadataMiddleware_opCreateProfile(region string) *awsmiddleware.RegisterServiceMetadata {
180	return &awsmiddleware.RegisterServiceMetadata{
181		Region:        region,
182		ServiceID:     ServiceID,
183		SigningName:   "profile",
184		OperationName: "CreateProfile",
185	}
186}
187