Help Center/ MapReduce Service/ API Reference/ API V1.1/ Version Metadata/ Querying the Metadata of a Cluster Version - ShowMrsVersionMetadata
Updated on 2026-09-15 GMT+08:00

Querying the Metadata of a Cluster Version - ShowMrsVersionMetadata

Function

This API is used to query the metadata information of a specified MRS version, including the list of components supported by the version, component versions, and configuration parameters. If a cluster ID is specified in the parameters, the latest metadata of the cluster after patch updates can be queried.

Constraints

None

Debugging

You can debug this API in API Explorer. Automatic authentication is supported. API Explorer can automatically generate sample SDK code and supports sample SDK code debugging.

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, no identity policy-based permissions are required for calling this API.

URI

GET /v1.1/{project_id}/metadata/versions/{version_name}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints

N/A

Range

The value must consist of 1 to 64 characters. Only letters and digits are allowed.

Default Value

N/A

version_name

Yes

String

Definition

Cluster version. You can view the currently supported version information on the MRS management console's cluster creation page. for example: MRS 3.1.0. If the request client does not support automatic escape, escape the space to %20, for example, MRS %203.1.0.

Constraints

N/A

Range

The value can contain 1 to 64 characters. Only letters, digits, periods (.), hyphens (-), and spaces are allowed.

Default Value

N/A

Table 2 Query parameter

Parameter

Mandatory

Type

Description

cluster_id

No

String

Definition

Cluster ID. If a cluster ID is specified, the latest version metadata of the installed patches for that cluster is obtained. For details about how to obtain the cluster ID, see Obtaining a Cluster ID.

Constraints

N/A

Range

The value can contain 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

other

Map<String,Object>

Definition

Other attributes. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

name

String

Definition

Image version name

Range

N/A

template_type

String

Definition

Template type

Range

N/A

image_id

String

Definition

Image ID.

Range

N/A

status

String

Definition

Version status.

Range

  • GA: Generally available version.
  • BETA: Beta test version.

features

Array of strings

Definition

Feature list.

Range

N/A

cluster_types

Array of strings

Definition

Cluster types.

Range

N/A

version_type

String

Definition

Version type

Range

  • lts: LTS version
  • basic: Basic version

components

Array of VersionComponentnt objects

Definition

Component list.

Range

N/A

resource_requirement

Array of strings

Definition

Resource description such as IP addresses required by the version.

Range

N/A

constraints

VersionConstraint object

Definition

Version constraint description.

Range

N/A

flavors

FlavorLists object

Definition

Flavor list.

Range

N/A

role_deploy_meta

Array of RoleDeployMeta objects

Definition

Deployment policy for version component instance roles.

Range

N/A

Table 4 VersionComponent

Parameter

Type

Description

other

Map<String,Object>

Definition

Other attributes. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

name

String

Definition

Component name.

Range

N/A

version

String

Definition

Supported versions.

Range

N/A

depend_on

Array of strings

Definition

Component dependencies.

Range

N/A

description

String

Definition

Component description.

Range

N/A

available_cluster_types

Array of strings

Definition

Cluster types that support the component.

Range

N/A

external_datasources

Array of ComponentExternalDatasource objects

Definition

External data sources.

Range

N/A

resource_requirement

Array of strings

Definition

Description of required resources, such as IP addresses.

Range

N/A

valid_roles

Array of strings

Definition

Valid roles.

Range

N/A

visible

Boolean

Definition

Visible or not.

Range

  • True: visible
  • False: invisible

children_components

Array of strings

Definition

Sub-components

Range

N/A

multi_az_support_status

String

Definition

Whether multi-AZ is supported.

Range

N/A

Table 5 ComponentExternalDatasource

Parameter

Type

Description

name

String

Definition

Name of the external data source.

Range

N/A

types

Array of strings

Definition

Type of the external data source.

Range

N/A

Table 6 VersionConstraint

Parameter

Type

Description

other

Map<String,Object>

Definition

Other constraints. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

node_constraint

NodeConstraints object

Definition

Node constraints.

Range

N/A

safe_mode_kerberos_exclude_components

Array of strings

Definition

