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