1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package quicksight
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/quicksight/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates an existing IAM policy assignment. This operation updates only the
15// optional parameter or parameters that are specified in the request. This
16// overwrites all of the users included in Identities.
17func (c *Client) UpdateIAMPolicyAssignment(ctx context.Context, params *UpdateIAMPolicyAssignmentInput, optFns ...func(*Options)) (*UpdateIAMPolicyAssignmentOutput, error) {
18	if params == nil {
19		params = &UpdateIAMPolicyAssignmentInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "UpdateIAMPolicyAssignment", params, optFns, addOperationUpdateIAMPolicyAssignmentMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*UpdateIAMPolicyAssignmentOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type UpdateIAMPolicyAssignmentInput struct {
33
34	// The name of the assignment, also called a rule. This name must be unique within
35	// an AWS account.
36	//
37	// This member is required.
38	AssignmentName *string
39
40	// The ID of the AWS account that contains the IAM policy assignment.
41	//
42	// This member is required.
43	AwsAccountId *string
44
45	// The namespace of the assignment.
46	//
47	// This member is required.
48	Namespace *string
49
50	// The status of the assignment. Possible values are as follows:
51	//
52	// * ENABLED -
53	// Anything specified in this assignment is used when creating the data source.
54	//
55	// *
56	// DISABLED - This assignment isn't used when creating the data source.
57	//
58	// * DRAFT -
59	// This assignment is an unfinished draft and isn't used when creating the data
60	// source.
61	AssignmentStatus types.AssignmentStatus
62
63	// The QuickSight users, groups, or both that you want to assign the policy to.
64	Identities map[string][]string
65
66	// The ARN for the IAM policy to apply to the QuickSight users and groups specified
67	// in this assignment.
68	PolicyArn *string
69}
70
71type UpdateIAMPolicyAssignmentOutput struct {
72
73	// The ID of the assignment.
74	AssignmentId *string
75
76	// The name of the assignment or rule.
77	AssignmentName *string
78
79	// The status of the assignment. Possible values are as follows:
80	//
81	// * ENABLED -
82	// Anything specified in this assignment is used when creating the data source.
83	//
84	// *
85	// DISABLED - This assignment isn't used when creating the data source.
86	//
87	// * DRAFT -
88	// This assignment is an unfinished draft and isn't used when creating the data
89	// source.
90	AssignmentStatus types.AssignmentStatus
91
92	// The QuickSight users, groups, or both that the IAM policy is assigned to.
93	Identities map[string][]string
94
95	// The ARN for the IAM policy applied to the QuickSight users and groups specified
96	// in this assignment.
97	PolicyArn *string
98
99	// The AWS request ID for this operation.
100	RequestId *string
101
102	// The HTTP status of the request.
103	Status int32
104
105	// Metadata pertaining to the operation's result.
106	ResultMetadata middleware.Metadata
107}
108
109func addOperationUpdateIAMPolicyAssignmentMiddlewares(stack *middleware.Stack, options Options) (err error) {
110	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateIAMPolicyAssignment{}, middleware.After)
111	if err != nil {
112		return err
113	}
114	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateIAMPolicyAssignment{}, middleware.After)
115	if err != nil {
116		return err
117	}
118	if err = addSetLoggerMiddleware(stack, options); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addResolveEndpointMiddleware(stack, options); err != nil {
128		return err
129	}
130	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
131		return err
132	}
133	if err = addRetryMiddlewares(stack, options); err != nil {
134		return err
135	}
136	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
137		return err
138	}
139	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
140		return err
141	}
142	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
143		return err
144	}
145	if err = addClientUserAgent(stack); err != nil {
146		return err
147	}
148	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
149		return err
150	}
151	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addOpUpdateIAMPolicyAssignmentValidationMiddleware(stack); err != nil {
155		return err
156	}
157	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIAMPolicyAssignment(options.Region), middleware.Before); err != nil {
158		return err
159	}
160	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
161		return err
162	}
163	if err = addResponseErrorMiddleware(stack); err != nil {
164		return err
165	}
166	if err = addRequestResponseLogging(stack, options); err != nil {
167		return err
168	}
169	return nil
170}
171
172func newServiceMetadataMiddleware_opUpdateIAMPolicyAssignment(region string) *awsmiddleware.RegisterServiceMetadata {
173	return &awsmiddleware.RegisterServiceMetadata{
174		Region:        region,
175		ServiceID:     ServiceID,
176		SigningName:   "quicksight",
177		OperationName: "UpdateIAMPolicyAssignment",
178	}
179}
180