1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package shield
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/shield/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates an existing protection group. A protection group is a grouping of
15// protected resources so they can be handled as a collective. This resource
16// grouping improves the accuracy of detection and reduces false positives.
17func (c *Client) UpdateProtectionGroup(ctx context.Context, params *UpdateProtectionGroupInput, optFns ...func(*Options)) (*UpdateProtectionGroupOutput, error) {
18	if params == nil {
19		params = &UpdateProtectionGroupInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "UpdateProtectionGroup", params, optFns, addOperationUpdateProtectionGroupMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*UpdateProtectionGroupOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type UpdateProtectionGroupInput struct {
33
34	// Defines how AWS Shield combines resource data for the group in order to detect,
35	// mitigate, and report events.
36	//
37	// * Sum - Use the total traffic across the group.
38	// This is a good choice for most cases. Examples include Elastic IP addresses for
39	// EC2 instances that scale manually or automatically.
40	//
41	// * Mean - Use the average of
42	// the traffic across the group. This is a good choice for resources that share
43	// traffic uniformly. Examples include accelerators and load balancers.
44	//
45	// * Max -
46	// Use the highest traffic from each resource. This is useful for resources that
47	// don't share traffic and for resources that share that traffic in a non-uniform
48	// way. Examples include CloudFront distributions and origin resources for
49	// CloudFront distributions.
50	//
51	// This member is required.
52	Aggregation types.ProtectionGroupAggregation
53
54	// The criteria to use to choose the protected resources for inclusion in the
55	// group. You can include all resources that have protections, provide a list of
56	// resource Amazon Resource Names (ARNs), or include all resources of a specified
57	// resource type.
58	//
59	// This member is required.
60	Pattern types.ProtectionGroupPattern
61
62	// The name of the protection group. You use this to identify the protection group
63	// in lists and to manage the protection group, for example to update, delete, or
64	// describe it.
65	//
66	// This member is required.
67	ProtectionGroupId *string
68
69	// The Amazon Resource Names (ARNs) of the resources to include in the protection
70	// group. You must set this when you set Pattern to ARBITRARY and you must not set
71	// it for any other Pattern setting.
72	Members []string
73
74	// The resource type to include in the protection group. All protected resources of
75	// this type are included in the protection group. You must set this when you set
76	// Pattern to BY_RESOURCE_TYPE and you must not set it for any other Pattern
77	// setting.
78	ResourceType types.ProtectedResourceType
79}
80
81type UpdateProtectionGroupOutput struct {
82	// Metadata pertaining to the operation's result.
83	ResultMetadata middleware.Metadata
84}
85
86func addOperationUpdateProtectionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
87	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateProtectionGroup{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateProtectionGroup{}, middleware.After)
92	if err != nil {
93		return err
94	}
95	if err = addSetLoggerMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
99		return err
100	}
101	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
102		return err
103	}
104	if err = addResolveEndpointMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
108		return err
109	}
110	if err = addRetryMiddlewares(stack, options); err != nil {
111		return err
112	}
113	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
120		return err
121	}
122	if err = addClientUserAgent(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addOpUpdateProtectionGroupValidationMiddleware(stack); err != nil {
132		return err
133	}
134	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateProtectionGroup(options.Region), middleware.Before); err != nil {
135		return err
136	}
137	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResponseErrorMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addRequestResponseLogging(stack, options); err != nil {
144		return err
145	}
146	return nil
147}
148
149func newServiceMetadataMiddleware_opUpdateProtectionGroup(region string) *awsmiddleware.RegisterServiceMetadata {
150	return &awsmiddleware.RegisterServiceMetadata{
151		Region:        region,
152		ServiceID:     ServiceID,
153		SigningName:   "shield",
154		OperationName: "UpdateProtectionGroup",
155	}
156}
157