Updated on 2024-09-26 GMT+08:00

Configuring a Health Check

Function

This API is used to configure a health check.

Constraints

Note the following:

  • The security groups must have rules that allow traffic to 100.125.0.0/16.

  • If you want to use UDP for health checks, ensure that the protocol of the backend server group is UDP.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/elb/healthmonitors

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the token used for IAM authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

healthmonitor

Yes

CreateHealthMonitorOption object

Specifies the health check.

Table 4 CreateHealthMonitorOption

Parameter

Mandatory

Type

Description

admin_state_up

No

Boolean

Specifies the administrative status of the health check.

The value can be:

  • true (default): Health check is enabled.

  • false: Health check is disabled.

delay

Yes

Integer

Specifies the interval between health checks, in seconds. The value ranges from 1 to 50.

domain_name

No

String

Specifies the domain name that HTTP requests are sent to during the health check.

The value can contain only digits, letters, hyphens (-), and periods (.) and must start with a digit or letter.

The value is left blank by default, indicating that the virtual IP address of the load balancer is used as the destination address of HTTP requests.

This parameter is available only when type is set to HTTP or HTTPS.

expected_codes

No

String

Specifies the expected HTTP status code.

The value options are as follows:

  • A specific value, for example, 200

  • A list of values that are separated with commas (,), for example, 200, 202

  • A value range, for example, 200-204

If type is set to gRPC, the default value is 0. If type is set to other protocols, the default value is 200.

This parameter will take effect only when type is set to HTTP, HTTPS or gRPC.

http_method

No

String

Specifies the HTTP method. The value can be GET, HEAD, or POST. The default value is GET.

This parameter is available when type is set to HTTP or HTTPS.

This parameter is unsupported. Please do not use it.

max_retries

Yes

Integer

Specifies the number of consecutive health checks when the health check result of a backend server changes from OFFLINE to ONLINE.

The value ranges from 1 to 10.

max_retries_down

No

Integer

Specifies the number of consecutive health checks when the health check result of a backend server changes from ONLINE to OFFLINE.

The value ranges from 1 to 10, and the default value is 3.

monitor_port

No

Integer

Specifies the port used for the health check. This parameter is left blank by default, indicating that a port of the backend server will be used by default. The port number ranges from 1 to 65535.

NOTE:

This parameter is mandatory if any_port_enable is set to true for a backend server group.

name

No

String

Specifies the health check name.

pool_id

Yes

String

Specifies the ID of the backend server group for which the health check is configured.

project_id

No

String

Specifies the project ID.

timeout

Yes

Integer

Specifies the maximum time required for waiting for a response from the health check, in seconds.

It is recommended that you set the value less than that of parameter delay.

type

Yes

String

Specifies the health check protocol. The value can be TCP, UDP_CONNECT, HTTP, HTTPS, gRPC, or TLS.

Note:

  • If the protocol of the backend server is QUIC, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is UDP, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is TCP, the value can only be TCP, HTTP, or HTTPS.

  • If the protocol of the backend server is HTTP, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is HTTPS, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is gRPC, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is TLS, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

url_path

No

String

Specifies the HTTP request path for the health check. The value must start with a slash (/), and the default value is /.