Components excluded from clusters in security mode (Kerberos authentication enabled)

Range

N/A

Table 7 NodeConstraints

Parameter

Type

Description

other

Map<String,Object>

Definition

Other node constraints. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

master

NodeConstraint object

Definition

Master node constraints, including the number of nodes and disks.

Range

N/A

core

NodeConstraint object

Definition

Core node constraints, including the number of nodes and disks.

Range

N/A

task

NodeConstraint object

Definition

Task node constraints, including the number of nodes and disks.

Range

N/A

core_separate

NodeConstraint object

Definition

Core node constraints for management and control separation. Constraints for Core nodes in the management and control separation template, including the number of nodes and disks.

Range

N/A

core_combine

NodeConstraint object

Definition

Core node constraints for management and control co-location. Constraints for Core nodes in the management and control co-location template, including the number of nodes and disks.

Range

N/A

task_separate

NodeConstraint object

Definition

Task node constraints for management and control separation. Constraints for Task nodes in the management and control separation template, including the number of nodes and disks.

Range

N/A

task_combine

NodeConstraint object

Definition

Task node constraints for management and control co-location. Constraints for Task nodes in the management and control co-location template, including the number of nodes and disks.

Range

N/A

node_group_task

NodeConstraint object

Definition

Task node group constraints, including the number of nodes and disks.

Range

N/A

Table 8 NodeConstraint

Parameter

Type

Description

other

Map<String,Object>

Definition

Other constraints. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

min_node_num

Integer

Definition

Minimum number of nodes.

Range

N/A

max_node_num

Integer

Definition

Maximum number of nodes.

Range

N/A

min_core_num

Map<String,Integer>

Definition

Minimum number of cores. The key is the node group name, and the value is the number of cores.

Range

N/A

min_mem_size

Map<String,Integer>

Definition

Minimum memory capacity, in GB. The key is the node group name, and the value is the memory capacity.

Range

N/A

min_disk_size

Integer

Definition

Minimum disk capacity, in GB.

Range

N/A

max_node_group_num

Integer

Definition

Maximum number of nodes.

Range

N/A

min_data_volume_total_size

Map<String,Integer>

Definition

Minimum data volume capacity. The key is the data volume name, and the value is the capacity size in GB.

Range

N/A

disk_type_constraint

Map<String,String>

Definition

Disk type restrictions, including the types supported by the current node group. The key is the disk type name, and the value is the constraint description.

Range

N/A

min_root_disk_size

Integer

Definition

Minimum system disk size, in GB.

Range

N/A

Table 9 FlavorLists

Parameter

Type

Description

master

Array of strings

Definition

Specifications supported by Master nodes.

Range

N/A

core

Array of strings

Definition

Specifications supported by Core nodes.

Range

N/A

task

Array of strings

Definition

Specifications supported by Task nodes.

Range

N/A

Table 10 RoleDeployMeta

Parameter

Type

Description

other

Map<String,Object>

Definition

Other extended attributes. The key (string type) indicates the attribute name, and the value (object type) indicates the corresponding attribute value.

Range

N/A

name

String

Definition

Role name.

Range

N/A

code_name

String

Definition

Short name of the role.

Range

N/A

component

String

Definition

Component to which the role belongs.

Range

N/A

node_preference

String

Definition

Node deployment preference.

Range

N/A

count

String

Definition

Maximum number of roles.

Range

N/A

affinity

String

Definition

Affinity.

Range

N/A

affinity_target

String

Definition

Target in the affinity relationship.

Range

N/A

multi_instance

Integer

Definition

Multi-instance. Some components can be deployed on multiple instances within the same cluster.

Range

N/A

role_kind

String

Definition

Role type.

Range

N/A

constraints

Array of strings

Definition

Role restrictions, including function restrictions of the current component role, for example, "no_scale_in".

Range

N/A

multi_az_placement

String

Definition

Multi-AZ deployment.

Range

N/A

arbitration_deployment

Boolean

Definition

Whether to use arbitration deployment.

Range

  • true: Use arbitration deployment.
  • false: Do not use arbitration deployment.

support_elb

Boolean

Definition

Whether ELB is supported.

Range

  • true: ELB is supported.
  • false: ELB is not supported.

multi_affinity_group_enable

Boolean

Definition

Whether to enable the multi-affinity groups.

Range

  • true: Enable multi-affinity groups.
  • false: Disable multi-affinity groups.

local_disks_anti_affinity

Boolean

Definition

Local disk anti-affinity, used to control the cluster scheduling policy. When enabled, the scheduler avoids scheduling multiple instances of the same service to the same host, preventing multiple instances from sharing the local disk of that host. When disabled, this isolation constraint does not apply, and multiple instances can be allocated to the same machine to share the local disk.

Range

  • true: Enable local disk anti-affinity.
  • false: Disable local disk anti-affinity.

multi_instance_name_pattern

String

Definition

Multi-instance name pattern.

Range

N/A

private_ip

String

Definition

Private IP addresses.

Range

N/A

weight

String

Definition

Weight.

Range

N/A

Example Request

Obtain the metadata of MRS 3.1.0.

GET /v1.1/{project_id}/metadata/versions/MRS%203.1.0

Example Response

Status code: 200

Version metadata details. Some contents are omitted in this example. For details, call the API.

{
  "other" : { },
  "name" : "MRS 3.1.0",
  "template_type" : "clusterFusion",
  "image_id" : "ECS:X86:deda7c89-6069-46d3-af7c-4afc31eec0d9,ECS:ARM:d5f0087b-9fd7-4977-b9c8-d07262f452d6,BMS:ks1ne:bf071a00-d1d6-472f-943b-22f733248f36,BMS:d2:a9a1a279-85c9-4c05-bd0a-4cb786937a09",
  "status" : "GA",
  "features" : [ "anti_affinity", "auto_scaling", "bootstrap_scripts", "bootstrap_support_obs", "custom_config", "custom_topology", "datasource_manager", "decouple_install", "elastic_ip", "fi_cluster", "fi_cluster_v2", "iam_user_sync", "log_collect", "log_collect_v2", "master_scale_up", "mrs_ecs_agency", "multi_disks", "multi_login_mode", "obs_integration", "obs_user_policy", "opensource_port_matrix", "ops_channel", "password_policy_v2", "random_passwd_for_install", "register_dns_server", "resize", "resources_plans", "safe_mode", "scale_scripts", "security_job_submit", "smn_alarm", "spark_sql_validation_in_executor", "support_obs_protocol", "task_node", "unified_management_ui", "sql_execution", "multi_az", "weak_multi_az_deployment_constraint", "multi_master_scale_up", "omm_random_pwd", "metric_monitor", "auth_manager", "cluster_patch", "hw_domain_name", "fi_custom_config", "force_scale_up", "skip_fi_evs_expand", "detach_node" ],
  "cluster_types" : [ "analysis", "streaming", "mixed", "custom" ],
  "version_type" : "basic",
  "components" : [ {
    "other" : { },
    "name" : "Hadoop",
    "version" : "3.1.1",
    "depend_on" : [ "ZooKeeper", "Ranger" ],
    "description" : "A framework that allows for the distributed processing of large data sets across clusters.",
    "available_cluster_types" : [ "analysis", "mixed", "custom" ],
    "external_datasources" : null,
    "resource_requirement" : [ "privateIp:1" ],
    "valid_roles" : [ "NameNode", "Zkfc", "JournalNode", "DataNode", "ResourceManager", "NodeManager", "JobHistoryServer", "TimelineServer", "HttpFS" ],
    "visible" : true,
    "children_components" : [ "HDFS", "Mapreduce", "Yarn" ],
    "multi_az_support_status" : "multi_az_ha"
  }, {
    "other" : { },
    "name" : "Spark2x",
    "version" : "2.4.5",
    "depend_on" : [ "HDFS", "Yarn", "Hive", "KrbClient", "KrbServer", "ZooKeeper" ],
    "description" : "Apache Spark2x is a fast and general engine based on open source Spark2.x for large-scale data processing.",
    "available_cluster_types" : [ "analysis", "mixed", "custom" ],
    "external_datasources" : null,
    "resource_requirement" : null,
    "valid_roles" : [ "JobHistory2x", "JDBCServer2x", "SparkResource2x", "IndexServer2x" ],
    "visible" : true,
    "children_components" : [ "Spark2x" ],
    "multi_az_support_status" : "multi_az_ha"
  }, {
    "other" : { },
    "name" : "HBase",
    "version" : "2.2.3",
    "depend_on" : [ "HDFS", "Yarn", "KrbServer", "ZooKeeper" ],
    "description" : "A scalable, distributed database that supports structured data storage for large tables.",
    "available_cluster_types" : [ "analysis", "mixed", "custom" ],
    "external_datasources" : null,
    "resource_requirement" : null,
    "valid_roles" : [ "HMaster", "RegionServer", "ThriftServer", "Thrift1Server", "RESTServer", "RegionServer_1" ],
    "visible" : true,
    "children_components" : [ "HBase" ],
    "multi_az_support_status" : "multi_az_ha"
  }, {
    "other" : { },
    "name" : "Hive",
    "version" : "3.1.0",
    "depend_on" : [ "HDFS", "Mapreduce", "Yarn", "DBService", "ZooKeeper" ],
    "description" : "A data warehouse infrastructure that provides data summarization and ad hoc querying.",
    "available_cluster_types" : [ "analysis", "mixed", "custom" ],
    "external_datasources" : [ {
      "name" : "hive_metastore",
      "types" : [ "RDS_MYSQL", "DLCATALOG" ]
    } ],
    "resource_requirement" : null,
    "valid_roles" : [ "MetaStore", "WebHCat", "HiveServer" ],
    "visible" : true,
    "children_components" : [ "Hive" ],
    "multi_az_support_status" : "multi_az_ha"
  }, {
    "other" : { },
    "name" : "ZooKeeper",
    "version" : null,
    "depend_on" : [ "KrbClient", "KrbServer" ],
    "description" : null,
    "available_cluster_types" : [ "analysis", "streaming", "mixed", "custom" ],
    "external_datasources" : null,
    "resource_requirement" : null,
    "valid_roles" : [ "quorumpeer" ],
    "visible" : true,
    "children_components" : [ "ZooKeeper" ],
    "multi_az_support_status" : "multi_az_ha"
  } ],
  "resource_requirement" : [ "privateIp:2" ],
  "constraints" : {
    "other" : { },
    "node_constraint" : {
      "other" : { },
      "master" : {
        "other" : { },
        "min_node_num" : 2,
        "max_node_num" : 9,
        "min_core_num" : null,
        "min_mem_size" : null,
        "min_disk_size" : 600,
        "max_node_group_num" : 1,
        "min_data_volume_total_size" : null,
        "disk_type_constraint" : null,
        "min_root_disk_size" : 480
      },
      "core" : {
        "other" : { },
        "min_node_num" : 3,
        "max_node_num" : 500,
        "min_core_num" : null,
        "min_mem_size" : null,
        "min_disk_size" : 600,
        "max_node_group_num" : null,
        "min_data_volume_total_size" : null,
        "disk_type_constraint" : null,
        "min_root_disk_size" : 480
      },
      "task" : null,
      "core_separate" : null,
      "core_combine" : null,
      "task_separate" : null,
      "task_combine" : null,
      "node_group_task" : {
        "other" : { },
        "min_node_num" : 2,
        "max_node_num" : 10000,
        "min_core_num" : null,
        "min_mem_size" : null,
        "min_disk_size" : 600,
        "max_node_group_num" : 9,
        "min_data_volume_total_size" : null,
        "disk_type_constraint" : null,
        "min_root_disk_size" : 480
      }
    },
    "safe_mode_kerberos_exclude_components" : [ "Presto", "Pulsar" ]
  },
  "flavors" : {
    "master" : [ "ac7.4xlarge.4", "ac7.8xlarge.4", "ac7.16xlarge.4", "ac7.32xlarge.4", "ac7.8xlarge.2", "ac7.16xlarge.2", "ac7.32xlarge.2", "am7.2xlarge.8", "am7.4xlarge.8", "am7.8xlarge.8", "c3ne.4xlarge.4", "c3ne.8xlarge.4", "c3ne.15xlarge.4" ],
    "core" : [ "ac7.4xlarge.4", "ac7.8xlarge.4", "ac7.16xlarge.4", "ac7.32xlarge.4", "ac7.8xlarge.2", "ac7.16xlarge.2", "ac7.32xlarge.2", "am7.2xlarge.8", "am7.4xlarge.8", "am7.8xlarge.8", "c3ne.4xlarge.4", "c3ne.8xlarge.4", "c3ne.15xlarge.4", "c6.4xlarge.4", "c6.8xlarge.2", "c6.8xlarge.4", "c6.16xlarge.2" ],
    "task" : [ "ac7.4xlarge.4", "ac7.8xlarge.4", "ac7.16xlarge.4", "ac7.32xlarge.4", "ac7.8xlarge.2", "ac7.16xlarge.2", "ac7.32xlarge.2", "am7.2xlarge.8", "am7.4xlarge.8", "am7.8xlarge.8", "c3ne.4xlarge.4", "c3ne.8xlarge.4", "c3ne.15xlarge.4" ]
  },
  "role_deploy_meta" : [ {
    "other" : { },
    "name" : "OMSServer",
    "code_name" : "OMS",
    "component" : "OMSServer",
    "node_preference" : "MASTER",
    "count" : "2",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "NameNode",
    "code_name" : "NN",
    "component" : "HDFS",
    "node_preference" : "MASTER",
    "count" : "2",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "Zkfc",
    "code_name" : "ZKFC",
    "component" : "HDFS",
    "node_preference" : null,
    "count" : null,
    "affinity" : "JUST_COLOCATE",
    "affinity_target" : "NameNode",
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "HttpFS",
    "code_name" : "HFS",
    "component" : "HDFS",
    "node_preference" : "MASTER",
    "count" : "[0-10]",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "JournalNode",
    "code_name" : "JN",
    "component" : "HDFS",
    "node_preference" : "MASTER",
    "count" : "[3-60],step=2",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "QUORUM_LIKE",
    "arbitration_deployment" : true,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "DataNode",
    "code_name" : "DN",
    "component" : "HDFS",
    "node_preference" : "NO_LIMIT",
    "count" : "[3-10000]",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : "stateful",
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "ResourceManager",
    "code_name" : "RM",
    "component" : "Yarn",
    "node_preference" : "MASTER",
    "count" : "2",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : null,
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  }, {
    "other" : { },
    "name" : "NodeManager",
    "code_name" : "NM",
    "component" : "Yarn",
    "node_preference" : "NO_LIMIT",
    "count" : "[3-10000]",
    "affinity" : null,
    "affinity_target" : null,
    "multi_instance" : null,
    "role_kind" : "stateless",
    "constraints" : null,
    "multi_az_placement" : "AT_LEAST_2",
    "arbitration_deployment" : false,
    "support_elb" : false,
    "multi_affinity_group_enable" : false,
    "local_disks_anti_affinity" : false,
    "multi_instance_name_pattern" : null,
    "private_ip" : null,
    "weight" : null
  } ]
}

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.mrs.v1.region.MrsRegion;
import com.huaweicloud.sdk.mrs.v1.*;
import com.huaweicloud.sdk.mrs.v1.model.*;


public class ShowMrsVersionMetadataSolution {

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

        MrsClient client = MrsClient.newBuilder()
                .withCredential(auth)
                .withRegion(MrsRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowMrsVersionMetadataRequest request = new ShowMrsVersionMetadataRequest();
        request.withVersionName("{version_name}");
        try {
            ShowMrsVersionMetadataResponse response = client.showMrsVersionMetadata(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 huaweicloudsdkmrs.v1.region.mrs_region import MrsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkmrs.v1 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 = MrsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(MrsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowMrsVersionMetadataRequest()
        request.version_name = "{version_name}"
        response = client.show_mrs_version_metadata(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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    mrs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/mrs/v1/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 := mrs.NewMrsClient(
        mrs.MrsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowMrsVersionMetadataRequest{}
	request.VersionName = "{version_name}"
	response, err := client.ShowMrsVersionMetadata(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

Version metadata details. (This example omits some content. For the full response, call the API to view it.)

Error Codes

For details, see Error Codes.