1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package apigateway 4 5import ( 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 "time" 12) 13 14// Gets information about the current ApiKey resource. 15func (c *Client) GetApiKey(ctx context.Context, params *GetApiKeyInput, optFns ...func(*Options)) (*GetApiKeyOutput, error) { 16 if params == nil { 17 params = &GetApiKeyInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "GetApiKey", params, optFns, c.addOperationGetApiKeyMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*GetApiKeyOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30// A request to get information about the current ApiKey resource. 31type GetApiKeyInput struct { 32 33 // [Required] The identifier of the ApiKey resource. 34 // 35 // This member is required. 36 ApiKey *string 37 38 // A boolean flag to specify whether (true) or not (false) the result contains the 39 // key value. 40 IncludeValue *bool 41 42 noSmithyDocumentSerde 43} 44 45// A resource that can be distributed to callers for executing Method resources 46// that require an API key. API keys can be mapped to any Stage on any RestApi, 47// which indicates that the callers with the API key can make requests to that 48// stage. Use API Keys 49// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-api-keys.html) 50type GetApiKeyOutput struct { 51 52 // The timestamp when the API Key was created. 53 CreatedDate *time.Time 54 55 // An AWS Marketplace customer identifier , when integrating with the AWS SaaS 56 // Marketplace. 57 CustomerId *string 58 59 // The description of the API Key. 60 Description *string 61 62 // Specifies whether the API Key can be used by callers. 63 Enabled bool 64 65 // The identifier of the API Key. 66 Id *string 67 68 // The timestamp when the API Key was last updated. 69 LastUpdatedDate *time.Time 70 71 // The name of the API Key. 72 Name *string 73 74 // A list of Stage resources that are associated with the ApiKey resource. 75 StageKeys []string 76 77 // The collection of tags. Each tag element is associated with a given resource. 78 Tags map[string]string 79 80 // The value of the API Key. 81 Value *string 82 83 // Metadata pertaining to the operation's result. 84 ResultMetadata middleware.Metadata 85 86 noSmithyDocumentSerde 87} 88 89func (c *Client) addOperationGetApiKeyMiddlewares(stack *middleware.Stack, options Options) (err error) { 90 err = stack.Serialize.Add(&awsRestjson1_serializeOpGetApiKey{}, middleware.After) 91 if err != nil { 92 return err 93 } 94 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetApiKey{}, middleware.After) 95 if err != nil { 96 return err 97 } 98 if err = addSetLoggerMiddleware(stack, options); err != nil { 99 return err 100 } 101 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 102 return err 103 } 104 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 105 return err 106 } 107 if err = addResolveEndpointMiddleware(stack, options); err != nil { 108 return err 109 } 110 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 111 return err 112 } 113 if err = addRetryMiddlewares(stack, options); err != nil { 114 return err 115 } 116 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 117 return err 118 } 119 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 120 return err 121 } 122 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 123 return err 124 } 125 if err = addClientUserAgent(stack); err != nil { 126 return err 127 } 128 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addOpGetApiKeyValidationMiddleware(stack); err != nil { 135 return err 136 } 137 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetApiKey(options.Region), middleware.Before); err != nil { 138 return err 139 } 140 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addResponseErrorMiddleware(stack); err != nil { 144 return err 145 } 146 if err = addAcceptHeader(stack); err != nil { 147 return err 148 } 149 if err = addRequestResponseLogging(stack, options); err != nil { 150 return err 151 } 152 return nil 153} 154 155func newServiceMetadataMiddleware_opGetApiKey(region string) *awsmiddleware.RegisterServiceMetadata { 156 return &awsmiddleware.RegisterServiceMetadata{ 157 Region: region, 158 ServiceID: ServiceID, 159 SigningName: "apigateway", 160 OperationName: "GetApiKey", 161 } 162} 163