1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package sesv2
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// Updates the specified sending authorization policy for the given identity (an
14// email address or a domain). This API returns successfully even if a policy with
15// the specified name does not exist. This API is for the identity owner only. If
16// you have not verified the identity, this API will return an error. Sending
17// authorization is a feature that enables an identity owner to authorize other
18// senders to use its identities. For information about using sending
19// authorization, see the Amazon SES Developer Guide
20// (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html).
21// You can execute this operation no more than once per second.
22func (c *Client) UpdateEmailIdentityPolicy(ctx context.Context, params *UpdateEmailIdentityPolicyInput, optFns ...func(*Options)) (*UpdateEmailIdentityPolicyOutput, error) {
23	if params == nil {
24		params = &UpdateEmailIdentityPolicyInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "UpdateEmailIdentityPolicy", params, optFns, addOperationUpdateEmailIdentityPolicyMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*UpdateEmailIdentityPolicyOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37// Represents a request to update a sending authorization policy for an identity.
38// Sending authorization is an Amazon SES feature that enables you to authorize
39// other senders to use your identities. For information, see the Amazon SES
40// Developer Guide
41// (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization-identity-owner-tasks-management.html).
42type UpdateEmailIdentityPolicyInput struct {
43
44	// The email identity for which you want to update policy.
45	//
46	// This member is required.
47	EmailIdentity *string
48
49	// The text of the policy in JSON format. The policy cannot exceed 4 KB. For
50	// information about the syntax of sending authorization policies, see the Amazon
51	// SES Developer Guide
52	// (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization-policies.html).
53	//
54	// This member is required.
55	Policy *string
56
57	// The name of the policy. The policy name cannot exceed 64 characters and can only
58	// include alphanumeric characters, dashes, and underscores.
59	//
60	// This member is required.
61	PolicyName *string
62}
63
64// An HTTP 200 response if the request succeeds, or an error message if the request
65// fails.
66type UpdateEmailIdentityPolicyOutput struct {
67	// Metadata pertaining to the operation's result.
68	ResultMetadata middleware.Metadata
69}
70
71func addOperationUpdateEmailIdentityPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
72	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateEmailIdentityPolicy{}, middleware.After)
73	if err != nil {
74		return err
75	}
76	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateEmailIdentityPolicy{}, 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 = addOpUpdateEmailIdentityPolicyValidationMiddleware(stack); err != nil {
117		return err
118	}
119	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateEmailIdentityPolicy(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_opUpdateEmailIdentityPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
135	return &awsmiddleware.RegisterServiceMetadata{
136		Region:        region,
137		ServiceID:     ServiceID,
138		SigningName:   "ses",
139		OperationName: "UpdateEmailIdentityPolicy",
140	}
141}
142