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// Create a new configuration in the AppConfig configuration store.
14func (c *Client) CreateHostedConfigurationVersion(ctx context.Context, params *CreateHostedConfigurationVersionInput, optFns ...func(*Options)) (*CreateHostedConfigurationVersionOutput, error) {
15	if params == nil {
16		params = &CreateHostedConfigurationVersionInput{}
17	}
18
19	result, metadata, err := c.invokeOperation(ctx, "CreateHostedConfigurationVersion", params, optFns, addOperationCreateHostedConfigurationVersionMiddlewares)
20	if err != nil {
21		return nil, err
22	}
23
24	out := result.(*CreateHostedConfigurationVersionOutput)
25	out.ResultMetadata = metadata
26	return out, nil
27}
28
29type CreateHostedConfigurationVersionInput struct {
30
31	// The application ID.
32	//
33	// This member is required.
34	ApplicationId *string
35
36	// The configuration profile ID.
37	//
38	// This member is required.
39	ConfigurationProfileId *string
40
41	// The content of the configuration or the configuration data.
42	//
43	// This member is required.
44	Content []byte
45
46	// A standard MIME type describing the format of the configuration content. For
47	// more information, see Content-Type
48	// (https://docs.aws.amazon.com/https:/www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
49	//
50	// This member is required.
51	ContentType *string
52
53	// A description of the configuration.
54	Description *string
55
56	// An optional locking token used to prevent race conditions from overwriting
57	// configuration updates when creating a new version. To ensure your data is not
58	// overwritten when creating multiple hosted configuration versions in rapid
59	// succession, specify the version of the latest hosted configuration version.
60	LatestVersionNumber int32
61}
62
63type CreateHostedConfigurationVersionOutput struct {
64
65	// The application ID.
66	ApplicationId *string
67
68	// The configuration profile ID.
69	ConfigurationProfileId *string
70
71	// The content of the configuration or the configuration data.
72	Content []byte
73
74	// A standard MIME type describing the format of the configuration content. For
75	// more information, see Content-Type
76	// (https://docs.aws.amazon.com/https:/www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
77	ContentType *string
78
79	// A description of the configuration.
80	Description *string
81
82	// The configuration version.
83	VersionNumber int32
84
85	// Metadata pertaining to the operation's result.
86	ResultMetadata middleware.Metadata
87}
88
89func addOperationCreateHostedConfigurationVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
90	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateHostedConfigurationVersion{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateHostedConfigurationVersion{}, 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 = addOpCreateHostedConfigurationVersionValidationMiddleware(stack); err != nil {
135		return err
136	}
137	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHostedConfigurationVersion(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 = addRequestResponseLogging(stack, options); err != nil {
147		return err
148	}
149	return nil
150}
151
152func newServiceMetadataMiddleware_opCreateHostedConfigurationVersion(region string) *awsmiddleware.RegisterServiceMetadata {
153	return &awsmiddleware.RegisterServiceMetadata{
154		Region:        region,
155		ServiceID:     ServiceID,
156		SigningName:   "appconfig",
157		OperationName: "CreateHostedConfigurationVersion",
158	}
159}
160