1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package globalaccelerator
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/globalaccelerator/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Update an endpoint group. A resource must be valid and active when you add it as
15// an endpoint.
16func (c *Client) UpdateEndpointGroup(ctx context.Context, params *UpdateEndpointGroupInput, optFns ...func(*Options)) (*UpdateEndpointGroupOutput, error) {
17	if params == nil {
18		params = &UpdateEndpointGroupInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "UpdateEndpointGroup", params, optFns, c.addOperationUpdateEndpointGroupMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*UpdateEndpointGroupOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type UpdateEndpointGroupInput struct {
32
33	// The Amazon Resource Name (ARN) of the endpoint group.
34	//
35	// This member is required.
36	EndpointGroupArn *string
37
38	// The list of endpoint objects. A resource must be valid and active when you add
39	// it as an endpoint.
40	EndpointConfigurations []types.EndpointConfiguration
41
42	// The time—10 seconds or 30 seconds—between each health check for an endpoint. The
43	// default value is 30.
44	HealthCheckIntervalSeconds *int32
45
46	// If the protocol is HTTP/S, then this specifies the path that is the destination
47	// for health check targets. The default value is slash (/).
48	HealthCheckPath *string
49
50	// The port that AWS Global Accelerator uses to check the health of endpoints that
51	// are part of this endpoint group. The default port is the listener port that this
52	// endpoint group is associated with. If the listener port is a list of ports,
53	// Global Accelerator uses the first port in the list.
54	HealthCheckPort *int32
55
56	// The protocol that AWS Global Accelerator uses to check the health of endpoints
57	// that are part of this endpoint group. The default value is TCP.
58	HealthCheckProtocol types.HealthCheckProtocol
59
60	// Override specific listener ports used to route traffic to endpoints that are
61	// part of this endpoint group. For example, you can create a port override in
62	// which the listener receives user traffic on ports 80 and 443, but your
63	// accelerator routes that traffic to ports 1080 and 1443, respectively, on the
64	// endpoints. For more information, see  Port overrides
65	// (https://docs.aws.amazon.com/global-accelerator/latest/dg/about-endpoint-groups-port-override.html)
66	// in the AWS Global Accelerator Developer Guide.
67	PortOverrides []types.PortOverride
68
69	// The number of consecutive health checks required to set the state of a healthy
70	// endpoint to unhealthy, or to set an unhealthy endpoint to healthy. The default
71	// value is 3.
72	ThresholdCount *int32
73
74	// The percentage of traffic to send to an AWS Region. Additional traffic is
75	// distributed to other endpoint groups for this listener. Use this action to
76	// increase (dial up) or decrease (dial down) traffic to a specific Region. The
77	// percentage is applied to the traffic that would otherwise have been routed to
78	// the Region based on optimal routing. The default value is 100.
79	TrafficDialPercentage *float32
80
81	noSmithyDocumentSerde
82}
83
84type UpdateEndpointGroupOutput struct {
85
86	// The information about the endpoint group that was updated.
87	EndpointGroup *types.EndpointGroup
88
89	// Metadata pertaining to the operation's result.
90	ResultMetadata middleware.Metadata
91
92	noSmithyDocumentSerde
93}
94
95func (c *Client) addOperationUpdateEndpointGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
96	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateEndpointGroup{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateEndpointGroup{}, middleware.After)
101	if err != nil {
102		return err
103	}
104	if err = addSetLoggerMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
108		return err
109	}
110	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
111		return err
112	}
113	if err = addResolveEndpointMiddleware(stack, options); err != nil {
114		return err
115	}
116	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
117		return err
118	}
119	if err = addRetryMiddlewares(stack, options); err != nil {
120		return err
121	}
122	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
123		return err
124	}
125	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
129		return err
130	}
131	if err = addClientUserAgent(stack); err != nil {
132		return err
133	}
134	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addOpUpdateEndpointGroupValidationMiddleware(stack); err != nil {
141		return err
142	}
143	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateEndpointGroup(options.Region), middleware.Before); err != nil {
144		return err
145	}
146	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
147		return err
148	}
149	if err = addResponseErrorMiddleware(stack); err != nil {
150		return err
151	}
152	if err = addRequestResponseLogging(stack, options); err != nil {
153		return err
154	}
155	return nil
156}
157
158func newServiceMetadataMiddleware_opUpdateEndpointGroup(region string) *awsmiddleware.RegisterServiceMetadata {
159	return &awsmiddleware.RegisterServiceMetadata{
160		Region:        region,
161		ServiceID:     ServiceID,
162		SigningName:   "globalaccelerator",
163		OperationName: "UpdateEndpointGroup",
164	}
165}
166