src

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

api_op_CreateHealthCheck.go (5943B)


      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 // Creates a new health check.
     13 //
     14 // For information about adding health checks to resource record sets, see [HealthCheckId] in [ChangeResourceRecordSets].
     15 //
     16 // # ELB Load Balancers
     17 //
     18 // If you're registering EC2 instances with an Elastic Load Balancing (ELB) load
     19 // balancer, do not create Amazon Route 53 health checks for the EC2 instances.
     20 // When you register an EC2 instance with a load balancer, you configure settings
     21 // for an ELB health check, which performs a similar function to a Route 53 health
     22 // check.
     23 //
     24 // # Private Hosted Zones
     25 //
     26 // You can associate health checks with failover resource record sets in a private
     27 // hosted zone. Note the following:
     28 //
     29 //   - Route 53 health checkers are outside the VPC. To check the health of an
     30 //     endpoint within a VPC by IP address, you must assign a public IP address to the
     31 //     instance in the VPC.
     32 //
     33 //   - You can configure a health checker to check the health of an external
     34 //     resource that the instance relies on, such as a database server.
     35 //
     36 //   - You can create a CloudWatch metric, associate an alarm with the metric, and
     37 //     then create a health check that is based on the state of the alarm. For example,
     38 //     you might create a CloudWatch metric that checks the status of the Amazon EC2
     39 //     StatusCheckFailed metric, add an alarm to the metric, and then create a health
     40 //     check that is based on the state of the alarm. For information about creating
     41 //     CloudWatch metrics and alarms by using the CloudWatch console, see the [Amazon CloudWatch User Guide].
     42 //
     43 // [HealthCheckId]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ResourceRecordSet.html#Route53-Type-ResourceRecordSet-HealthCheckId
     44 // [ChangeResourceRecordSets]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html
     45 // [Amazon CloudWatch User Guide]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatch.html
     46 func (c *Client) CreateHealthCheck(ctx context.Context, params *CreateHealthCheckInput, optFns ...func(*Options)) (*CreateHealthCheckOutput, error) {
     47 	if params == nil {
     48 		params = &CreateHealthCheckInput{}
     49 	}
     50 
     51 	result, metadata, err := c.invokeOperation(ctx, "CreateHealthCheck", params, optFns, c.addOperationCreateHealthCheckMiddlewares)
     52 	if err != nil {
     53 		return nil, err
     54 	}
     55 
     56 	out := result.(*CreateHealthCheckOutput)
     57 	out.ResultMetadata = metadata
     58 	return out, nil
     59 }
     60 
     61 // A complex type that contains the health check request information.
     62 type CreateHealthCheckInput struct {
     63 
     64 	// A unique string that identifies the request and that allows you to retry a
     65 	// failed CreateHealthCheck request without the risk of creating two identical
     66 	// health checks:
     67 	//
     68 	//   - If you send a CreateHealthCheck request with the same CallerReference and
     69 	//   settings as a previous request, and if the health check doesn't exist, Amazon
     70 	//   Route 53 creates the health check. If the health check does exist, Route 53
     71 	//   returns the health check configuration in the response.
     72 	//
     73 	//   - If you send a CreateHealthCheck request with the same CallerReference as a
     74 	//   deleted health check, regardless of the settings, Route 53 returns a
     75 	//   HealthCheckAlreadyExists error.
     76 	//
     77 	//   - If you send a CreateHealthCheck request with the same CallerReference as an
     78 	//   existing health check but with different settings, Route 53 returns a
     79 	//   HealthCheckAlreadyExists error.
     80 	//
     81 	//   - If you send a CreateHealthCheck request with a unique CallerReference but
     82 	//   settings identical to an existing health check, Route 53 creates the health
     83 	//   check.
     84 	//
     85 	// Route 53 does not store the CallerReference for a deleted health check
     86 	// indefinitely. The CallerReference for a deleted health check will be deleted
     87 	// after a number of days.
     88 	//
     89 	// This member is required.
     90 	CallerReference *string
     91 
     92 	// A complex type that contains settings for a new health check.
     93 	//
     94 	// This member is required.
     95 	HealthCheckConfig *types.HealthCheckConfig
     96 
     97 	noSmithyDocumentSerde
     98 }
     99 
    100 // A complex type containing the response information for the new health check.
    101 type CreateHealthCheckOutput struct {
    102 
    103 	// A complex type that contains identifying information about the health check.
    104 	//
    105 	// This member is required.
    106 	HealthCheck *types.HealthCheck
    107 
    108 	// The unique URL representing the new health check.
    109 	//
    110 	// This member is required.
    111 	Location *string
    112 
    113 	// Metadata pertaining to the operation's result.
    114 	ResultMetadata middleware.Metadata
    115 
    116 	noSmithyDocumentSerde
    117 }
    118 
    119 func (c *Client) addOperationCreateHealthCheckMiddlewares(stack *middleware.Stack, options Options) (err error) {
    120 	err = stack.Serialize.Add(&awsRestxml_serializeOpCreateHealthCheck{}, middleware.After)
    121 	if err != nil {
    122 		return err
    123 	}
    124 	err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateHealthCheck{}, middleware.After)
    125 	if err != nil {
    126 		return err
    127 	}
    128 
    129 	if err = addComputeContentLength(stack); err != nil {
    130 		return err
    131 	}
    132 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    133 		return err
    134 	}
    135 	if err = addComputePayloadSHA256(stack); err != nil {
    136 		return err
    137 	}
    138 	if err = addRecordResponseTiming(stack, options); err != nil {
    139 		return err
    140 	}
    141 	if err = addCredentialSource(stack, options); err != nil {
    142 		return err
    143 	}
    144 	if err = addOpCreateHealthCheckValidationMiddleware(stack); err != nil {
    145 		return err
    146 	}
    147 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    148 		return err
    149 	}
    150 	if err = addResponseErrorMiddleware(stack); err != nil {
    151 		return err
    152 	}
    153 	if err = addRequestResponseLogging(stack, options); err != nil {
    154 		return err
    155 	}
    156 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    157 		return err
    158 	}
    159 	if err = addInterceptors(stack, options); err != nil {
    160 		return err
    161 	}
    162 	return nil
    163 }