src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_UpdateHealthCheck.go (17722B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package route53
      4 
      5 import (
      6 	"context"
      7 
      8 	"github.com/aws/aws-sdk-go-v2/service/route53/types"
      9 	"github.com/aws/smithy-go/middleware"
     10 )
     11 
     12 // Updates an existing health check. Note that some values can't be updated.
     13 //
     14 // For more information about updating health checks, see [Creating, Updating, and Deleting Health Checks] in the Amazon Route 53
     15 // Developer Guide.
     16 //
     17 // [Creating, Updating, and Deleting Health Checks]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/health-checks-creating-deleting.html
     18 func (c *Client) UpdateHealthCheck(ctx context.Context, params *UpdateHealthCheckInput, optFns ...func(*Options)) (*UpdateHealthCheckOutput, error) {
     19 	if params == nil {
     20 		params = &UpdateHealthCheckInput{}
     21 	}
     22 
     23 	result, metadata, err := c.invokeOperation(ctx, "UpdateHealthCheck", params, optFns, c.addOperationUpdateHealthCheckMiddlewares)
     24 	if err != nil {
     25 		return nil, err
     26 	}
     27 
     28 	out := result.(*UpdateHealthCheckOutput)
     29 	out.ResultMetadata = metadata
     30 	return out, nil
     31 }
     32 
     33 // A complex type that contains information about a request to update a health
     34 // check.
     35 type UpdateHealthCheckInput struct {
     36 
     37 	// The ID for the health check for which you want detailed information. When you
     38 	// created the health check, CreateHealthCheck returned the ID in the response, in
     39 	// the HealthCheckId element.
     40 	//
     41 	// This member is required.
     42 	HealthCheckId *string
     43 
     44 	// A complex type that identifies the CloudWatch alarm that you want Amazon Route
     45 	// 53 health checkers to use to determine whether the specified health check is
     46 	// healthy.
     47 	AlarmIdentifier *types.AlarmIdentifier
     48 
     49 	// A complex type that contains one ChildHealthCheck element for each health check
     50 	// that you want to associate with a CALCULATED health check.
     51 	ChildHealthChecks []string
     52 
     53 	// Stops Route 53 from performing health checks. When you disable a health check,
     54 	// here's what happens:
     55 	//
     56 	//   - Health checks that check the health of endpoints: Route 53 stops submitting
     57 	//   requests to your application, server, or other resource.
     58 	//
     59 	//   - Calculated health checks: Route 53 stops aggregating the status of the
     60 	//   referenced health checks.
     61 	//
     62 	//   - Health checks that monitor CloudWatch alarms: Route 53 stops monitoring the
     63 	//   corresponding CloudWatch metrics.
     64 	//
     65 	// After you disable a health check, Route 53 considers the status of the health
     66 	// check to always be healthy. If you configured DNS failover, Route 53 continues
     67 	// to route traffic to the corresponding resources. Additionally, in disabled
     68 	// state, you can also invert the status of the health check to route traffic
     69 	// differently. For more information, see [Inverted].
     70 	//
     71 	// Charges for a health check still apply when the health check is disabled. For
     72 	// more information, see [Amazon Route 53 Pricing].
     73 	//
     74 	// [Inverted]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-Inverted
     75 	// [Amazon Route 53 Pricing]: http://aws.amazon.com/route53/pricing/
     76 	Disabled *bool
     77 
     78 	// Specify whether you want Amazon Route 53 to send the value of
     79 	// FullyQualifiedDomainName to the endpoint in the client_hello message during TLS
     80 	// negotiation. This allows the endpoint to respond to HTTPS health check requests
     81 	// with the applicable SSL/TLS certificate.
     82 	//
     83 	// Some endpoints require that HTTPS requests include the host name in the
     84 	// client_hello message. If you don't enable SNI, the status of the health check
     85 	// will be SSL alert handshake_failure . A health check can also have that status
     86 	// for other reasons. If SNI is enabled and you're still getting the error, check
     87 	// the SSL/TLS configuration on your endpoint and confirm that your certificate is
     88 	// valid.
     89 	//
     90 	// The SSL/TLS certificate on your endpoint includes a domain name in the Common
     91 	// Name field and possibly several more in the Subject Alternative Names field.
     92 	// One of the domain names in the certificate should match the value that you
     93 	// specify for FullyQualifiedDomainName . If the endpoint responds to the
     94 	// client_hello message with a certificate that does not include the domain name
     95 	// that you specified in FullyQualifiedDomainName , a health checker will retry the
     96 	// handshake. In the second attempt, the health checker will omit
     97 	// FullyQualifiedDomainName from the client_hello message.
     98 	EnableSNI *bool
     99 
    100 	// The number of consecutive health checks that an endpoint must pass or fail for
    101 	// Amazon Route 53 to change the current status of the endpoint from unhealthy to
    102 	// healthy or vice versa. For more information, see [How Amazon Route 53 Determines Whether an Endpoint Is Healthy]in the Amazon Route 53
    103 	// Developer Guide.
    104 	//
    105 	// Otherwise, if you don't specify a value for FailureThreshold , the default value
    106 	// is three health checks.
    107 	//
    108 	// [How Amazon Route 53 Determines Whether an Endpoint Is Healthy]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html
    109 	FailureThreshold *int32
    110 
    111 	// Amazon Route 53 behavior depends on whether you specify a value for IPAddress .
    112 	//
    113 	// If a health check already has a value for IPAddress , you can change the value.
    114 	// However, you can't update an existing health check to add or remove the value of
    115 	// IPAddress .
    116 	//
    117 	// If you specify a value for IPAddress :
    118 	//
    119 	// Route 53 sends health check requests to the specified IPv4 or IPv6 address and
    120 	// passes the value of FullyQualifiedDomainName in the Host header for all health
    121 	// checks except TCP health checks. This is typically the fully qualified DNS name
    122 	// of the endpoint on which you want Route 53 to perform health checks.
    123 	//
    124 	// When Route 53 checks the health of an endpoint, here is how it constructs the
    125 	// Host header:
    126 	//
    127 	//   - If you specify a value of 80 for Port and HTTP or HTTP_STR_MATCH for Type ,
    128 	//   Route 53 passes the value of FullyQualifiedDomainName to the endpoint in the
    129 	//   Host header.
    130 	//
    131 	//   - If you specify a value of 443 for Port and HTTPS or HTTPS_STR_MATCH for Type
    132 	//   , Route 53 passes the value of FullyQualifiedDomainName to the endpoint in the
    133 	//   Host header.
    134 	//
    135 	//   - If you specify another value for Port and any value except TCP for Type ,
    136 	//   Route 53 passes FullyQualifiedDomainName : Port to the endpoint in the Host
    137 	//   header.
    138 	//
    139 	// If you don't specify a value for FullyQualifiedDomainName , Route 53 substitutes
    140 	// the value of IPAddress in the Host header in each of the above cases.
    141 	//
    142 	// If you don't specify a value for IPAddress :
    143 	//
    144 	// If you don't specify a value for IPAddress , Route 53 sends a DNS request to the
    145 	// domain that you specify in FullyQualifiedDomainName at the interval you specify
    146 	// in RequestInterval . Using an IPv4 address that is returned by DNS, Route 53
    147 	// then checks the health of the endpoint.
    148 	//
    149 	// If you don't specify a value for IPAddress , you can’t update the health check
    150 	// to remove the FullyQualifiedDomainName ; if you don’t specify a value for
    151 	// IPAddress on creation, a FullyQualifiedDomainName is required.
    152 	//
    153 	// If you don't specify a value for IPAddress , Route 53 uses only IPv4 to send
    154 	// health checks to the endpoint. If there's no resource record set with a type of
    155 	// A for the name that you specify for FullyQualifiedDomainName , the health check
    156 	// fails with a "DNS resolution failed" error.
    157 	//
    158 	// If you want to check the health of weighted, latency, or failover resource
    159 	// record sets and you choose to specify the endpoint only by
    160 	// FullyQualifiedDomainName , we recommend that you create a separate health check
    161 	// for each endpoint. For example, create a health check for each HTTP server that
    162 	// is serving content for www.example.com. For the value of
    163 	// FullyQualifiedDomainName , specify the domain name of the server (such as
    164 	// us-east-2-www.example.com ), not the name of the resource record sets
    165 	// (www.example.com).
    166 	//
    167 	// In this configuration, if the value of FullyQualifiedDomainName matches the
    168 	// name of the resource record sets and you then associate the health check with
    169 	// those resource record sets, health check results will be unpredictable.
    170 	//
    171 	// In addition, if the value of Type is HTTP , HTTPS , HTTP_STR_MATCH , or
    172 	// HTTPS_STR_MATCH , Route 53 passes the value of FullyQualifiedDomainName in the
    173 	// Host header, as it does when you specify a value for IPAddress . If the value of
    174 	// Type is TCP , Route 53 doesn't pass a Host header.
    175 	FullyQualifiedDomainName *string
    176 
    177 	// A sequential counter that Amazon Route 53 sets to 1 when you create a health
    178 	// check and increments by 1 each time you update settings for the health check.
    179 	//
    180 	// We recommend that you use GetHealthCheck or ListHealthChecks to get the current
    181 	// value of HealthCheckVersion for the health check that you want to update, and
    182 	// that you include that value in your UpdateHealthCheck request. This prevents
    183 	// Route 53 from overwriting an intervening update:
    184 	//
    185 	//   - If the value in the UpdateHealthCheck request matches the value of
    186 	//   HealthCheckVersion in the health check, Route 53 updates the health check with
    187 	//   the new settings.
    188 	//
    189 	//   - If the value of HealthCheckVersion in the health check is greater, the
    190 	//   health check was changed after you got the version number. Route 53 does not
    191 	//   update the health check, and it returns a HealthCheckVersionMismatch error.
    192 	HealthCheckVersion *int64
    193 
    194 	// The number of child health checks that are associated with a CALCULATED health
    195 	// that Amazon Route 53 must consider healthy for the CALCULATED health check to
    196 	// be considered healthy. To specify the child health checks that you want to
    197 	// associate with a CALCULATED health check, use the ChildHealthChecks and
    198 	// ChildHealthCheck elements.
    199 	//
    200 	// Note the following:
    201 	//
    202 	//   - If you specify a number greater than the number of child health checks,
    203 	//   Route 53 always considers this health check to be unhealthy.
    204 	//
    205 	//   - If you specify 0 , Route 53 always considers this health check to be healthy.
    206 	HealthThreshold *int32
    207 
    208 	// The IPv4 or IPv6 IP address for the endpoint that you want Amazon Route 53 to
    209 	// perform health checks on. If you don't specify a value for IPAddress , Route 53
    210 	// sends a DNS request to resolve the domain name that you specify in
    211 	// FullyQualifiedDomainName at the interval that you specify in RequestInterval .
    212 	// Using an IP address that is returned by DNS, Route 53 then checks the health of
    213 	// the endpoint.
    214 	//
    215 	// Use one of the following formats for the value of IPAddress :
    216 	//
    217 	//   - IPv4 address: four values between 0 and 255, separated by periods (.), for
    218 	//   example, 192.0.2.44 .
    219 	//
    220 	//   - IPv6 address: eight groups of four hexadecimal values, separated by colons
    221 	//   (:), for example, 2001:0db8:85a3:0000:0000:abcd:0001:2345 . You can also
    222 	//   shorten IPv6 addresses as described in RFC 5952, for example,
    223 	//   2001:db8:85a3::abcd:1:2345 .
    224 	//
    225 	// If the endpoint is an EC2 instance, we recommend that you create an Elastic IP
    226 	// address, associate it with your EC2 instance, and specify the Elastic IP address
    227 	// for IPAddress . This ensures that the IP address of your instance never changes.
    228 	// For more information, see the applicable documentation:
    229 	//
    230 	//   - Linux: [Elastic IP Addresses (EIP)]in the Amazon EC2 User Guide for Linux Instances
    231 	//
    232 	//   - Windows: [Elastic IP Addresses (EIP)]in the Amazon EC2 User Guide for Windows Instances
    233 	//
    234 	// If a health check already has a value for IPAddress , you can change the value.
    235 	// However, you can't update an existing health check to add or remove the value of
    236 	// IPAddress .
    237 	//
    238 	// For more information, see [FullyQualifiedDomainName].
    239 	//
    240 	// Constraints: Route 53 can't check the health of endpoints for which the IP
    241 	// address is in local, private, non-routable, or multicast ranges. For more
    242 	// information about IP addresses for which you can't create health checks, see the
    243 	// following documents:
    244 	//
    245 	// [RFC 5735, Special Use IPv4 Addresses]
    246 	//
    247 	// [RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space]
    248 	//
    249 	// [RFC 5156, Special-Use IPv6 Addresses]
    250 	//
    251 	// [RFC 5735, Special Use IPv4 Addresses]: https://tools.ietf.org/html/rfc5735
    252 	// [FullyQualifiedDomainName]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-FullyQualifiedDomainName
    253 	// [Elastic IP Addresses (EIP)]: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-ip-addresses-eip.html
    254 	// [RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space]: https://tools.ietf.org/html/rfc6598
    255 	// [RFC 5156, Special-Use IPv6 Addresses]: https://tools.ietf.org/html/rfc5156
    256 	IPAddress *string
    257 
    258 	// When CloudWatch has insufficient data about the metric to determine the alarm
    259 	// state, the status that you want Amazon Route 53 to assign to the health check:
    260 	//
    261 	//   - Healthy : Route 53 considers the health check to be healthy.
    262 	//
    263 	//   - Unhealthy : Route 53 considers the health check to be unhealthy.
    264 	//
    265 	//   - LastKnownStatus : By default, Route 53 uses the status of the health check
    266 	//   from the last time CloudWatch had sufficient data to determine the alarm state.
    267 	//   For new health checks that have no last known status, the status for the health
    268 	//   check is healthy.
    269 	InsufficientDataHealthStatus types.InsufficientDataHealthStatus
    270 
    271 	// Specify whether you want Amazon Route 53 to invert the status of a health
    272 	// check, for example, to consider a health check unhealthy when it otherwise would
    273 	// be considered healthy.
    274 	Inverted *bool
    275 
    276 	// The port on the endpoint that you want Amazon Route 53 to perform health checks
    277 	// on.
    278 	//
    279 	// Don't specify a value for Port when you specify a value for Type of
    280 	// CLOUDWATCH_METRIC or CALCULATED .
    281 	Port *int32
    282 
    283 	// A complex type that contains one Region element for each region that you want
    284 	// Amazon Route 53 health checkers to check the specified endpoint from.
    285 	Regions []types.HealthCheckRegion
    286 
    287 	// A complex type that contains one ResettableElementName element for each element
    288 	// that you want to reset to the default value. Valid values for
    289 	// ResettableElementName include the following:
    290 	//
    291 	//   - ChildHealthChecks : Amazon Route 53 resets [ChildHealthChecks]to null.
    292 	//
    293 	//   - FullyQualifiedDomainName : Route 53 resets [FullyQualifiedDomainName]. to null.
    294 	//
    295 	//   - Regions : Route 53 resets the [Regions]list to the default set of regions.
    296 	//
    297 	//   - ResourcePath : Route 53 resets [ResourcePath]to null.
    298 	//
    299 	// [ResourcePath]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-ResourcePath
    300 	// [ChildHealthChecks]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-ChildHealthChecks
    301 	// [FullyQualifiedDomainName]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-FullyQualifiedDomainName
    302 	// [Regions]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-Regions
    303 	ResetElements []types.ResettableElementName
    304 
    305 	// The path that you want Amazon Route 53 to request when performing health
    306 	// checks. The path can be any value for which your endpoint will return an HTTP
    307 	// status code of 2xx or 3xx when the endpoint is healthy, for example the file
    308 	// /docs/route53-health-check.html. You can also include query string parameters,
    309 	// for example, /welcome.html?language=jp&login=y .
    310 	//
    311 	// Specify this value only if you want to change it.
    312 	ResourcePath *string
    313 
    314 	// If the value of Type is HTTP_STR_MATCH or HTTPS_STR_MATCH , the string that you
    315 	// want Amazon Route 53 to search for in the response body from the specified
    316 	// resource. If the string appears in the response body, Route 53 considers the
    317 	// resource healthy. (You can't change the value of Type when you update a health
    318 	// check.)
    319 	SearchString *string
    320 
    321 	noSmithyDocumentSerde
    322 }
    323 
    324 // A complex type that contains the response to the UpdateHealthCheck request.
    325 type UpdateHealthCheckOutput struct {
    326 
    327 	// A complex type that contains the response to an UpdateHealthCheck request.
    328 	//
    329 	// This member is required.
    330 	HealthCheck *types.HealthCheck
    331 
    332 	// Metadata pertaining to the operation's result.
    333 	ResultMetadata middleware.Metadata
    334 
    335 	noSmithyDocumentSerde
    336 }
    337 
    338 func (c *Client) addOperationUpdateHealthCheckMiddlewares(stack *middleware.Stack, options Options) (err error) {
    339 	err = stack.Serialize.Add(&awsRestxml_serializeOpUpdateHealthCheck{}, middleware.After)
    340 	if err != nil {
    341 		return err
    342 	}
    343 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpUpdateHealthCheck{}, middleware.After)
    344 	if err != nil {
    345 		return err
    346 	}
    347 
    348 	if err = addComputeContentLength(stack); err != nil {
    349 		return err
    350 	}
    351 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    352 		return err
    353 	}
    354 	if err = addComputePayloadSHA256(stack); err != nil {
    355 		return err
    356 	}
    357 	if err = addRecordResponseTiming(stack, options); err != nil {
    358 		return err
    359 	}
    360 	if err = addCredentialSource(stack, options); err != nil {
    361 		return err
    362 	}
    363 	if err = addOpUpdateHealthCheckValidationMiddleware(stack); err != nil {
    364 		return err
    365 	}
    366 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    367 		return err
    368 	}
    369 	if err = addResponseErrorMiddleware(stack); err != nil {
    370 		return err
    371 	}
    372 	if err = addRequestResponseLogging(stack, options); err != nil {
    373 		return err
    374 	}
    375 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    376 		return err
    377 	}
    378 	if err = addInterceptors(stack, options); err != nil {
    379 		return err
    380 	}
    381 	return nil
    382 }