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/aws-sdk-go-v2/service/appconfig/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Information that enables AppConfig to access the configuration source. Valid
15// configuration sources include Systems Manager (SSM) documents, SSM Parameter
16// Store parameters, and Amazon S3 objects. A configuration profile includes the
17// following information.
18//
19// * The Uri location of the configuration data.
20//
21// * The AWS
22// Identity and Access Management (IAM) role that provides access to the
23// configuration data.
24//
25// * A validator for the configuration data. Available
26// validators include either a JSON Schema or an AWS Lambda function.
27//
28// For more
29// information, see Create a Configuration and a Configuration Profile
30// (http://docs.aws.amazon.com/systems-manager/latest/userguide/appconfig-creating-configuration-and-profile.html)
31// in the AWS AppConfig User Guide.
32func (c *Client) CreateConfigurationProfile(ctx context.Context, params *CreateConfigurationProfileInput, optFns ...func(*Options)) (*CreateConfigurationProfileOutput, error) {
33	if params == nil {
34		params = &CreateConfigurationProfileInput{}
35	}
36
37	result, metadata, err := c.invokeOperation(ctx, "CreateConfigurationProfile", params, optFns, addOperationCreateConfigurationProfileMiddlewares)
38	if err != nil {
39		return nil, err
40	}
41
42	out := result.(*CreateConfigurationProfileOutput)
43	out.ResultMetadata = metadata
44	return out, nil
45}
46
47type CreateConfigurationProfileInput struct {
48
49	// The application ID.
50	//
51	// This member is required.
52	ApplicationId *string
53
54	// A URI to locate the configuration. You can specify a Systems Manager (SSM)
55	// document, an SSM Parameter Store parameter, or an Amazon S3 object. For an SSM
56	// document, specify either the document name in the format ssm-document:// or the
57	// Amazon Resource Name (ARN). For a parameter, specify either the parameter name
58	// in the format ssm-parameter:// or the ARN. For an Amazon S3 object, specify the
59	// URI in the following format: s3:/// . Here is an example:
60	// s3://my-bucket/my-app/us-east-1/my-config.json
61	//
62	// This member is required.
63	LocationUri *string
64
65	// A name for the configuration profile.
66	//
67	// This member is required.
68	Name *string
69
70	// A description of the configuration profile.
71	Description *string
72
73	// The ARN of an IAM role with permission to access the configuration at the
74	// specified LocationUri.
75	RetrievalRoleArn *string
76
77	// Metadata to assign to the configuration profile. Tags help organize and
78	// categorize your AppConfig resources. Each tag consists of a key and an optional
79	// value, both of which you define.
80	Tags map[string]string
81
82	// A list of methods for validating the configuration.
83	Validators []types.Validator
84}
85
86type CreateConfigurationProfileOutput struct {
87
88	// The application ID.
89	ApplicationId *string
90
91	// The configuration profile description.
92	Description *string
93
94	// The configuration profile ID.
95	Id *string
96
97	// The URI location of the configuration.
98	LocationUri *string
99
100	// The name of the configuration profile.
101	Name *string
102
103	// The ARN of an IAM role with permission to access the configuration at the
104	// specified LocationUri.
105	RetrievalRoleArn *string
106
107	// A list of methods for validating the configuration.
108	Validators []types.Validator
109
110	// Metadata pertaining to the operation's result.
111	ResultMetadata middleware.Metadata
112}
113
114func addOperationCreateConfigurationProfileMiddlewares(stack *middleware.Stack, options Options) (err error) {
115	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateConfigurationProfile{}, middleware.After)
116	if err != nil {
117		return err
118	}
119	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateConfigurationProfile{}, middleware.After)
120	if err != nil {
121		return err
122	}
123	if err = addSetLoggerMiddleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
127		return err
128	}
129	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResolveEndpointMiddleware(stack, options); err != nil {
133		return err
134	}
135	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
136		return err
137	}
138	if err = addRetryMiddlewares(stack, options); err != nil {
139		return err
140	}
141	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
142		return err
143	}
144	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
145		return err
146	}
147	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
148		return err
149	}
150	if err = addClientUserAgent(stack); err != nil {
151		return err
152	}
153	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
154		return err
155	}
156	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
157		return err
158	}
159	if err = addOpCreateConfigurationProfileValidationMiddleware(stack); err != nil {
160		return err
161	}
162	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateConfigurationProfile(options.Region), middleware.Before); err != nil {
163		return err
164	}
165	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
166		return err
167	}
168	if err = addResponseErrorMiddleware(stack); err != nil {
169		return err
170	}
171	if err = addRequestResponseLogging(stack, options); err != nil {
172		return err
173	}
174	return nil
175}
176
177func newServiceMetadataMiddleware_opCreateConfigurationProfile(region string) *awsmiddleware.RegisterServiceMetadata {
178	return &awsmiddleware.RegisterServiceMetadata{
179		Region:        region,
180		ServiceID:     ServiceID,
181		SigningName:   "appconfig",
182		OperationName: "CreateConfigurationProfile",
183	}
184}
185