api_op_Logout.go 3.9 KB

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