api_op_UpdateHealthCheck.go raw

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