1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package appconfig
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)
12
13// Receive information about a configuration. AWS AppConfig uses the value of the
14// ClientConfigurationVersion parameter to identify the configuration version on
15// your clients. If you don’t send ClientConfigurationVersion with each call to
16// GetConfiguration, your clients receive the current configuration. You are
17// charged each time your clients receive a configuration. To avoid excess charges,
18// we recommend that you include the ClientConfigurationVersion value with every
19// call to GetConfiguration. This value must be saved on your client. Subsequent
20// calls to GetConfiguration must pass this value by using the
21// ClientConfigurationVersion parameter.
22func (c *Client) GetConfiguration(ctx context.Context, params *GetConfigurationInput, optFns ...func(*Options)) (*GetConfigurationOutput, error) {
23	if params == nil {
24		params = &GetConfigurationInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "GetConfiguration", params, optFns, addOperationGetConfigurationMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*GetConfigurationOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type GetConfigurationInput struct {
38
39	// The application to get. Specify either the application name or the application
40	// ID.
41	//
42	// This member is required.
43	Application *string
44
45	// A unique ID to identify the client for the configuration. This ID enables
46	// AppConfig to deploy the configuration in intervals, as defined in the deployment
47	// strategy.
48	//
49	// This member is required.
50	ClientId *string
51
52	// The configuration to get. Specify either the configuration name or the
53	// configuration ID.
54	//
55	// This member is required.
56	Configuration *string
57
58	// The environment to get. Specify either the environment name or the environment
59	// ID.
60	//
61	// This member is required.
62	Environment *string
63
64	// The configuration version returned in the most recent GetConfiguration response.
65	// AWS AppConfig uses the value of the ClientConfigurationVersion parameter to
66	// identify the configuration version on your clients. If you don’t send
67	// ClientConfigurationVersion with each call to GetConfiguration, your clients
68	// receive the current configuration. You are charged each time your clients
69	// receive a configuration. To avoid excess charges, we recommend that you include
70	// the ClientConfigurationVersion value with every call to GetConfiguration. This
71	// value must be saved on your client. Subsequent calls to GetConfiguration must
72	// pass this value by using the ClientConfigurationVersion parameter. For more
73	// information about working with configurations, see Retrieving the Configuration
74	// (https://docs.aws.amazon.com/systems-manager/latest/userguide/appconfig-retrieving-the-configuration.html)
75	// in the AWS AppConfig User Guide.
76	ClientConfigurationVersion *string
77}
78
79type GetConfigurationOutput struct {
80
81	// The configuration version.
82	ConfigurationVersion *string
83
84	// The content of the configuration or the configuration data.
85	Content []byte
86
87	// A standard MIME type describing the format of the configuration content. For
88	// more information, see Content-Type
89	// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
90	ContentType *string
91
92	// Metadata pertaining to the operation's result.
93	ResultMetadata middleware.Metadata
94}
95
96func addOperationGetConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
97	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetConfiguration{}, middleware.After)
98	if err != nil {
99		return err
100	}
101	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetConfiguration{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	if err = addSetLoggerMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
112		return err
113	}
114	if err = addResolveEndpointMiddleware(stack, options); err != nil {
115		return err
116	}
117	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
118		return err
119	}
120	if err = addRetryMiddlewares(stack, options); err != nil {
121		return err
122	}
123	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
127		return err
128	}
129	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
130		return err
131	}
132	if err = addClientUserAgent(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addOpGetConfigurationValidationMiddleware(stack); err != nil {
142		return err
143	}
144	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetConfiguration(options.Region), middleware.Before); err != nil {
145		return err
146	}
147	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addResponseErrorMiddleware(stack); err != nil {
151		return err
152	}
153	if err = addRequestResponseLogging(stack, options); err != nil {
154		return err
155	}
156	return nil
157}
158
159func newServiceMetadataMiddleware_opGetConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
160	return &awsmiddleware.RegisterServiceMetadata{
161		Region:        region,
162		ServiceID:     ServiceID,
163		SigningName:   "appconfig",
164		OperationName: "GetConfiguration",
165	}
166}
167