...

Source file src/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go

Documentation: github.com/aws/aws-sdk-go-v2/service/sts

     1  // Code generated by smithy-go-codegen DO NOT EDIT.
     2  
     3  package sts
     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  // Returns the account identifier for the specified access key ID. Access keys
    14  // consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE ) and
    15  // a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ).
    16  // For more information about access keys, see Managing Access Keys for IAM Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)
    17  // in the IAM User Guide. When you pass an access key ID to this operation, it
    18  // returns the ID of the Amazon Web Services account to which the keys belong.
    19  // Access key IDs beginning with AKIA are long-term credentials for an IAM user or
    20  // the Amazon Web Services account root user. Access key IDs beginning with ASIA
    21  // are temporary credentials that are created using STS operations. If the account
    22  // in the response belongs to you, you can sign in as the root user and review your
    23  // root user access keys. Then, you can pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html)
    24  // to learn which IAM user owns the keys. To learn who requested the temporary
    25  // credentials for an ASIA access key, view the STS events in your CloudTrail logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html)
    26  // in the IAM User Guide. This operation does not indicate the state of the access
    27  // key. The key might be active, inactive, or deleted. Active keys might not have
    28  // permissions to perform an operation. Providing a deleted access key might return
    29  // an error that the key doesn't exist.
    30  func (c *Client) GetAccessKeyInfo(ctx context.Context, params *GetAccessKeyInfoInput, optFns ...func(*Options)) (*GetAccessKeyInfoOutput, error) {
    31  	if params == nil {
    32  		params = &GetAccessKeyInfoInput{}
    33  	}
    34  
    35  	result, metadata, err := c.invokeOperation(ctx, "GetAccessKeyInfo", params, optFns, c.addOperationGetAccessKeyInfoMiddlewares)
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  
    40  	out := result.(*GetAccessKeyInfoOutput)
    41  	out.ResultMetadata = metadata
    42  	return out, nil
    43  }
    44  
    45  type GetAccessKeyInfoInput struct {
    46  
    47  	// The identifier of an access key. This parameter allows (through its regex
    48  	// pattern) a string of characters that can consist of any upper- or lowercase
    49  	// letter or digit.
    50  	//
    51  	// This member is required.
    52  	AccessKeyId *string
    53  
    54  	noSmithyDocumentSerde
    55  }
    56  
    57  type GetAccessKeyInfoOutput struct {
    58  
    59  	// The number used to identify the Amazon Web Services account.
    60  	Account *string
    61  
    62  	// Metadata pertaining to the operation's result.
    63  	ResultMetadata middleware.Metadata
    64  
    65  	noSmithyDocumentSerde
    66  }
    67  
    68  func (c *Client) addOperationGetAccessKeyInfoMiddlewares(stack *middleware.Stack, options Options) (err error) {
    69  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
    70  		return err
    71  	}
    72  	err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccessKeyInfo{}, middleware.After)
    73  	if err != nil {
    74  		return err
    75  	}
    76  	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccessKeyInfo{}, middleware.After)
    77  	if err != nil {
    78  		return err
    79  	}
    80  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetAccessKeyInfo"); err != nil {
    81  		return fmt.Errorf("add protocol finalizers: %v", err)
    82  	}
    83  
    84  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
    85  		return err
    86  	}
    87  	if err = addSetLoggerMiddleware(stack, options); err != nil {
    88  		return err
    89  	}
    90  	if err = addClientRequestID(stack); err != nil {
    91  		return err
    92  	}
    93  	if err = addComputeContentLength(stack); err != nil {
    94  		return err
    95  	}
    96  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    97  		return err
    98  	}
    99  	if err = addComputePayloadSHA256(stack); err != nil {
   100  		return err
   101  	}
   102  	if err = addRetry(stack, options); err != nil {
   103  		return err
   104  	}
   105  	if err = addRawResponseToMetadata(stack); err != nil {
   106  		return err
   107  	}
   108  	if err = addRecordResponseTiming(stack); err != nil {
   109  		return err
   110  	}
   111  	if err = addClientUserAgent(stack, options); err != nil {
   112  		return err
   113  	}
   114  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
   115  		return err
   116  	}
   117  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
   118  		return err
   119  	}
   120  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
   121  		return err
   122  	}
   123  	if err = addOpGetAccessKeyInfoValidationMiddleware(stack); err != nil {
   124  		return err
   125  	}
   126  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessKeyInfo(options.Region), middleware.Before); err != nil {
   127  		return err
   128  	}
   129  	if err = addRecursionDetection(stack); err != nil {
   130  		return err
   131  	}
   132  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
   133  		return err
   134  	}
   135  	if err = addResponseErrorMiddleware(stack); err != nil {
   136  		return err
   137  	}
   138  	if err = addRequestResponseLogging(stack, options); err != nil {
   139  		return err
   140  	}
   141  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
   142  		return err
   143  	}
   144  	return nil
   145  }
   146  
   147  func newServiceMetadataMiddleware_opGetAccessKeyInfo(region string) *awsmiddleware.RegisterServiceMetadata {
   148  	return &awsmiddleware.RegisterServiceMetadata{
   149  		Region:        region,
   150  		ServiceID:     ServiceID,
   151  		OperationName: "GetAccessKeyInfo",
   152  	}
   153  }
   154  

View as plain text