1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package wafregional
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// Creates an AWS CloudFormation WAFV2 template for the specified web ACL in the
14// specified Amazon S3 bucket. Then, in CloudFormation, you create a stack from the
15// template, to create the web ACL and its resources in AWS WAFV2. Use this to
16// migrate your AWS WAF Classic web ACL to the latest version of AWS WAF. This is
17// part of a larger migration procedure for web ACLs from AWS WAF Classic to the
18// latest version of AWS WAF. For the full procedure, including caveats and manual
19// steps to complete the migration and switch over to the new web ACL, see
20// Migrating your AWS WAF Classic resources to AWS WAF
21// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-migrating-from-classic.html)
22// in the AWS WAF Developer Guide
23// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html).
24func (c *Client) CreateWebACLMigrationStack(ctx context.Context, params *CreateWebACLMigrationStackInput, optFns ...func(*Options)) (*CreateWebACLMigrationStackOutput, error) {
25	if params == nil {
26		params = &CreateWebACLMigrationStackInput{}
27	}
28
29	result, metadata, err := c.invokeOperation(ctx, "CreateWebACLMigrationStack", params, optFns, c.addOperationCreateWebACLMigrationStackMiddlewares)
30	if err != nil {
31		return nil, err
32	}
33
34	out := result.(*CreateWebACLMigrationStackOutput)
35	out.ResultMetadata = metadata
36	return out, nil
37}
38
39type CreateWebACLMigrationStackInput struct {
40
41	// Indicates whether to exclude entities that can't be migrated or to stop the
42	// migration. Set this to true to ignore unsupported entities in the web ACL during
43	// the migration. Otherwise, if AWS WAF encounters unsupported entities, it stops
44	// the process and throws an exception.
45	//
46	// This member is required.
47	IgnoreUnsupportedType *bool
48
49	// The name of the Amazon S3 bucket to store the CloudFormation template in. The S3
50	// bucket must be configured as follows for the migration:
51	//
52	// * The bucket name must
53	// start with aws-waf-migration-. For example, aws-waf-migration-my-web-acl.
54	//
55	// * The
56	// bucket must be in the Region where you are deploying the template. For example,
57	// for a web ACL in us-west-2, you must use an Amazon S3 bucket in us-west-2 and
58	// you must deploy the template stack to us-west-2.
59	//
60	// * The bucket policies must
61	// permit the migration process to write data. For listings of the bucket policies,
62	// see the Examples section.
63	//
64	// This member is required.
65	S3BucketName *string
66
67	// The UUID of the WAF Classic web ACL that you want to migrate to WAF v2.
68	//
69	// This member is required.
70	WebACLId *string
71
72	noSmithyDocumentSerde
73}
74
75type CreateWebACLMigrationStackOutput struct {
76
77	// The URL of the template created in Amazon S3.
78	//
79	// This member is required.
80	S3ObjectUrl *string
81
82	// Metadata pertaining to the operation's result.
83	ResultMetadata middleware.Metadata
84
85	noSmithyDocumentSerde
86}
87
88func (c *Client) addOperationCreateWebACLMigrationStackMiddlewares(stack *middleware.Stack, options Options) (err error) {
89	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateWebACLMigrationStack{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateWebACLMigrationStack{}, middleware.After)
94	if err != nil {
95		return err
96	}
97	if err = addSetLoggerMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
101		return err
102	}
103	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
104		return err
105	}
106	if err = addResolveEndpointMiddleware(stack, options); err != nil {
107		return err
108	}
109	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
110		return err
111	}
112	if err = addRetryMiddlewares(stack, options); err != nil {
113		return err
114	}
115	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
122		return err
123	}
124	if err = addClientUserAgent(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addOpCreateWebACLMigrationStackValidationMiddleware(stack); err != nil {
134		return err
135	}
136	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateWebACLMigrationStack(options.Region), middleware.Before); err != nil {
137		return err
138	}
139	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addResponseErrorMiddleware(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_opCreateWebACLMigrationStack(region string) *awsmiddleware.RegisterServiceMetadata {
152	return &awsmiddleware.RegisterServiceMetadata{
153		Region:        region,
154		ServiceID:     ServiceID,
155		SigningName:   "waf-regional",
156		OperationName: "CreateWebACLMigrationStack",
157	}
158}
159