api_op_Logout.go (3974B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package sso 4 5 import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/smithy-go/middleware" 9 smithyhttp "github.com/aws/smithy-go/transport/http" 10 ) 11 12 // Removes the locally stored SSO tokens from the client-side cache and sends an 13 // API call to the IAM Identity Center service to invalidate the corresponding 14 // server-side IAM Identity Center sign in session. If a user uses IAM Identity 15 // Center to access the AWS CLI, the user’s IAM Identity Center sign in session is 16 // used to obtain an IAM session, as specified in the corresponding IAM Identity 17 // Center permission set. More specifically, IAM Identity Center assumes an IAM 18 // role in the target account on behalf of the user, and the corresponding 19 // temporary AWS credentials are returned to the client. After user logout, any 20 // existing IAM role sessions that were created by using IAM Identity Center 21 // permission sets continue based on the duration configured in the permission set. 22 // For more information, see User authentications 23 // (https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html) in 24 // the IAM Identity Center User Guide. 25 func (c *Client) Logout(ctx context.Context, params *LogoutInput, optFns ...func(*Options)) (*LogoutOutput, error) { 26 if params == nil { 27 params = &LogoutInput{} 28 } 29 30 result, metadata, err := c.invokeOperation(ctx, "Logout", params, optFns, c.addOperationLogoutMiddlewares) 31 if err != nil { 32 return nil, err 33 } 34 35 out := result.(*LogoutOutput) 36 out.ResultMetadata = metadata 37 return out, nil 38 } 39 40 type LogoutInput struct { 41 42 // The token issued by the CreateToken API call. For more information, see 43 // CreateToken 44 // (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) 45 // in the IAM Identity Center OIDC API Reference Guide. 46 // 47 // This member is required. 48 AccessToken *string 49 50 noSmithyDocumentSerde 51 } 52 53 type LogoutOutput struct { 54 // Metadata pertaining to the operation's result. 55 ResultMetadata middleware.Metadata 56 57 noSmithyDocumentSerde 58 } 59 60 func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options Options) (err error) { 61 err = stack.Serialize.Add(&awsRestjson1_serializeOpLogout{}, middleware.After) 62 if err != nil { 63 return err 64 } 65 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpLogout{}, middleware.After) 66 if err != nil { 67 return err 68 } 69 if err = addSetLoggerMiddleware(stack, options); err != nil { 70 return err 71 } 72 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 73 return err 74 } 75 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 76 return err 77 } 78 if err = addResolveEndpointMiddleware(stack, options); err != nil { 79 return err 80 } 81 if err = addRetryMiddlewares(stack, options); err != nil { 82 return err 83 } 84 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 85 return err 86 } 87 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 88 return err 89 } 90 if err = addClientUserAgent(stack); err != nil { 91 return err 92 } 93 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 94 return err 95 } 96 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 97 return err 98 } 99 if err = addOpLogoutValidationMiddleware(stack); err != nil { 100 return err 101 } 102 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opLogout(options.Region), middleware.Before); err != nil { 103 return err 104 } 105 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 106 return err 107 } 108 if err = addResponseErrorMiddleware(stack); err != nil { 109 return err 110 } 111 if err = addRequestResponseLogging(stack, options); err != nil { 112 return err 113 } 114 return nil 115 } 116 117 func newServiceMetadataMiddleware_opLogout(region string) *awsmiddleware.RegisterServiceMetadata { 118 return &awsmiddleware.RegisterServiceMetadata{ 119 Region: region, 120 ServiceID: ServiceID, 121 OperationName: "Logout", 122 } 123 }