The value can contain letters, digits, hyphens (-), slashes (/), periods (.), percentage signs (%), question marks (?), pound signs (#), ampersand signs (&), and the extended character set _;~!()*[]@$^:',+.

Note: This parameter is available only when type is set to HTTP or HTTPS.

Response Parameters

Status code: 201

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID.

Note: The value is automatically generated.

healthmonitor

HealthMonitor object

Specifies the health check.

Table 6 HealthMonitor

Parameter

Type

Description

admin_state_up

Boolean

Specifies the administrative status of the health check.

The value can be:

  • true (default): Health check is enabled.

  • false: Health check is disabled.

delay

Integer

Specifies the interval between health checks, in seconds. The value ranges from 1 to 50.

domain_name

String

Specifies the domain name that HTTP requests are sent to during the health check.

The value can contain only digits, letters, hyphens (-), and periods (.) and must start with a digit or letter.

The value is left blank by default, indicating that the virtual IP address of the load balancer is used as the destination address of HTTP requests.

This parameter is available only when type is set to HTTP or HTTPS.

expected_codes

String

Specifies the expected HTTP status code.

The value options are as follows:

  • A specific value, for example, 200

  • A list of values that are separated with commas (,), for example, 200, 202

  • A value range, for example, 200-204

If type is set to gRPC, the default value is 0. If type is set to other protocols, the default value is 200.

This parameter will take effect only when type is set to HTTP, HTTPS or gRPC.

http_method

String

Specifies the HTTP method. The value can be GET, HEAD, or POST. The default value is GET.

This parameter is available when type is set to HTTP or HTTPS.

This parameter is unsupported. Please do not use it.

id

String

Specifies the health check ID.

max_retries

Integer

Specifies the number of consecutive health checks when the health check result of a backend server changes from OFFLINE to ONLINE.

The value ranges from 1 to 10.

max_retries_down

Integer

Specifies the number of consecutive health checks when the health check result of a backend server changes from ONLINE to OFFLINE.

The value ranges from 1 to 10, and the default value is 3.

monitor_port

Integer

Specifies the port used for the health check.

This parameter is left blank by default, indicating that a port of the backend server will be used by default. The port number ranges from 1 to 65535.

name

String

Specifies the health check name.

pools

Array of PoolRef objects

Lists the IDs of backend server groups for which the health check is configured. Only one ID will be returned.

project_id

String

Specifies the project ID.

timeout

Integer

Specifies the maximum time required for waiting for a response from the health check, in seconds.

It is recommended that you set the value less than that of parameter delay.

type

String

Specifies the health check protocol. The value can be TCP, UDP_CONNECT, HTTP, HTTPS, gRPC or TLS.

Note:

  • If the protocol of the backend server is QUIC, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is UDP, the value can only be UDP_CONNECT.

  • If the protocol of the backend server is TCP, the value can only be TCP, HTTP or HTTPS.

  • If the protocol of the backend server is HTTP, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is HTTPS, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is gRPC, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

  • If the protocol of the backend server is TLS, the value can only be TCP, HTTP, HTTPS, gRPC, or TLS.

url_path

String

Specifies the HTTP request path for the health check. The value must start with a slash (/), and the default value is /.

The value can contain letters, digits, hyphens (-), slashes (/), periods (.), percentage signs (%), question marks (?), pound signs (#), ampersand signs (&), and the extended character set _;~!()*[]@$^:',+.

Note: This parameter is available only when type is set to HTTP or HTTPS.

created_at

String

Specifies the time when the health check was configured. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time).

This is a new field in this version, and it will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

updated_at

String

Specifies the time when the health check was updated. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time).

This is a new field in this version, and it will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

Table 7 PoolRef

Parameter

Type

Description

id

String

Specifies the ID of the backend server group.

Example Requests

  • Configuring a health check for an HTTP backend server group

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/healthmonitors
    
    {
      "healthmonitor" : {
        "name" : "My Healthmonitor",
        "max_retries" : 3,
        "pool_id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
        "type" : "HTTP",
        "timeout" : 30,
        "delay" : 1
      }
    }
  • Example 2: Configuring a health check for an IP backend server group

    {
      "healthmonitor" : {
        "name" : "My Healthmonitor",
        "max_retries" : 3,
        "pool_id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
        "type" : "HTTP",
        "timeout" : 30,
        "delay" : 1,
        "port" : 80
      }
    }

Example Responses

Status code: 201

Normal response to POST requests.

{
  "request_id" : "0e837340-f1bd-4037-8f61-9923d0f0b19e",
  "healthmonitor" : {
    "monitor_port" : null,
    "id" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7441",
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "domain_name" : null,
    "name" : "My Healthmonitor",
    "delay" : 1,
    "max_retries" : 3,
    "pools" : [ {
      "id" : "488acc50-6bcf-423d-8f0a-0f4184f5b8a0"
    } ],
    "admin_state_up" : true,
    "timeout" : 30,
    "type" : "HTTP",
    "expected_codes" : "200",
    "url_path" : "/",
    "http_method" : "GET"
  }
}

SDK Sample Code

The SDK sample code is as follows.

  • Configuring a health check for an HTTP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
    import com.huaweicloud.sdk.elb.v3.*;
    import com.huaweicloud.sdk.elb.v3.model.*;
    
    
    public class CreateHealthMonitorSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            ElbClient client = ElbClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateHealthMonitorRequest request = new CreateHealthMonitorRequest();
            CreateHealthMonitorRequestBody body = new CreateHealthMonitorRequestBody();
            CreateHealthMonitorOption healthmonitorbody = new CreateHealthMonitorOption();
            healthmonitorbody.withDelay(1)
                .withMaxRetries(3)
                .withName("My Healthmonitor")
                .withPoolId("488acc50-6bcf-423d-8f0a-0f4184f5b8a0")
                .withTimeout(30)
                .withType("HTTP");
            body.withHealthmonitor(healthmonitorbody);
            request.withBody(body);
            try {
                CreateHealthMonitorResponse response = client.createHealthMonitor(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Example 2: Configuring a health check for an IP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
    import com.huaweicloud.sdk.elb.v3.*;
    import com.huaweicloud.sdk.elb.v3.model.*;
    
    
    public class CreateHealthMonitorSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            ElbClient client = ElbClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateHealthMonitorRequest request = new CreateHealthMonitorRequest();
            CreateHealthMonitorRequestBody body = new CreateHealthMonitorRequestBody();
            CreateHealthMonitorOption healthmonitorbody = new CreateHealthMonitorOption();
            healthmonitorbody.withDelay(1)
                .withMaxRetries(3)
                .withName("My Healthmonitor")
                .withPoolId("488acc50-6bcf-423d-8f0a-0f4184f5b8a0")
                .withTimeout(30)
                .withType("HTTP");
            body.withHealthmonitor(healthmonitorbody);
            request.withBody(body);
            try {
                CreateHealthMonitorResponse response = client.createHealthMonitor(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Configuring a health check for an HTTP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkelb.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = ElbClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(ElbRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateHealthMonitorRequest()
            healthmonitorbody = CreateHealthMonitorOption(
                delay=1,
                max_retries=3,
                name="My Healthmonitor",
                pool_id="488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
                timeout=30,
                type="HTTP"
            )
            request.body = CreateHealthMonitorRequestBody(
                healthmonitor=healthmonitorbody
            )
            response = client.create_health_monitor(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Example 2: Configuring a health check for an IP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkelb.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = ElbClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(ElbRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateHealthMonitorRequest()
            healthmonitorbody = CreateHealthMonitorOption(
                delay=1,
                max_retries=3,
                name="My Healthmonitor",
                pool_id="488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
                timeout=30,
                type="HTTP"
            )
            request.body = CreateHealthMonitorRequestBody(
                healthmonitor=healthmonitorbody
            )
            response = client.create_health_monitor(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Configuring a health check for an HTTP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := elb.NewElbClient(
            elb.ElbClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateHealthMonitorRequest{}
    	nameHealthmonitor:= "My Healthmonitor"
    	healthmonitorbody := &model.CreateHealthMonitorOption{
    		Delay: int32(1),
    		MaxRetries: int32(3),
    		Name: &nameHealthmonitor,
    		PoolId: "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
    		Timeout: int32(30),
    		Type: "HTTP",
    	}
    	request.Body = &model.CreateHealthMonitorRequestBody{
    		Healthmonitor: healthmonitorbody,
    	}
    	response, err := client.CreateHealthMonitor(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Example 2: Configuring a health check for an IP backend server group

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := elb.NewElbClient(
            elb.ElbClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateHealthMonitorRequest{}
    	nameHealthmonitor:= "My Healthmonitor"
    	healthmonitorbody := &model.CreateHealthMonitorOption{
    		Delay: int32(1),
    		MaxRetries: int32(3),
    		Name: &nameHealthmonitor,
    		PoolId: "488acc50-6bcf-423d-8f0a-0f4184f5b8a0",
    		Timeout: int32(30),
    		Type: "HTTP",
    	}
    	request.Body = &model.CreateHealthMonitorRequestBody{
    		Healthmonitor: healthmonitorbody,
    	}
    	response, err := client.CreateHealthMonitor(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

201

Normal response to POST requests.

Error Codes

See Error Codes.