Updated on 2026-09-20 GMT+08:00

Querying DR Details

Function

This API is used to query details about a DR task.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dws:cluster:getDisasterRecovery

    Read

    cluster *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    dws:disasterRecovery:get

    -

URI

GET /v2/{project_id}/disaster-recovery/{disaster_recovery_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

disaster_recovery_id

Yes

String

Definition

DR ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

disaster_recovery

DisasterRecoveryQueryResp object

Definition

Response body for querying DR information.

Range

N/A

Table 3 DisasterRecoveryQueryResp

Parameter

Type

Description

id

String

Definition

DR ID.

Range

N/A

name

String

Definition

DR name.

Range

N/A

dr_type

String

Definition:

DR type.

Range:

  • AZ, cross-AZ DR.

  • Region: cross-region DR.

status

String

Definition:

DR status.

Range:

  • creating: The DR is being created.

  • create_failed: The DR relationship fails to be created.

  • unstart: The DR is not started.

  • starting: DR is being started.

  • start_failed: The DR fails to be started.

  • running: The DR is running.

  • stopping: The DR is being stopped.

  • stop_failed: The DR fails to be stopped.

  • switchovering: A disaster recovery switchover is being performed.

  • abnormal: The disaster recovery is abnormal.

  • deleting: The DR relationship is being deleted.

  • deleted: The DR relationship has been deleted.

primary_cluster

DisasterRecoveryCluster object

Definition

Primary cluster information.

Range

N/A

standby_cluster

DisasterRecoveryCluster object

Definition

DR cluster information.

Range

N/A

dr_sync_period

String

Definition

DR synchronization period.

Range

N/A

start_time

String

Definition

DR start time.

Range

N/A

create_time

String

Definition

DR creation time.

Range

N/A

Table 4 DisasterRecoveryCluster

Parameter

Type

Description

id

String

Definition

ID of the DR cluster.

Range

N/A

name

String

Definition

Name of the DR cluster.

Range

N/A

cluster_az

String

Definition

AZ where the DR cluster is located.

Range

N/A

role

String

Definition

Role of the DR cluster.

Range

N/A

region

String

Definition

Region where the DR cluster is located.

Range

N/A

status

String

Definition:

Status of the DR cluster.

Range:

  • backuping: The backup task is running.

  • restoring: The system is being restored.

  • stopped: The cluster is stopped.

  • waiting: The DR is running.

  • abnormal: The disaster recovery is abnormal.

  • drDeleted: The DR relationship has been deleted.

progress

String

Definition

DR progress.

Range

N/A

last_success_time

String

Definition

Last DR time.

Range

N/A

obs_bucket_name

String

Definition

OBS bucket name.

Range

N/A

datastore_version

String

Definition:

Database version.

Range:

None

datastore_type

String

Definition:

Database type.

Range:

None

disk_capacity

String

Definition:

Disk capacity

Range:

None

disk_used

String

Definition:

Disk usage

Range:

None

Example Requests

get https://{Endpoint}/v2/0536cdee2200d5912f7cc00b877980f1/disaster-recovery/b303b78d-438c-41dd-aaf6-c98eea1fc2a6

Example Responses

Status code: 200

DR information queried.

{
  "disaster_recovery" : {
    "id" : "b303b78d-438c-41dd-aaf6-c98eea1fc2a6",
    "name" : "dws-it-02",
    "status" : "running",
    "dr_type" : "region",
    "primary_cluster" : {
      "id" : "3de21046-e65e-4fcf-86bf-583115b39c27",
      "name" : "dws-203-primary",
      "cluster_az" : "cn-north-7c",
      "role" : "primary",
      "region" : "cn-north-7",
      "status" : "waiting",
      "progress" : "100",
      "last_success_time" : "2023-04-29T06:39:56",
      "obs_bucket_name" : null,
      "datastore_version" : "9.1.0.222",
      "datastore_type" : "dws",
      "disk_capacity" : "300.00",
      "disk_used" : "5.07"
    },
    "standby_cluster" : {
      "id" : "5d946c51-9ffa-49e3-9129-2bea4d23d3fd",
      "name" : "dws-205-standby",
      "cluster_az" : null,
      "role" : "standby",
      "region" : "cn-north-208",
      "status" : "waiting",
      "progress" : "100",
      "last_success_time" : "2023-04-29T06:39:56",
      "obs_bucket_name" : null,
      "datastore_version" : "9.1.0.222",
      "datastore_type" : "dws",
      "disk_capacity" : "300.00",
      "disk_used" : "5.07"
    },
    "dr_sync_period" : "3H",
    "start_time" : "2023-04-28T09:23:38",
    "create_time" : "2023-04-28T08:51:54"
  }
}

SDK Sample Code

The SDK sample code is as follows.

 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
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.dws.v2.region.DwsRegion;
import com.huaweicloud.sdk.dws.v2.*;
import com.huaweicloud.sdk.dws.v2.model.*;


public class ShowDisasterDetailSolution {

    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);

        DwsClient client = DwsClient.newBuilder()
                .withCredential(auth)
                .withRegion(DwsRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowDisasterDetailRequest request = new ShowDisasterDetailRequest();
        request.withDisasterRecoveryId("{disaster_recovery_id}");
        try {
            ShowDisasterDetailResponse response = client.showDisasterDetail(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());
        }
    }
}
 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdws.v2.region.dws_region import DwsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdws.v2 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 = DwsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DwsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowDisasterDetailRequest()
        request.disaster_recovery_id = "{disaster_recovery_id}"
        response = client.show_disaster_detail(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dws "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/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, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := dws.DwsClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := dws.NewDwsClient(hcClient)

    request := &model.ShowDisasterDetailRequest{}
	request.DisasterRecoveryId = "{disaster_recovery_id}"
	response, err := client.ShowDisasterDetail(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

200

DR information queried.

400

Request error.

401

Authentication failed.

403

You do not have required permissions.

404

No resources found.

500

Internal server error.

503

Service unavailable.