หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

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

Querying Resource Instances

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

Function

This API is used to filter instances by tag.

URI

POST /v2/{project_id}/{resource_type}/resource_instances/action

Table 1 Path parameters

Parameter

Type

Description

project_id

String

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

resource_type

String

Resource type.

  • ief-edge_node
  • ief-deployment
  • ief-application
  • ief-device

Request

Request parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

tags

No

Array of tag objects

The instances to be queried contain tags listed in tags. Each instance to be queried contains a maximum of 20 keys. Each tag key has a maximum of 10 tag values. The tag value corresponding to each tag key can be an empty array but the structure cannot be missing. Each tag key must be unique, and each tag value in a tag must be unique. The response returns instances containing all tags in this list. Keys in this list are in the AND relationship and values in each key-value structure are in the OR relationship. If both tags_any and tags fields are specified, the union set of the two fields is returned after deduplication. If no filtering condition is specified, full data is returned.

tags_any

No

Array of tag objects

The instances to be queried contain any tag listed in tags_any. Each instance to be queried contains a maximum of 20 keys. Each tag key has a maximum of 10 tag values. Each tag key must be unique, and each tag value in a tag must be unique. The response returns instances containing any tag in this list. Keys in this list are in the OR relationship and values in each key-value structure are also in the OR relationship. If both tags_any and tags fields are specified, the union set of the two fields is returned after deduplication. If no filtering condition is specified, full data is returned.

not_tags

No

Array of tag objects

The instances to be queried do not contain any tag listed in this field. Each instance to be queried contains a maximum of 20 keys. Each tag key has a maximum of 10 tag values. Each tag key must be unique, and each tag value in a tag must be unique. The response returns instances containing no tag in this list. Keys are in the AND relationship and values in each key-value structure is in the OR relationship. If no filtering condition is specified, full data is returned.

not_tags_any

No

Array of tag objects

The instances to be queried do not contain all tags listed in this field. Each instance to be queried contains a maximum of 20 keys. Each tag key has a maximum of 10 tag values. Each tag key must be unique, and each tag value in a tag must be unique. The response returns resources containing no tag in this list. Keys in this list are in the OR relationship and values in each key-value structure are also in the OR relationship. If no filtering condition is specified, full data is returned.

limit

No

String

Number of records to be queried. This parameter is not available when action is set to count. If action is set to filter, the default value is 1000. The maximum value is 1000, and the minimum value is 1. The value cannot be a negative number.

offset

No

String

Index position. This parameter is not available when action is set to count. If offset is set to N, the resource query starts from the N+1 piece of data. If action is set to filter, the value of offset is 0 by default, indicating that the query starts from the first piece of data. The offset value must be a number and cannot be a negative number.

action

Yes

String

Operation to be performed. The value can only be filter or count.

If action is set to filter, the query is performed based on the filter criteria. If action is set to count, only the total number of records is returned.

matches

No

Array of match objects

Search field. The tag key is the field to be matched, for example, resource_name. The tag value indicates the value to be matched. The key is a fixed dictionary value and cannot contain duplicate keys or unsupported keys.

This field determines whether fuzzy match is required based on the keys. For example, if key is resource_name, fuzzy match (case insensitive, not supporting *, and supporting character string matching) is used by default. If value is empty, an empty list is returned because for IEF, resource_name cannot be left blank.

console

No

Boolean

This field is used to check whether the request is initiated from the console to determine whether the content of resource_detail is returned. If the value is true, the content is returned. If the value is false or the parameter is not contained, an empty list is returned.

sorted

No

Table 31 object

Sorting mode of results returned after resources are filtered by tag.

Table 4 tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key, which can contain a maximum of 36 Unicode characters. It cannot be left blank. The character set of this parameter is not verified during search. Key cannot be empty, an empty string, or spaces. Before verifying and using key, delete spaces of single-byte character (SBC) before and after the value.

values

No

Array of strings

List of tag values. Each value contains a maximum of 43 Unicode characters. Before verifying and using this field, delete SBC spaces before and after the value.

The asterisk (*) is reserved for the system. If the value starts with *, it indicates that fuzzy match is performed based on the value following *. The value cannot contain only asterisks (*).

If values is left blank, it indicates any_value (querying any value). All values of a tag key are in the OR relationship.

Table 5 match

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. Currently, only resource_name is supported.

value

No

String

Tag value. Each tag value can contain a maximum of 64 Unicode characters. The character set range is not verified.

Example request

When action is set to filter:

{
    "action": "filter",
    "limit": "10",
    "offset": "0",
    "matches":[{"key":"resource_name","value":"q"}],
    "tags":[
        {
            "key":"test",
            "values": ["value1","value2"]
        }
        ]
}

Response

Response parameters

Table 6 Parameters in the response body

Parameter

Mandatory

Type

Description

resources

Yes

Array of resource objects

Resource instances.

total_count

Yes

Integer

Total number of records.

Table 7 resource

Parameter

Mandatory

Type

Description

resource_id

Yes

String

Resource ID.

tags

Yes

Array of resource_tag objects

A list of tags. This parameter is an empty array by default if there is no tag.

resource_name

Yes

String

Resource name. This parameter is an empty string by default if there is no resource name.

Table 8 resource_tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

value

Yes

String

Tag value.

Example response

When action is set to filter:

{
    "total_count": 2,
    "resources": [
        {
            "tags": [
                {
                    "value": "",
                    "key": "testtest"
                },
                {
                    "value": "value2",
                    "key": "test"
                }
            ],
            "resource_name": "node_test_0108_1",
            "resource_id": "e25307d4-bd25-4c29-ba7f-176376ed2f99"
        },
        {
            "tags": [
                {
                    "value": "value1",
                    "key": "key1"
                },
                {
                    "value": "",
                    "key": "test"
                }
            ],
            "resource_name": "node_test-0109_1",
            "resource_id": "fc3aeee8-24e1-4912-bf7a-54854251d0e5"
        }
    ]
}

Response body when action is set to count:

{
"total_count": 2
}

Error Codes

For details, see Error Codes.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback