Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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

Querying DeHs by Tag

Updated on 2024-02-29 GMT+08:00

Function

  • This API is used to filter DeHs by tag and return the list of all tags of a DeH.
  • Tag Management Service (TMS) uses this API to filter the DeHs.

URI

POST /v1.0/{project_id}/dedicated-host-tags/resource_instances/action

Table 1 describes the parameters.

Table 1 Parameters description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies the project ID.

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

Request

Table 2 Request parameters

Parameter

Type

Mandatory

Description

tags

Array of objects

No

Displays all DeHs with specified tags. For more information, see Table 3.

  • A maximum of 10 keys can be included. Each key can have a maximum of 10 values.
  • The structure body must be included.
  • The tag key cannot be left blank or set to an empty string.
  • A key must be unique.
  • Values of the same key must be unique.

not_tags

Array of objects

No

Displays the DeHs with none of specified tags. For more information, see Table 3.

  • A maximum of 10 keys can be included. Each key can have a maximum of 10 values.
  • The structure body must be included.
  • The tag key cannot be left blank or set to an empty string.
  • Keys must be unique.
  • Values of the same key must be unique.

limit

Integer

No

Limits the maximum number of queried DeHs. The value cannot be a negative number. The maximum value is 1000.

  • If the action value is count, this parameter is invalid.
  • If the action value is filter, the default value is 1000.

offset

Integer

No

Specifies the index position. The query starts from the next piece of data indexed by this parameter. The value must be a non-negative number.

You do not need to specify this parameter when querying resources on the first page. When you query resources on subsequent pages, set the value of offset to the location returned in the response body for the previous query.

  • If the action value is count, this parameter is invalid.
  • If the action value is filter, the default value is 0.

action

String

Yes

Specifies the operation, which can be filter or count.

  • filter: Filters DeHs by tag and lists DeHs that meet the search criteria. Listed DeHs are queried by page.
  • count: Searches for DeHs by tag and returns the number of DeHs that meet the search criteria.

tags_any

Array of objects

No

Includes any of the specified tags. For more information, see Table 3.

  • This field contains a maximum of 10 tag keys and 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 key must be unique, and cannot contain duplicate values.
  • The response returns resources containing the tags in this list. Keys in this list are in an OR relationship and values in each key-value structure are also in an OR relationship.
  • If no tag filtering condition is specified, full data is returned.

not_tags_any

Array of objects

No

Excludes any of the specified tags. For more information, see Table 3.

  • This field contains a maximum of 10 tag keys and 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 key must be unique, and cannot contain duplicate values.
  • The response returns resources containing no tags in this list. Keys in this list are in an OR relationship and values in each key-value structure are also in an OR relationship.
  • If no tag filtering condition is specified, full data is returned.

matches

Array of objects

No

Specifies the search field, which is used to search for DeHs by condition.

Currently, only resource_name can be used for search. For more information, see Table 4.

Table 3 tag field description

Parameter

Type

Mandatory

Description

key

String

Yes

Specifies the tag key.

  • It contains a maximum of 127 Unicode characters.
  • This field cannot be left blank.

values

Array of strings

No

Specifies the tag values.

  • Each tag contains a maximum of 10 values.
  • Values of the same tag must be unique.
  • Each value can contain a maximum of 255 Unicode characters.
  • If this parameter is not specified, any value can be used.
  • The resources containing one or more values listed in values will be found and displayed.
Table 4 match field description

Parameter

Type

Mandatory

Description

key

String

Yes

Specifies the key parameter to be matched.

  • The key must be unique, and the value is used for matching.
  • The key field is a fixed dictionary value.
  • This field cannot be left blank.
NOTE:

The parameter value can only be resource_name, which is the DeH name.

value

String

Yes

Specifies the tag value.

  • Each value can contain a maximum of 255 Unicode characters.
  • This field cannot be left blank.

Response

Table 5 Response parameters

Parameter

Type

Description

resources

Array of objects

Specifies the returned DeH list. For details, see Table 6.

total_count

Integer

Specifies the total number of resources.

Table 6 Description of the resource field

Parameter

Type

Description

resource_id

String

Specifies the DeH ID.

resouce_detail

String

Specifies the DeH details.

This field is used for future extension and is left empty by default.

tags

Array of objects

Specifies the tag list.

For details, see Table 7.

resource_name

String

Specifies the resource name.

Table 7 tag field description

Parameter

Type

Description

key

String

Specifies the tag key.

  • It contains a maximum of 36 Unicode characters.
  • This field cannot be left blank.
  • It cannot contain the following ASCII characters: =*<>\|/,

value

String

Specifies the tag value.

  • Each value contains a maximum of 43 Unicode characters.
  • This field can be left blank.
  • It cannot contain the following ASCII characters: =*<>\|/,

Example Request

Filter DeHs by tag. From the first data record, query the DeH using the search field (field: resource_name; value: resource1) and the tag (key: key1; value: value1).
POST https://{Endpoint}/v1.0/9c53a566cb3443ab910cf0daebca90c4/dedicated-host-tags/resource_instances/action 
{ 
    "offset": "0",
    "limit": "100",
    "action": "filter",
    "matches": [
        {
            "key": "resource_name",
            "value": "resource1"
        }
    ],
    "tags": [
        {
            "key": "key1",
            "values": ["value1"]
        }
    ]
}

Example Response

Response body when action is set to filter

{
    "resources": [
        {
            "resource_detail": null,
            "resource_id": "cdfs_cefs_wesas_12_dsad",
            "resource_name": "resource1",
            "tags": [
                {
                    "key": "key1",
                    "value": "value1"
                }
            ]
        }
    ],
    "total_count": 1
}

Response body when action is set to count

{
    "total_count": 100
}

Status Code

See Status Codes.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback