文档数据库服务
| Details
  • 查询API版本
    • ListApiVersion
    • ShowApiVersion
  • 引擎版本和规格
    • ListDatastoreVersions
    • ListFlavorInfos
    • ListFlavors
    • ListStorageType
  • 实例管理
    • AddReadonlyNode
    • AddShardingNode
    • AttachEip
    • AttachInternalIp
    • BatchUpgradeDatabaseVersion
    • CancelEip
    • ChangeOpsWindow
    • CheckWeakPassword
    • CreateInstance
    • CreateIp
    • DeleteInstance
    • DeleteLtsConfig
    • DeleteReadonlyNode
    • ExpandReplicasetNode
    • ListAz2Migrate
    • ListInstances
    • ListLtsConfigs
    • ListRecycleInstances
    • ListSslCertDownloadAddress
    • MigrateAz
    • ResizeInstance
    • ResizeInstanceVolume
    • RestartInstance
    • SetAutoEnlargePolicies
    • SetRecyclePolicy
    • ShowAutoEnlargePolicy
    • ShowClientNetwork
    • ShowDiskUsage
    • ShowRecyclePolicy
    • ShowReplSetName
    • ShowSecondLevelMonitoringStatus
    • ShowUpgradeDuration
    • ShrinkInstanceNodes
    • SwitchoverReplicaSet
    • SwitchSecondLevelMonitoring
    • SwitchSsl
    • UpdateClientNetwork
    • UpdateInstanceName
    • UpdateInstancePort
    • UpdateInstanceRemark
    • UpdateLtsConfig
    • UpdateReplSetName
    • UpdateSecurityGroup
    • UpgradeDatabaseVersion
  • 连接管理
    • DeleteSession
    • ListSessions
    • ShowConnectionStatistics
  • 备份与恢复
    • BatchDeleteBackup
    • CreateManualBackup
    • DeleteManualBackup
    • ListBackups
    • ListRestoreCollections
    • ListRestoreDatabases
    • ListRestoreTimes
    • RestoreInstance
    • RestoreInstanceFromCollection
    • RestoreNewInstance
    • SetBackupPolicy
    • ShowBackupDownloadLink
    • ShowBackupPolicy
    • StopBackup
  • 获取日志信息
    • DeleteAuditLog
    • DownloadErrorlog
    • DownloadSlowlog
    • ListAuditlogLinks
    • ListAuditlogs
    • ListErrorLogs
    • ListLtsErrorLogs
    • ListLtsSlowLogs
    • ListSlowLogs
    • SetAuditlogPolicy
    • ShowAuditlogPolicy
    • ShowSlowlogDesensitizationSwitch
    • SwitchSlowlogDesensitization
  • 标签管理
    • BatchTagAction
    • ListInstancesByTags
    • ListInstanceTags
    • ListProjectTags
  • 管理数据库和用户
    • CheckPassword
    • CreateDatabaseRole
    • CreateDatabaseUser
    • DeleteDatabaseRole
    • DeleteDatabaseUser
    • ListDatabaseRoles
    • ListDatabases
    • ListDatabaseUsers
    • ResetPassword
    • SetBalancerSwitch
    • SetBalancerWindow
    • ShowShardingBalancer
  • 参数配置
    • CompareConfiguration
    • CopyConfiguration
    • CreateConfiguration
    • DeleteConfiguration
    • ListAppliedInstances
    • ListConfigurations
    • ResetConfiguration
    • ShowConfigurationAppliedHistory
    • ShowConfigurationModifyHistory
    • ShowConfigurationParameter
    • ShowEntityConfiguration
    • ShowInstanceConfigurationModifyHistory
    • SwitchConfiguration
    • UpdateConfigurationParameter
    • UpdateEntityConfiguration
    • ValidateConfigurationName
  • 配额管理
    • ShowQuotas
  • 任务管理
    • ListTasks
    • ShowJobDetail
  • 数据库运维
    • CreateKillOpRule
    • DeleteKillOpRuleList
    • ShowKillOpRuleRuleList
    • SwitchInstancePrimary
    • UpdateKillOpRule
  • 定时任务
    • CancelScheduledTask
    • ListScheduledTasks

ListInstances

GET
https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances
Advanced
Required parameters only
Default
Encrypt sensitive parameters
*
Region
Headers
*
Authorization
Parameters
*
project_id
*
id
*
name
*
mode
*
datastore_type
*
vpc_id
*
subnet_id
*
offset
*
limit
*
tags
API Description

This API is used to query DB instances and details based on specified conditions.

URL
GET  https://dds.af-south-1.myhuaweicloud.com/v3/{project_id}/instances
Request Parameters
NameTypeINMandatoryDescription
x-auth-token
stringheader Yes

