1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package configservice
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/configservice/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates or updates a conformance pack. A conformance pack is a collection of AWS
15// Config rules that can be easily deployed in an account and a region and across
16// AWS Organization. This API creates a service linked role
17// AWSServiceRoleForConfigConforms in your account. The service linked role is
18// created only when the role does not exist in your account. You must specify
19// either the TemplateS3Uri or the TemplateBody parameter, but not both. If you
20// provide both AWS Config uses the TemplateS3Uri parameter and ignores the
21// TemplateBody parameter.
22func (c *Client) PutConformancePack(ctx context.Context, params *PutConformancePackInput, optFns ...func(*Options)) (*PutConformancePackOutput, error) {
23	if params == nil {
24		params = &PutConformancePackInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "PutConformancePack", params, optFns, addOperationPutConformancePackMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*PutConformancePackOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type PutConformancePackInput struct {
38
39	// Name of the conformance pack you want to create.
40	//
41	// This member is required.
42	ConformancePackName *string
43
44	// A list of ConformancePackInputParameter objects.
45	ConformancePackInputParameters []types.ConformancePackInputParameter
46
47	// AWS Config stores intermediate files while processing conformance pack template.
48	DeliveryS3Bucket *string
49
50	// The prefix for the Amazon S3 bucket.
51	DeliveryS3KeyPrefix *string
52
53	// A string containing full conformance pack template body. Structure containing
54	// the template body with a minimum length of 1 byte and a maximum length of 51,200
55	// bytes. You can only use a YAML template with one resource type, that is, config
56	// rule and a remediation action.
57	TemplateBody *string
58
59	// Location of file containing the template body (s3://bucketname/prefix). The uri
60	// must point to the conformance pack template (max size: 300 KB) that is located
61	// in an Amazon S3 bucket in the same region as the conformance pack. You must have
62	// access to read Amazon S3 bucket.
63	TemplateS3Uri *string
64}
65
66type PutConformancePackOutput struct {
67
68	// ARN of the conformance pack.
69	ConformancePackArn *string
70
71	// Metadata pertaining to the operation's result.
72	ResultMetadata middleware.Metadata
73}
74
75func addOperationPutConformancePackMiddlewares(stack *middleware.Stack, options Options) (err error) {
76	err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutConformancePack{}, middleware.After)
77	if err != nil {
78		return err
79	}
80	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutConformancePack{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	if err = addSetLoggerMiddleware(stack, options); err != nil {
85		return err
86	}
87	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
88		return err
89	}
90	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
91		return err
92	}
93	if err = addResolveEndpointMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
97		return err
98	}
99	if err = addRetryMiddlewares(stack, options); err != nil {
100		return err
101	}
102	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
109		return err
110	}
111	if err = addClientUserAgent(stack); err != nil {
112		return err
113	}
114	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addOpPutConformancePackValidationMiddleware(stack); err != nil {
121		return err
122	}
123	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutConformancePack(options.Region), middleware.Before); err != nil {
124		return err
125	}
126	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addResponseErrorMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addRequestResponseLogging(stack, options); err != nil {
133		return err
134	}
135	return nil
136}
137
138func newServiceMetadataMiddleware_opPutConformancePack(region string) *awsmiddleware.RegisterServiceMetadata {
139	return &awsmiddleware.RegisterServiceMetadata{
140		Region:        region,
141		ServiceID:     ServiceID,
142		SigningName:   "config",
143		OperationName: "PutConformancePack",
144	}
145}
146