api_op_GetDelegatedAccessToken.go (3324B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package sts 4 5 import ( 6 "context" 7 8 "github.com/aws/aws-sdk-go-v2/service/sts/types" 9 "github.com/aws/smithy-go/middleware" 10 ) 11 12 // Exchanges a trade-in token for temporary Amazon Web Services credentials with 13 // the permissions associated with the assumed principal. This operation allows you 14 // to obtain credentials for a specific principal based on a trade-in token, 15 // enabling delegation of access to Amazon Web Services resources. 16 func (c *Client) GetDelegatedAccessToken(ctx context.Context, params *GetDelegatedAccessTokenInput, optFns ...func(*Options)) (*GetDelegatedAccessTokenOutput, error) { 17 if params == nil { 18 params = &GetDelegatedAccessTokenInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "GetDelegatedAccessToken", params, optFns, c.addOperationGetDelegatedAccessTokenMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*GetDelegatedAccessTokenOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29 } 30 31 type GetDelegatedAccessTokenInput struct { 32 33 // The token to exchange for temporary Amazon Web Services credentials. This token 34 // must be valid and unexpired at the time of the request. 35 // 36 // This member is required. 37 TradeInToken *string 38 39 noSmithyDocumentSerde 40 } 41 42 type GetDelegatedAccessTokenOutput struct { 43 44 // The Amazon Resource Name (ARN) of the principal that was assumed when obtaining 45 // the delegated access token. This ARN identifies the IAM entity whose permissions 46 // are granted by the temporary credentials. 47 AssumedPrincipal *string 48 49 // Amazon Web Services credentials for API authentication. 50 Credentials *types.Credentials 51 52 // The percentage of the maximum policy size that is used by the session policy. 53 // The policy size is calculated as the sum of all the session policies and 54 // permission boundaries attached to the session. If the packed size exceeds 100%, 55 // the request fails. 56 PackedPolicySize *int32 57 58 // Metadata pertaining to the operation's result. 59 ResultMetadata middleware.Metadata 60 61 noSmithyDocumentSerde 62 } 63 64 func (c *Client) addOperationGetDelegatedAccessTokenMiddlewares(stack *middleware.Stack, options Options) (err error) { 65 err = stack.Serialize.Add(&awsAwsquery_serializeOpGetDelegatedAccessToken{}, middleware.After) 66 if err != nil { 67 return err 68 } 69 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetDelegatedAccessToken{}, middleware.After) 70 if err != nil { 71 return err 72 } 73 74 if err = addComputeContentLength(stack); err != nil { 75 return err 76 } 77 if err = addResolveEndpointMiddleware(stack, options); err != nil { 78 return err 79 } 80 if err = addComputePayloadSHA256(stack); err != nil { 81 return err 82 } 83 if err = addRecordResponseTiming(stack, options); err != nil { 84 return err 85 } 86 if err = addCredentialSource(stack, options); err != nil { 87 return err 88 } 89 if err = addOpGetDelegatedAccessTokenValidationMiddleware(stack); err != nil { 90 return err 91 } 92 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 93 return err 94 } 95 if err = addResponseErrorMiddleware(stack); err != nil { 96 return err 97 } 98 if err = addRequestResponseLogging(stack, options); err != nil { 99 return err 100 } 101 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 102 return err 103 } 104 if err = addInterceptors(stack, options); err != nil { 105 return err 106 } 107 return nil 108 }