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 IAMpolicy 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, c.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 Amazon Web Services account.
36	//
37	// This member is required.
38	AssignmentName *string
39
40	// The ID of the Amazon Web Services account that contains the IAMpolicy
41	// assignment.
42	//
43	// This member is required.
44	AwsAccountId *string
45
46	// The namespace of the assignment.
47	//
48	// This member is required.
49	Namespace *string
50
51	// The status of the assignment. Possible values are as follows:
52	//
53	// * ENABLED -
54	// Anything specified in this assignment is used when creating the data source.
55	//
56	// *
57	// DISABLED - This assignment isn't used when creating the data source.
58	//
59	// * DRAFT -
60	// This assignment is an unfinished draft and isn't used when creating the data
61	// source.
62	AssignmentStatus types.AssignmentStatus
63
64	// The Amazon QuickSight users, groups, or both that you want to assign the policy
65	// to.
66	Identities map[string][]string
67
68	// The ARN for the IAMpolicy to apply to the Amazon QuickSight users and groups
69	// specified in this assignment.
70	PolicyArn *string
71
72	noSmithyDocumentSerde
73}
74
75type UpdateIAMPolicyAssignmentOutput struct {
76
77	// The ID of the assignment.
78	AssignmentId *string
79
80	// The name of the assignment or rule.
81	AssignmentName *string
82
83	// The status of the assignment. Possible values are as follows:
84	//
85	// * ENABLED -
86	// Anything specified in this assignment is used when creating the data source.
87	//
88	// *
89	// DISABLED - This assignment isn't used when creating the data source.
90	//
91	// * DRAFT -
92	// This assignment is an unfinished draft and isn't used when creating the data
93	// source.
94	AssignmentStatus types.AssignmentStatus
95
96	// The Amazon QuickSight users, groups, or both that the IAMpolicy is assigned to.
97	Identities map[string][]string
98
99	// The ARN for the IAMpolicy applied to the Amazon QuickSight users and groups
100	// specified in this assignment.
101	PolicyArn *string
102
103	// The Amazon Web Services request ID for this operation.
104	RequestId *string
105
106	// The HTTP status of the request.
107	Status int32
108
109	// Metadata pertaining to the operation's result.
110	ResultMetadata middleware.Metadata
111
112	noSmithyDocumentSerde
113}
114
115func (c *Client) addOperationUpdateIAMPolicyAssignmentMiddlewares(stack *middleware.Stack, options Options) (err error) {
116	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateIAMPolicyAssignment{}, middleware.After)
117	if err != nil {
118		return err
119	}
120	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateIAMPolicyAssignment{}, middleware.After)
121	if err != nil {
122		return err
123	}
124	if err = addSetLoggerMiddleware(stack, options); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addResolveEndpointMiddleware(stack, options); err != nil {
134		return err
135	}
136	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
137		return err
138	}
139	if err = addRetryMiddlewares(stack, options); err != nil {
140		return err
141	}
142	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
143		return err
144	}
145	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
146		return err
147	}
148	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
149		return err
150	}
151	if err = addClientUserAgent(stack); err != nil {
152		return err
153	}
154	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
155		return err
156	}
157	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addOpUpdateIAMPolicyAssignmentValidationMiddleware(stack); err != nil {
161		return err
162	}
163	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIAMPolicyAssignment(options.Region), middleware.Before); err != nil {
164		return err
165	}
166	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
167		return err
168	}
169	if err = addResponseErrorMiddleware(stack); err != nil {
170		return err
171	}
172	if err = addRequestResponseLogging(stack, options); err != nil {
173		return err
174	}
175	return nil
176}
177
178func newServiceMetadataMiddleware_opUpdateIAMPolicyAssignment(region string) *awsmiddleware.RegisterServiceMetadata {
179	return &awsmiddleware.RegisterServiceMetadata{
180		Region:        region,
181		ServiceID:     ServiceID,
182		SigningName:   "quicksight",
183		OperationName: "UpdateIAMPolicyAssignment",
184	}
185}
186