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// This is AWS WAF Classic Regional documentation. For more information, see AWS
14// WAF Classic
15// (https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html)
16// in the developer guide. For the latest version of AWS WAF, use the AWS WAFV2 API
17// and see the AWS WAF Developer Guide
18// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With
19// the latest version, AWS WAF has a single set of endpoints for regional and
20// global use. Associates a web ACL with a resource, either an application load
21// balancer or Amazon API Gateway stage.
22func (c *Client) AssociateWebACL(ctx context.Context, params *AssociateWebACLInput, optFns ...func(*Options)) (*AssociateWebACLOutput, error) {
23	if params == nil {
24		params = &AssociateWebACLInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "AssociateWebACL", params, optFns, c.addOperationAssociateWebACLMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*AssociateWebACLOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type AssociateWebACLInput struct {
38
39	// The ARN (Amazon Resource Name) of the resource to be protected, either an
40	// application load balancer or Amazon API Gateway stage. The ARN should be in one
41	// of the following formats:
42	//
43	// * For an Application Load Balancer:
44	// arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/load-balancer-name/load-balancer-id
45	//
46	// *
47	// For an Amazon API Gateway stage:
48	// arn:aws:apigateway:region::/restapis/api-id/stages/stage-name
49	//
50	// This member is required.
51	ResourceArn *string
52
53	// A unique identifier (ID) for the web ACL.
54	//
55	// This member is required.
56	WebACLId *string
57
58	noSmithyDocumentSerde
59}
60
61type AssociateWebACLOutput struct {
62	// Metadata pertaining to the operation's result.
63	ResultMetadata middleware.Metadata
64
65	noSmithyDocumentSerde
66}
67
68func (c *Client) addOperationAssociateWebACLMiddlewares(stack *middleware.Stack, options Options) (err error) {
69	err = stack.Serialize.Add(&awsAwsjson11_serializeOpAssociateWebACL{}, middleware.After)
70	if err != nil {
71		return err
72	}
73	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAssociateWebACL{}, middleware.After)
74	if err != nil {
75		return err
76	}
77	if err = addSetLoggerMiddleware(stack, options); err != nil {
78		return err
79	}
80	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
81		return err
82	}
83	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
84		return err
85	}
86	if err = addResolveEndpointMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
90		return err
91	}
92	if err = addRetryMiddlewares(stack, options); err != nil {
93		return err
94	}
95	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
102		return err
103	}
104	if err = addClientUserAgent(stack); err != nil {
105		return err
106	}
107	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
108		return err
109	}
110	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
111		return err
112	}
113	if err = addOpAssociateWebACLValidationMiddleware(stack); err != nil {
114		return err
115	}
116	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateWebACL(options.Region), middleware.Before); err != nil {
117		return err
118	}
119	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addResponseErrorMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addRequestResponseLogging(stack, options); err != nil {
126		return err
127	}
128	return nil
129}
130
131func newServiceMetadataMiddleware_opAssociateWebACL(region string) *awsmiddleware.RegisterServiceMetadata {
132	return &awsmiddleware.RegisterServiceMetadata{
133		Region:        region,
134		ServiceID:     ServiceID,
135		SigningName:   "waf-regional",
136		OperationName: "AssociateWebACL",
137	}
138}
139