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, 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
43// A resource that can be distributed to callers for executing Method resources
44// that require an API key. API keys can be mapped to any Stage on any RestApi,
45// which indicates that the callers with the API key can make requests to that
46// stage. Use API Keys
47// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-api-keys.html)
48type GetApiKeyOutput struct {
49
50	// The timestamp when the API Key was created.
51	CreatedDate *time.Time
52
53	// An AWS Marketplace customer identifier , when integrating with the AWS SaaS
54	// Marketplace.
55	CustomerId *string
56
57	// The description of the API Key.
58	Description *string
59
60	// Specifies whether the API Key can be used by callers.
61	Enabled bool
62
63	// The identifier of the API Key.
64	Id *string
65
66	// The timestamp when the API Key was last updated.
67	LastUpdatedDate *time.Time
68
69	// The name of the API Key.
70	Name *string
71
72	// A list of Stage resources that are associated with the ApiKey resource.
73	StageKeys []string
74
75	// The collection of tags. Each tag element is associated with a given resource.
76	Tags map[string]string
77
78	// The value of the API Key.
79	Value *string
80
81	// Metadata pertaining to the operation's result.
82	ResultMetadata middleware.Metadata
83}
84
85func addOperationGetApiKeyMiddlewares(stack *middleware.Stack, options Options) (err error) {
86	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetApiKey{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetApiKey{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	if err = addSetLoggerMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
101		return err
102	}
103	if err = addResolveEndpointMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
107		return err
108	}
109	if err = addRetryMiddlewares(stack, options); err != nil {
110		return err
111	}
112	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
119		return err
120	}
121	if err = addClientUserAgent(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addOpGetApiKeyValidationMiddleware(stack); err != nil {
131		return err
132	}
133	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetApiKey(options.Region), middleware.Before); err != nil {
134		return err
135	}
136	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addResponseErrorMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addAcceptHeader(stack); err != nil {
143		return err
144	}
145	if err = addRequestResponseLogging(stack, options); err != nil {
146		return err
147	}
148	return nil
149}
150
151func newServiceMetadataMiddleware_opGetApiKey(region string) *awsmiddleware.RegisterServiceMetadata {
152	return &awsmiddleware.RegisterServiceMetadata{
153		Region:        region,
154		ServiceID:     ServiceID,
155		SigningName:   "apigateway",
156		OperationName: "GetApiKey",
157	}
158}
159