Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ GeminiDB/ API Reference/ APIs v3 (Recommended)/ Tags/ Querying an Instance by Tag

Querying an Instance by Tag

Updated on 2023-11-21 GMT+08:00

Function

This API is used to query a specified instance by tag.

Constraints

This API supports the following types of instances:

  • GeminiDB Cassandra
  • GeminiDB Mongo
  • GeminiDB Influx
  • GeminiDB Redis

A maximum of 20 tags can be added to a DB instance. The tag key must be unique.

URI

POST https://{Endpoint}/v3/{project_id}/instances/resource-instances/action

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

offset

No

String

Index offset. The query starts from the next piece of data indexed by this parameter.

  • If action is set to count, this parameter does not need to be transferred.
  • If action is set to filter, the parameter value must be a positive integer. The default value is 0, indicating that the query starts from the first piece of data. '

limit

No

String

Number of records to be queried.

  • If action is set to count, this parameter does not need to be transferred.
  • If action is set to filter, the value ranges from 1 to 100. If this parameter is not transferred, the first 100 instances are queried by default.

action

Yes

String

Operation identifier.

  • If action is set to filter, instances are queried based on tag filters.
  • If action is set to count, only the total number of records is returned.

matches

No

Array of MatchOption objects

Search parameter.

  • If this parameter is not specified, the query is not based on the instance name or ID.
  • This parameter cannot be left blank.

tags

No

Array of TagOption objects

Included tags. Each tag contains a maximum of 20 keys.

Table 4 MatchOption

Parameter

Mandatory

Type

Description

key

Yes

String

Query criteria. The value can be instance_name or instance_id, indicating that the query is based on the instance name or instance ID.

value

Yes

String

Name or ID of the instance to be queried

Table 5 TagOption

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. It can contain a maximum of 36 Unicode characters. The key value cannot be null, an empty string, or spaces. Before using key, delete spaces before and after the value.

NOTE:

The character set of this parameter is not verified during search.

values

Yes

Array of strings

Tag values. Each tag value can contain a maximum of 43 Unicode characters and cannot contain spaces. Before using values, delete spaces before and after the value.

If the values is not specified, any parameter value can be queried. All values are in the OR relationship.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

instances

Array of InstanceResult objects

All instances.

total_count

Integer

Total number of records.

Table 7 InstanceResult

Parameter

Type

Description

instance_id

String

Instance ID.

instance_name

String

Instance name.

tags

Array of InstanceTagResult objects

All tags. If there are no tags, tags is taken as an empty array by default.

Table 8 InstanceTagResult

Parameter

Type

Description

key

String

Tag key. The tag key must be specified and can include a maximum of 36 Unicode characters.

It is case-sensitive and can contain digits, letters, underscores (_), and hyphens (-).

value

String

Tag value. The tag value can contain a maximum of 43 Unicode characters and can be an empty string.

It is case-sensitive and can contain digits, letters, underscores (_), periods (.), and hyphens (-).

Example Requests

  • URI example
    POST https://gaussdb-nosql.ap-southeast-1.myhuaweicloud.com/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances/resource-instances/action
  • Example request body

    Querying an instance by name (Set offset to 100 and limit to 100.)

    {
      "offset" : 100,
      "limit" : 100,
      "action" : "filter",
      "matches" : [{
        "key" : "instance_name",
        "value" : "test-single"
      }],
      "tags" : [{
        "key" : "key1",
        "values" : [ "value1", "value2" ]
      }]
    }

    Querying total records

    {
      "action" : "count",
      "tags" : [ {
        "key" : "key1",
        "values" : [ "value1", "value2" ]
      }, {
        "key" : "key2",
        "values" : [ "value1", "value2" ]
      } ],
      "matches" : [ {
        "key" : "instance_name",
        "value" : "test-single"
      }, {
        "key" : "instance_id",
        "value" : "958693039f284d6ebfb177375711072ein06"
      } ]
    }

Example Responses

Status code: 200

Success

{
  "total_count": 1,
  "instances" : [{
    "instance_id" : "2acbf2223caf3bac3c33c6153423c3ccin06",
    "instance_name" : "test-single",
    "tags" : [ {
      "key" : "key1",
      "value" : "value1"
    }, {
      "key" : "key2",
      "value" : "value1"
    } ]
  }]
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback