src

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

api_op_UpdateHealthCheck.go (18462B)


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