Specifies the user token obtained from the IAM service.

project_id
stringpath Yes

Specifies the project ID of a tenant in a region.

tags
stringquery No

Query based on the instance tag key and value. {key} indicates the tag key, and {value} indicates the tag value. A maximum of 20 key-value pairs are supported. The key cannot be empty or duplicate, but the value can be empty. To query instances with multiple tag keys and values, separate key-value pairs with commas (,).

limit
integerquery No

Specifies the maximum allowed number of DB instances. The value ranges from 1 to 100. If this parameter is not transferred, the first 100 DB instances are queried by default.

offset
integerquery No

Specifies the index position. The query starts from the next instance creation time indexed by this parameter under a specified project. If offset is set to N, the resource query starts from the N+1 piece of data. The value must be greater than or equal to 0. If this parameter is not transferred, offset is set to 0 by default, indicating that the query starts from the latest created DB instance.

subnet_id
stringquery No

Specifies the network ID of the subnet.

vpc_id
stringquery No

Specifies the VPC ID.

datastore_type
stringquery No

Specifies the database type. The value is DDS-Community.

mode
stringquery No

Specifies the instance type.

  • Sharding indicates the cluster instance.
  • ReplicaSet indicate the replica set instance.
  • Single indicates the single node instance.
name
stringquery No

Querying DB Instances If you use asterisk (*) at the beginning of the name, fuzzy search results are returned. Otherwise, the exact results are returned.

  • The asterisk (*) is a reserved character in the system and cannot be used alone.
id
stringquery No

Specifies the instance ID, which can be obtained by calling the API for querying instances and details. If you do not have an instance, you can call the API used for creating an instance.

Response Parameters
Status code: 200

Success.

NameTypeDescription
instances
Array of QueryInstanceResponse objects

Indicates the DB instance information.

total_count
integer

Indicates the total number of queried records.

200 instances
NameTypeDescription
id
string

Indicates the DB instance information.

name
string

Indicates the DB instance name.

remark
string

Indicates the DB instance remark.

status
string

Indicates the DB instance status. Valid value:

  • normal: indicates that the instance is running properly.
  • abnormal: indicates that the instance is abnormal.
  • creating: indicates that the instance is being created.
  • frozen: indicates that the instance is frozen.
  • data_disk_full: indicates that the instance disk is full.
  • createfail: indicates that the instance failed to be created.
  • enlargefail: indicates that nodes failed to be added to the instance.
port
string

Indicates the database port number. The port range is 2100 to 9500.

mode
string

Indicates the instance type, which is the same as the request parameter.

region
string

Indicates the region where the DB instance is deployed.

datastore
DatastoreItem object

Indicates the database information.

engine
string

Indicates the storage engine. The value is wiredTiger.

created
string

Indicates the DB instance creation time.

updated
string

Indicates the time when a DB instance is updated.

db_user_name
string

Indicates the default username. The value is rwuser.

ssl
integer

Indicates that SSL is enabled or not.

  • 1: indicate that SSL is enabled.
  • 0: indicate that SSL is disabled.
vpc_id
string

Indicates the VPC ID.

subnet_id
string

Indicates the network ID of the subnet.

security_group_id
string

Indicates the security group ID.

backup_strategy
BackupStrategyForItemResponse object

Indicates the backup policy.

pay_mode
string

Indicates the billing mode.

  • 0: indicates the pay-per-use billing mode.
  • 1: indicates the yearly/monthly billing mode.
maintenance_window
string

Indicates the maintenance time window.

groups
Array of GroupResponseItem objects

Indicates group information.

disk_encryption_id
string

Indicates the disk encryption key ID.

enterprise_project_id
string

Indicates the enterprise project ID. If the value is 0, the resource belongs to the default enterprise project.

time_zone
string

Indicates the time zone.

dss_pool_id
string

Indicates the DSS storage pool ID of the DeC user.

actions
Array of strings

Indicates the operation that is executed on the DB instance.

order_id
string

Indicates the order ID.

tags
Array of TagResponse objects

Indicates the tag list.

200 instances.datastore
NameTypeDescription
type
string

Indicates the DB engine.

version
string

Indicates the database version.

patch_available
boolean

whether there is a patch available for upgrading the instance. If true is returned, the instance can be upgraded using a patch.

200 instances.backup_strategy
NameTypeDescription
start_time
string

Indicates the backup time window. Automated backups will be triggered during the backup time window. The current time is the UTC time.

keep_days
integer

Indicates the number of days to retain the generated backup files. The value range is from 0 to 732.

200 instances.groups
NameTypeDescription
type
string

