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, 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
82type UpdateEndpointGroupOutput struct {
83
84	// The information about the endpoint group that was updated.
85	EndpointGroup *types.EndpointGroup
86
87	// Metadata pertaining to the operation's result.
88	ResultMetadata middleware.Metadata
89}
90
91func addOperationUpdateEndpointGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
92	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateEndpointGroup{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateEndpointGroup{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	if err = addSetLoggerMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
104		return err
105	}
106	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
107		return err
108	}
109	if err = addResolveEndpointMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
113		return err
114	}
115	if err = addRetryMiddlewares(stack, options); err != nil {
116		return err
117	}
118	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
125		return err
126	}
127	if err = addClientUserAgent(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addOpUpdateEndpointGroupValidationMiddleware(stack); err != nil {
137		return err
138	}
139	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateEndpointGroup(options.Region), middleware.Before); err != nil {
140		return err
141	}
142	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addResponseErrorMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addRequestResponseLogging(stack, options); err != nil {
149		return err
150	}
151	return nil
152}
153
154func newServiceMetadataMiddleware_opUpdateEndpointGroup(region string) *awsmiddleware.RegisterServiceMetadata {
155	return &awsmiddleware.RegisterServiceMetadata{
156		Region:        region,
157		ServiceID:     ServiceID,
158		SigningName:   "globalaccelerator",
159		OperationName: "UpdateEndpointGroup",
160	}
161}
162