code.dwrz.net

Go monorepo.
Log | Files | Refs

api_op_GetAccessKeyInfo.go (5002B)


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