Indicates the node type. Valid value:

  • shard
  • config
  • mongos
  • replica
  • single
id
string

Indicates the group ID. This parameter is valid only when the node type is shard or config.

name
string

Indicates the group name. This parameter is valid only when the node type is shard or config.

status
string

Indicates the group status. This parameter is valid only when the node type is shard or config.

volume
Volume object

Indicates the volume information. This parameter is valid only when the node type is shard, config, replica, or single.

nodes
Array of NodeItem objects

Indicates node information.

200 instances.groups.volume
NameTypeDescription
size
string

Indicates the disk size. Unit: GB

used
string

Indicates the disk usage. Unit: GB

200 instances.groups.nodes
NameTypeDescription
id
string

Indicates the node ID.

name
string

Indicates the node name.

status
string

Indicates the node status.

role
string

Indicates the node role. Valid value:

  • master: This value is returned for the mongos node.
  • Primary: This value is returned for the primary shard and config nodes, the primary node of a replica set, and a single node.
  • Secondary: This value is returned for the secondary shard and config nodes, and the secondary node of a replica set.
  • Hidden: This value is returned for the hidden shard and config nodes, and the hidden node of a replica set.
  • unknown. This value is returned when the node is abnormal.
private_ip
string

Indicates the private IP address of a node.By default, this parameter is valid only for mongos nodes, replica set instances, and single node instances. The value exists only after ECSs are created successfully. Otherwise, the value is "".

public_ip
string

Indicates the EIP that has been bound. The value is "". This parameter is valid only for mongos nodes of cluster instances, primary nodes and secondary nodes of replica set instances, and single node instances.

spec_code
string

Indicates the resource specification code.

availability_zone
string

Indicates the AZ.

200 instances.tags
NameTypeDescription
key
string

Indicates the tag key.

value
string

Indicates the tag value.

Status code: default

Client or server error.

NameTypeDescription
error_code
string

Specifies the error returned when a task submission exception occurs.

error_msg
string

Specifies the description of the error returned when a task submission exception occurs.

Example Request
Example 1
"GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances"
Example Response
Status code: 200

Success.

