src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_GetAccessKeyInfo.go (6867B)


      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.
     14 //
     15 // Access keys consist of two parts: an access key ID (for example,
     16 // AKIAIOSFODNN7EXAMPLE ) and a secret access key (for example,
     17 // wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ). For more information about access
     18 // keys, see [Managing Access Keys for IAM Users]in the IAM User Guide.
     19 //
     20 // When you pass an access key ID to this operation, it returns the ID of the
     21 // Amazon Web Services account to which the keys belong. Access key IDs beginning
     22 // with AKIA are long-term credentials for an IAM user or the Amazon Web Services
     23 // account root user. Access key IDs beginning with ASIA are temporary credentials
     24 // that are created using STS operations. If the account in the response belongs to
     25 // you, you can sign in as the root user and review your root user access keys.
     26 // Then, you can pull a [credentials report]to learn which IAM user owns the keys. To learn who
     27 // requested the temporary credentials for an ASIA access key, view the STS events
     28 // in your [CloudTrail logs]in the IAM User Guide.
     29 //
     30 // This operation does not indicate the state of the access key. The key might be
     31 // active, inactive, or deleted. Active keys might not have permissions to perform
     32 // an operation. Providing a deleted access key might return an error that the key
     33 // doesn't exist.
     34 //
     35 // [credentials report]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html
     36 // [CloudTrail logs]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html
     37 // [Managing Access Keys for IAM Users]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
     38 func (c *Client) GetAccessKeyInfo(ctx context.Context, params *GetAccessKeyInfoInput, optFns ...func(*Options)) (*GetAccessKeyInfoOutput, error) {
     39 	if params == nil {
     40 		params = &GetAccessKeyInfoInput{}
     41 	}
     42 
     43 	result, metadata, err := c.invokeOperation(ctx, "GetAccessKeyInfo", params, optFns, c.addOperationGetAccessKeyInfoMiddlewares)
     44 	if err != nil {
     45 		return nil, err
     46 	}
     47 
     48 	out := result.(*GetAccessKeyInfoOutput)
     49 	out.ResultMetadata = metadata
     50 	return out, nil
     51 }
     52 
     53 type GetAccessKeyInfoInput struct {
     54 
     55 	// The identifier of an access key.
     56 	//
     57 	// This parameter allows (through its regex pattern) a string of characters that
     58 	// can consist of any upper- or lowercase letter or digit.
     59 	//
     60 	// This member is required.
     61 	AccessKeyId *string
     62 
     63 	noSmithyDocumentSerde
     64 }
     65 
     66 type GetAccessKeyInfoOutput struct {
     67 
     68 	// The number used to identify the Amazon Web Services account.
     69 	Account *string
     70 
     71 	// Metadata pertaining to the operation's result.
     72 	ResultMetadata middleware.Metadata
     73 
     74 	noSmithyDocumentSerde
     75 }
     76 
     77 func (c *Client) addOperationGetAccessKeyInfoMiddlewares(stack *middleware.Stack, options Options) (err error) {
     78 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
     79 		return err
     80 	}
     81 	err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccessKeyInfo{}, middleware.After)
     82 	if err != nil {
     83 		return err
     84 	}
     85 	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccessKeyInfo{}, middleware.After)
     86 	if err != nil {
     87 		return err
     88 	}
     89 	if err := addProtocolFinalizerMiddlewares(stack, options, "GetAccessKeyInfo"); err != nil {
     90 		return fmt.Errorf("add protocol finalizers: %v", err)
     91 	}
     92 
     93 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
     94 		return err
     95 	}
     96 	if err = addSetLoggerMiddleware(stack, options); err != nil {
     97 		return err
     98 	}
     99 	if err = addClientRequestID(stack); err != nil {
    100 		return err
    101 	}
    102 	if err = addComputeContentLength(stack); err != nil {
    103 		return err
    104 	}
    105 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    106 		return err
    107 	}
    108 	if err = addComputePayloadSHA256(stack); err != nil {
    109 		return err
    110 	}
    111 	if err = addRetry(stack, options); err != nil {
    112 		return err
    113 	}
    114 	if err = addRawResponseToMetadata(stack); err != nil {
    115 		return err
    116 	}
    117 	if err = addRecordResponseTiming(stack); err != nil {
    118 		return err
    119 	}
    120 	if err = addSpanRetryLoop(stack, options); err != nil {
    121 		return err
    122 	}
    123 	if err = addClientUserAgent(stack, options); err != nil {
    124 		return err
    125 	}
    126 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    127 		return err
    128 	}
    129 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    130 		return err
    131 	}
    132 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    133 		return err
    134 	}
    135 	if err = addTimeOffsetBuild(stack, c); err != nil {
    136 		return err
    137 	}
    138 	if err = addUserAgentRetryMode(stack, options); err != nil {
    139 		return err
    140 	}
    141 	if err = addCredentialSource(stack, options); err != nil {
    142 		return err
    143 	}
    144 	if err = addOpGetAccessKeyInfoValidationMiddleware(stack); err != nil {
    145 		return err
    146 	}
    147 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessKeyInfo(options.Region), middleware.Before); err != nil {
    148 		return err
    149 	}
    150 	if err = addRecursionDetection(stack); err != nil {
    151 		return err
    152 	}
    153 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    154 		return err
    155 	}
    156 	if err = addResponseErrorMiddleware(stack); err != nil {
    157 		return err
    158 	}
    159 	if err = addRequestResponseLogging(stack, options); err != nil {
    160 		return err
    161 	}
    162 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    163 		return err
    164 	}
    165 	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
    166 		return err
    167 	}
    168 	if err = addInterceptAttempt(stack, options); err != nil {
    169 		return err
    170 	}
    171 	if err = addInterceptExecution(stack, options); err != nil {
    172 		return err
    173 	}
    174 	if err = addInterceptBeforeSerialization(stack, options); err != nil {
    175 		return err
    176 	}
    177 	if err = addInterceptAfterSerialization(stack, options); err != nil {
    178 		return err
    179 	}
    180 	if err = addInterceptBeforeSigning(stack, options); err != nil {
    181 		return err
    182 	}
    183 	if err = addInterceptAfterSigning(stack, options); err != nil {
    184 		return err
    185 	}
    186 	if err = addInterceptTransmit(stack, options); err != nil {
    187 		return err
    188 	}
    189 	if err = addInterceptBeforeDeserialization(stack, options); err != nil {
    190 		return err
    191 	}
    192 	if err = addInterceptAfterDeserialization(stack, options); err != nil {
    193 		return err
    194 	}
    195 	if err = addSpanInitializeStart(stack); err != nil {
    196 		return err
    197 	}
    198 	if err = addSpanInitializeEnd(stack); err != nil {
    199 		return err
    200 	}
    201 	if err = addSpanBuildRequestStart(stack); err != nil {
    202 		return err
    203 	}
    204 	if err = addSpanBuildRequestEnd(stack); err != nil {
    205 		return err
    206 	}
    207 	return nil
    208 }
    209 
    210 func newServiceMetadataMiddleware_opGetAccessKeyInfo(region string) *awsmiddleware.RegisterServiceMetadata {
    211 	return &awsmiddleware.RegisterServiceMetadata{
    212 		Region:        region,
    213 		ServiceID:     ServiceID,
    214 		OperationName: "GetAccessKeyInfo",
    215 	}
    216 }