Help Center/ Global Accelerator/ API Reference/ API/ Health Check/ Configuring a Health Check
Updated on 2023-12-06 GMT+08:00

Configuring a Health Check

Function

This API is used to configure a health check.

Calling Method

For details, see Calling APIs.

URI

POST /v1/health-checks

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

health_check

Yes

CreateHealthCheckOption object

Specifies the detailed information about configuring a health check.

Table 3 CreateHealthCheckOption

Parameter

Mandatory

Type

Description

endpoint_group_id

Yes

String

Specifies the endpoint group ID.

Minimum: 0

Maximum: 36

protocol

Yes

String

Specifies the health check protocol.

Enumeration values:

  • TCP

port

Yes

Integer

Specifies the port used for the health check.

Minimum: 1

Maximum: 65535

interval

Yes

Integer

Specifies the health check interval, in seconds.

Minimum: 1

Maximum: 60

timeout

Yes

Integer

Specifies the timeout duration of the health check, in seconds. It is recommended that you set a value less than that of parameter interval.

Minimum: 1

Maximum: 60

max_retries

Yes

Integer

Specifies the maximum number of retries. Specifies the number of consecutive health checks when the health check result of an endpoint changes from HEALTHY to UNHEALTHY, or from UNHEALTHY to HEALTHY.

Minimum: 1

Maximum: 10

enabled

Yes

Boolean

Specifies whether to enable health check.

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

health_check

HealthCheckDetail object

Specifies the details of a health check.

request_id

String

Specifies the request ID.

Table 5 HealthCheckDetail

Parameter

Type

Description

id

String

Specifies the health check ID.

endpoint_group_id

String

Specifies the endpoint group ID.

protocol

String

Specifies the health check protocol.

Enumeration values:

  • TCP

status

String

Specifies the provisioning status. The value can be one of the following:

  • ACTIVE: The resource is running.

  • PENDING: The status is to be determined.

  • ERROR: Failed to create the resource.

  • DELETING: The resource is being deleted.

Enumeration values:

  • ACTIVE

  • PENDING

  • ERROR

  • DELETING

port

Integer

Specifies the port used for the health check.

Minimum: 1

Maximum: 65535

interval

Integer

Specifies the health check interval, in seconds.

Minimum: 1

Maximum: 60

timeout

Integer

Specifies the maximum time required for waiting for a response from the health check, in seconds. It is recommended that you set a value less than that of parameter interval.

Minimum: 1

Maximum: 60

max_retries

Integer

Specifies the maximum number of retries. Specifies the number of consecutive health checks when the health check result of an endpoint changes from HEALTHY to UNHEALTHY, or from UNHEALTHY to HEALTHY.

Minimum: 1

Maximum: 10

created_at

String

Specifies when the health check was configured.

updated_at

String

Specifies when the health check was updated.

domain_id

String

Specifies the tenant ID.

enabled

Boolean

Specifies whether to enable health check.

frozen_info

FrozenInfo object

Specifies the frozen details of cloud services or resources.

Table 6 FrozenInfo

Parameter

Type

Description

status

Integer

Specifies the status of a cloud service or resource. The value can be one of the following:

  • 0: unfrozen/normal (The cloud service will recover after being unfrozen.)

  • 1: frozen (Resources and data will be retained, but the cloud service cannot be used.)

  • 2: deleted/terminated (Both resources and data will be cleared.)

Minimum: 0

Maximum: 2

effect

Integer

Specifies the status of the resource after being frozen. The value can be one of the following:

  • 1 (default): The resource is frozen and can be released.

  • 2: The resource is frozen and cannot be released.

  • 3: The resource is frozen and cannot be renewed.

Minimum: 1

Maximum: 3

Default: 1

scene

Array of strings

Specifies the service scenario. The value can be one of the following:

  • ARREAR: The cloud service is in arrears, including expiration of yearly/monthly resources and fee deduction failure of pay-per-use resources.

  • POLICE: The cloud service is frozen for public security.

  • ILLEGAL: The cloud service is frozen due to violation of laws and regulations.

  • VERIFY: The cloud service is frozen because the user fails to pass the real-name authentication.

  • PARTNER: A partner freezes their customer's resources.

Maximum: 16

Example Requests

Enabling health check whose protocol is TCP, port is 3333, interval and timeout durations are 30 seconds, and the maximum retries is 1

POST https://{ga_endpoint}/v1/health-checks

{
  "health_check" : {
    "endpoint_group_id" : "3a9f50bb-f041-4eac-a117-82472d8a0007",
    "protocol" : "TCP",
    "port" : 3333,
    "interval" : 30,
    "timeout" : 30,
    "max_retries" : 1,
    "enabled" : true
  }
}

Example Responses

Status code: 201

Health check configured.

{
  "health_check" : {
    "id" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7442",
    "endpoint_group_id" : "3a9f50bb-f041-4eac-a117-82472d8a0007",
    "protocol" : "TCP",
    "status" : "ACTIVE",
    "port" : 3333,
    "interval" : 30,
    "timeout" : 30,
    "max_retries" : 1,
    "created_at" : "2019-01-08T01:21:37.151Z",
    "updated_at" : "2019-01-08T01:21:37.151Z",
    "domain_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "enabled" : true,
    "frozen_info" : {
      "status" : 2,
      "effect" : 1,
      "scene" : [ "ARREAR", "POLICE" ]
    }
  },
  "request_id" : "915a14a6-867b-4af7-83d1-70efceb146f9"
}

Status Codes

Status Code

Description

201

Health check configured.

Error Codes

See Error Codes.