-
Notifications
You must be signed in to change notification settings - Fork 597
/
api_op_CreateHealthCheck.go
206 lines (189 loc) · 7.18 KB
/
api_op_CreateHealthCheck.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
// Code generated by smithy-go-codegen DO NOT EDIT.
package route53
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/route53/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new health check.
//
// For information about adding health checks to resource record sets, see [HealthCheckId] in [ChangeResourceRecordSets].
//
// # ELB Load Balancers
//
// If you're registering EC2 instances with an Elastic Load Balancing (ELB) load
// balancer, do not create Amazon Route 53 health checks for the EC2 instances.
// When you register an EC2 instance with a load balancer, you configure settings
// for an ELB health check, which performs a similar function to a Route 53 health
// check.
//
// # Private Hosted Zones
//
// You can associate health checks with failover resource record sets in a private
// hosted zone. Note the following:
//
// - Route 53 health checkers are outside the VPC. To check the health of an
// endpoint within a VPC by IP address, you must assign a public IP address to the
// instance in the VPC.
//
// - You can configure a health checker to check the health of an external
// resource that the instance relies on, such as a database server.
//
// - You can create a CloudWatch metric, associate an alarm with the metric, and
// then create a health check that is based on the state of the alarm. For example,
// you might create a CloudWatch metric that checks the status of the Amazon EC2
// StatusCheckFailed metric, add an alarm to the metric, and then create a health
// check that is based on the state of the alarm. For information about creating
// CloudWatch metrics and alarms by using the CloudWatch console, see the [Amazon CloudWatch User Guide].
//
// [HealthCheckId]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ResourceRecordSet.html#Route53-Type-ResourceRecordSet-HealthCheckId
// [ChangeResourceRecordSets]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html
// [Amazon CloudWatch User Guide]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatch.html
func (c *Client) CreateHealthCheck(ctx context.Context, params *CreateHealthCheckInput, optFns ...func(*Options)) (*CreateHealthCheckOutput, error) {
if params == nil {
params = &CreateHealthCheckInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateHealthCheck", params, optFns, c.addOperationCreateHealthCheckMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateHealthCheckOutput)
out.ResultMetadata = metadata
return out, nil
}
// A complex type that contains the health check request information.
type CreateHealthCheckInput struct {
// A unique string that identifies the request and that allows you to retry a
// failed CreateHealthCheck request without the risk of creating two identical
// health checks:
//
// - If you send a CreateHealthCheck request with the same CallerReference and
// settings as a previous request, and if the health check doesn't exist, Amazon
// Route 53 creates the health check. If the health check does exist, Route 53
// returns the settings for the existing health check.
//
// - If you send a CreateHealthCheck request with the same CallerReference as a
// deleted health check, regardless of the settings, Route 53 returns a
// HealthCheckAlreadyExists error.
//
// - If you send a CreateHealthCheck request with the same CallerReference as an
// existing health check but with different settings, Route 53 returns a
// HealthCheckAlreadyExists error.
//
// - If you send a CreateHealthCheck request with a unique CallerReference but
// settings identical to an existing health check, Route 53 creates the health
// check.
//
// Route 53 does not store the CallerReference for a deleted health check
// indefinitely. The CallerReference for a deleted health check will be deleted
// after a number of days.
//
// This member is required.
CallerReference *string
// A complex type that contains settings for a new health check.
//
// This member is required.
HealthCheckConfig *types.HealthCheckConfig
noSmithyDocumentSerde
}
// A complex type containing the response information for the new health check.
type CreateHealthCheckOutput struct {
// A complex type that contains identifying information about the health check.
//
// This member is required.
HealthCheck *types.HealthCheck
// The unique URL representing the new health check.
//
// This member is required.
Location *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateHealthCheckMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsRestxml_serializeOpCreateHealthCheck{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateHealthCheck{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateHealthCheck"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateHealthCheckValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHealthCheck(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateHealthCheck(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateHealthCheck",
}
}