Example 1
{
"instances": [
{
"id": "8436a91546294036b75931e879882200in02",
"name": "dds-efa6",
"remark": "test",
"status": "normal",
"port": 8635,
"mode": "ReplicaSet",
"region": "aaa",
"datastore": {
"type": "DDS-Community",
"version": "3.4"
},
"engine": "wiredTiger",
"created": "2019-01-17T07:05:52",
"updated": "2019-01-17T07:05:47",
"db_user_name": "rwuser",
"ssl": 1,
"vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961",
"subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007b",
"security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58",
"backup_strategy": {
"start_time": "16:00-17:00",
"keep_days": 7
},
"pay_mode": 0,
"maintenance_window": "02:00-06:00",
"groups": {
"type": "replica",
"volume": {
"size": 10,
"used": 0.33
},
"nodes": [
{
"id": "233eaac9c6f245c0bb9c2d21eea12d1bno02",
"name": "dds-efa6_replica_node_2",
"status": "normal",
"role": "Primary",
"private_ip": "192.168.0.174",
"public_ip": "",
"spec_code": "dds.s2.medium.4.shard",
"availability_zone": "bbb"
},
{
"id": "d57d76d6320a4a7b86db82c317550c4ano02",
"name": "dds-efa6_replica_node_1",
"status": "normal",
"role": "Hidden",
"private_ip": "192.168.0.39",
"public_ip": "",
"spec_code": "dds.s2.medium.4.shard",
"availability_zone": "bbb"
},
{
"id": "f46b0a1cf4d9400e9fd7af17f8742d37no02",
"name": "dds-efa6_replica_node_3",
"status": "normal",
"role": "Secondary",
"private_ip": "192.168.0.176",
"public_ip": "",
"spec_code": "dds.s2.medium.4.shard",
"availability_zone": "bbb"
}
]
},
"enterprise_project_id": "0",
"time_zone": "",
"dss_pool_id": "f5f84ed7-6f19-4bd4-99d7-b450ad6cc4dd",
"actions": [
"CREATE"
],
"tags": [
{
"key": "dds001",
"value": "dds001"
}
]
},
{
"id": "d77905385f114217b75ae7d6ab9a7588in02",
"name": "dds-5699",
"status": "normal",
"remark": "测试",
"port": 8635,
"mode": "Single",
"region": "aaa",
"datastore": {
"type": "DDS-Community",
"version": "3.4"
},
"engine": "wiredTiger",
"created": "2019-01-17T07:04:39",
"updated": "2019-01-17T07:04:33",
"db_user_name": "rwuser",
"ssl": 1,
"vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961",
"subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007b",
"security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58",
"backup_strategy": {
"start_time": "17:00-18:00",
"keep_days": 7
},
"pay_mode": 0,
"maintenance_window": "02:00-06:00",
"groups": {
"type": "single",
"volume": {
"size": 10,
"used": 0.33
},
"nodes": [
{
"id": "bd4dccbd53ae48d5bd3046bebf715079no02",
"name": "dds-5699_single_node_1",
"status": "normal",
"role": "Primary",
"private_ip": "192.168.0.9",
"public_ip": "",
"spec_code": "dds.mongodb.c6.medium.4.single",
"availability_zone": "bbb"
}
]
},
"enterprise_project_id": "0",
"time_zone": "",
"actions": [
"CREATE"
],
"tags": [
{
"key": "dds001",
"value": "dds001"
}
]
},
{
"id": "9136fd2a9fcd405ea4674276ce36dae8in02",
"name": "dds-32f4",
"remark": 123,
"status": "normal",
"port": 8635,
"mode": "Sharding",
"region": "aaa",
"datastore": {
"type": "DDS-Community",
"version": "3.4",
"patch_available": false
},
"engine": "wiredTiger",
"created": "2019-01-17T07:04:37",
"updated": "2019-01-17T07:04:31",
"db_user_name": "rwuser",
"ssl": 1,
"vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961",
"subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007b",
"security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58",
"backup_strategy": {
"start_time": "19:00-20:00",
"keep_days": 7
},
"pay_mode": 0,
"maintenance_window": "02:00-06:00",
"groups": [
{
"type": "mongos",
"nodes": [
{
"id": "a742c13a284949adad177672e8a0f01cno02",
"name": "dds-32f4_mongos_node_1",
"status": "normal",
"role": "Primary",
"private_ip": "192.168.0.56",
"public_ip": "",
"spec_code": "dds.mongodb.c6.medium.4.mongos",
"availability_zone": "bbb"
},
{
"id": "d4f66666b1d64ab28719da0526341c7eno02",
"name": "dds-32f4_mongos_node_2",
"status": "normal",
"role": "Primary",
"private_ip": "192.168.0.185",
"public_ip": "",
"spec_code": "dds.mongodb.c6.medium.4.mongos",
"availability_zone": "bbb"
}
]
},
{
"type": "shard",
"volume": {
"size": 10,
"used": 0.33
},
"nodes": [
{
"id": "0e9abaebe5974b63a5b221de6ee34cfeno02",
"name": "dds-32f4_shard_2_node_3",
"status": "normal",
"role": "Primary",
"spec_code": "dds.mongodb.c6.medium.4.shard",
"availability_zone": "bbb"
},
{
"id": "1d7f4c5476c04cc187f920925c2b601fno02",
"name": "dds-32f4_shard_2_node_2",
"status": "normal",
"role": "Hidden",
"spec_code": "dds.mongodb.c6.medium.4.shard",
"availability_zone": "bbb"
},
{
"id": "3dd2cce03da54fc08f10651cbfea778dno02",
"name": "dds-32f4_shard_2_node_1",
"status": "normal",
"role": "Secondary",
"spec_code": "dds.mongodb.c6.medium.4.shard",
"availability_zone": "bbb"
}
]
},
{
"type": "config",
"volume": {
"size": 10,
"used": 0.33
},
"nodes": [
{
"id": "7422f7331b714ac39aa647a1ec968d33no02",
"name": "dds-32f4_config_node_2",
"status": "normal",
"role": "Primary",
"spec_code": "dds.mongodb.c6.large.2.config",
"availability_zone": "bbb"
},
{
"id": "9e3b343151044eda91ddb8a42ae5cbefno02",
"name": "dds-32f4_config_node_3",
"status": "normal",
"role": "Hidden",
"spec_code": "dds.mongodb.c6.large.2.config",
"availability_zone": "bbb"
},
{
"id": "c0053ca460ac4889841ffb14a886ec54no02",
"name": "dds-32f4_config_node_1",
"status": "normal",
"role": "Secondary",
"spec_code": "dds.mongodb.c6.large.2.config",
"availability_zone": "bbb"
}
]
}
],
"enterprise_project_id": "0",
"time_zone": "",
"actions": [
"CREATE"
],
"tags": [
{
"key": "dds001",
"value": "dds001"
}
]
}
],
"total_count": 3
}
SDK
Click 文档数据库服务 (DDS) SDK to download the SDK in your programming language or view the SDK documentation. To learn how to install an SDK and perform authentication, read Usage.
Error Code

Outline

API Description
URL
Request Parameters
Response Parameters
Example Request
Example Response
SDK
Error Code