api_op_Logout.go (4482B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package sso 4 5 import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11 ) 12 13 // Removes the locally stored SSO tokens from the client-side cache and sends an 14 // API call to the IAM Identity Center service to invalidate the corresponding 15 // server-side IAM Identity Center sign in session. If a user uses IAM Identity 16 // Center to access the AWS CLI, the user’s IAM Identity Center sign in session is 17 // used to obtain an IAM session, as specified in the corresponding IAM Identity 18 // Center permission set. More specifically, IAM Identity Center assumes an IAM 19 // role in the target account on behalf of the user, and the corresponding 20 // temporary AWS credentials are returned to the client. After user logout, any 21 // existing IAM role sessions that were created by using IAM Identity Center 22 // permission sets continue based on the duration configured in the permission set. 23 // For more information, see User authentications (https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html) 24 // in 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 (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html) 44 // in the IAM Identity Center OIDC API Reference Guide. 45 // 46 // This member is required. 47 AccessToken *string 48 49 noSmithyDocumentSerde 50 } 51 52 type LogoutOutput struct { 53 // Metadata pertaining to the operation's result. 54 ResultMetadata middleware.Metadata 55 56 noSmithyDocumentSerde 57 } 58 59 func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options Options) (err error) { 60 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 61 return err 62 } 63 err = stack.Serialize.Add(&awsRestjson1_serializeOpLogout{}, middleware.After) 64 if err != nil { 65 return err 66 } 67 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpLogout{}, middleware.After) 68 if err != nil { 69 return err 70 } 71 if err := addProtocolFinalizerMiddlewares(stack, options, "Logout"); err != nil { 72 return fmt.Errorf("add protocol finalizers: %v", err) 73 } 74 75 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 76 return err 77 } 78 if err = addSetLoggerMiddleware(stack, options); err != nil { 79 return err 80 } 81 if err = addClientRequestID(stack); err != nil { 82 return err 83 } 84 if err = addComputeContentLength(stack); err != nil { 85 return err 86 } 87 if err = addResolveEndpointMiddleware(stack, options); err != nil { 88 return err 89 } 90 if err = addRetry(stack, options); err != nil { 91 return err 92 } 93 if err = addRawResponseToMetadata(stack); err != nil { 94 return err 95 } 96 if err = addRecordResponseTiming(stack); err != nil { 97 return err 98 } 99 if err = addClientUserAgent(stack, options); err != nil { 100 return err 101 } 102 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 103 return err 104 } 105 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 106 return err 107 } 108 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 109 return err 110 } 111 if err = addOpLogoutValidationMiddleware(stack); err != nil { 112 return err 113 } 114 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opLogout(options.Region), middleware.Before); err != nil { 115 return err 116 } 117 if err = addRecursionDetection(stack); err != nil { 118 return err 119 } 120 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 121 return err 122 } 123 if err = addResponseErrorMiddleware(stack); err != nil { 124 return err 125 } 126 if err = addRequestResponseLogging(stack, options); err != nil { 127 return err 128 } 129 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 130 return err 131 } 132 return nil 133 } 134 135 func newServiceMetadataMiddleware_opLogout(region string) *awsmiddleware.RegisterServiceMetadata { 136 return &awsmiddleware.RegisterServiceMetadata{ 137 Region: region, 138 ServiceID: ServiceID, 139 OperationName: "Logout", 140 } 141 }