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

Querying Shared File Systems by Tag

Updated on 2024-03-05 GMT+08:00

Function

This API is used to query shared file systems by tag.

URI

  • POST /v2/{project_id}/sfs/resource_instances/action
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

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

Request Header

The operation message header is the same as that of a common request. For details, see Table 3.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    offset

    No

    String

    Specifies the index location. The value is a character string consisting of 0 and positive integers. The default value is 0. The first record in the query result is the offset+1 record that meets the query criteria.

    limit

    No

    String

    Specifies the maximum number of query records. The value is a character string consisting of integers. The default value is 1000. The value ranges from 1 to 1000.

    The number of returned records cannot exceed the value of limit.

    action

    Yes

    String

    Specifies the operation identifier. Possible values are filter and count.

    Use filter to query details of a shared file system using tags.

    matches

    No

    Array of matches

    Specifies the file system query field. If this parameter is left null, all shared file systems of the tenant are searched by default.

    tags

    No

    Array of tags

    Specifies the tag search field, which is a list of tags. Only shared file systems containing all the listed tags can be returned. Tags in this search criteria are in the AND relationship. Specifically, a shared file system can be searched only when it meets all the tag search criteria. In the key-values structure of each tag search condition, tag values are in the OR relationship. If the value of tags is not specified, all shared file systems meet the requirement of this tag search field. 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. Tag keys must be unique. Tag values in a key-values structure must be unique.

    tags_any

    No

    Array of tags

    Specifies the tag search field, which is a list of tags. Shared file systems that contain any listed tag will be returned. Tags in this search criteria are in the OR relationship. Specifically, a shared file system can be searched as long as it meets one tag search condition. In the key-values structure of each tag search condition, tag values are in the OR relationship. If the value of tags_any is not specified, all shared file systems meet the requirement of this tag search field. 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. Tag keys must be unique. Tag values in a key-values structure must be unique.

    not_tags

    No

    Array of tags

    Specifies the tag search field, which is a list of tags. Only shared file systems that contain none of the listed tags will be returned. Tags in this search criteria are in the NOR relationship. Specifically, a shared file system can be searched only when it does not meet any tag search criteria. In the key-values structure of each tag search condition, tag values are in the OR relationship. If the value of not_tags is not specified, all shared file systems meet the requirement of this tag search field. 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. Tag keys must be unique. Tag values in a key-values structure must be unique.

    not_tags_any

    No

    Array of tags

    Specifies the tag search field, which is a list of tags. Shared file systems that do not contain any of the listed tags will be returned. Tags in this search criteria are in the NAND relationship. Specifically, a shared file system can be searched as long as it does not meet one tag search condition. In the key-values structure of each tag search condition, tag values are in the OR relationship. If the value of not_tags_any is not specified, all shared file systems meet the requirement of this tag search field. 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. Tag keys must be unique. Tag values in a key-values structure must be unique.

    sys_tags

    No

    Array of tags

    Only the op_service permission can use this field to filter resources.

    1. Currently, TMS can invoke only one tag structure key, _sys_enterprise_project_id.
    2. Currently, key contains only one value. 0 indicates the default enterprise project.
    3. sys_tags and tenant tag filtering conditions (tags, tags_any, not_tags, and not_tags_any) cannot be used at the same time.
    NOTICE:

    In the request parameters, tag search fields tags, tags_any, not_tags, and not_tags_any are optional and can be combined with each other. Such tag search fields are in the AND relationship.

  • Description of the match field

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    String

    Specifies the key. The value is fixed to resource_name.

    value

    Yes

    String

    Specifies the value. value indicates the name of a shared file system. An empty string specifies an exact match and only shared file systems whose names are empty can be queried. A non-empty string specifies a fuzzy query (case insensitive). The value can contain a maximum of 255 characters.

  • Description of the tag field

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    String

    Specifies the key of the tag. A tag key can contain a maximum of 127 characters. This parameter cannot be left blank.

    values

    Yes

    Array of strings

    Lists the values. Each value can contain a maximum of 255 characters. If the value is left empty, any value is matched. The values are in the OR relationship.

  • Example request
    Querying shared file systems using tag (key1, value2)
    {
        "offset": "0",
        "limit": "100",
        "action": "filter",
        "matches": [{
            "key": "resource_name",
            "value": "share_name"
        }],
        "tags": [{
            "key": "key1",
            "values": ["value2"]
        }, {
            "key": "key2",
            "values": []
        }],
        "tags_any": [{
            "key": "key3",
            "values": ["value3"]
        }, {
            "key": "key4",
            "values": []
        }],
        "not_tags": [{
            "key": "key5",
            "values": ["value5"]
        }, {
            "key": "key6",
            "values": []
        }],
        "not_tags_any": [{
            "key": "key7",
            "values": ["value7", "value8"]
        }, {
            "key": "key9",
            "values": []
        }]
    }
  • Example request (without passing matches)
    {
        "offset": "0",
        "limit": "100",
        "action": "filter",
        "tags": [{
            "key": "key1",
            "values": ["value2"]
        }, {
            "key": "key2",
            "values": []
        }]
    }
  • Example request (without passing limit and offset)
    {
        "action": "filter",
        "matches": [{
            "key": "resource_name",
            "value": "share_name"
        }],
        "tags": [{
            "key": "key1",
            "values": ["value2"]
        }, {
            "key": "key2",
            "values": []
        }]
    }
  • Example request (without passing tags, not_tags, tags_any, and not_tags_any)
    {
        "offset": "0",
        "limit": "100",
        "action": "filter",
        "matches": [{
            "key": "resource_name",
            "value": "share_name"
        }]
    }
  • Example request (with the action field only)
    {
        "action": "filter"
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    resources

    Array of resources

    Specifies the list of shared file systems that meet the query criteria.

    total_count

    Integer

    Specifies the total number of shared file systems that meet the query criteria.

    NOTE:

    total_count specifies the total number of shared file systems that meet the query criteria, instead of the number returned after you set offset and limit.

  • Data structure of the resource field

    Parameter

    Type

    Description

    resource_id

    String

    Specifies the ID of the shared file system.

    resource_detail

    Object

    Specifies the resource details. The value is a resource object, used for extension. This value is left empty by default.

    tags

    Array of resource_tags

    Specifies the list of tags. If no tags exist, the value is an empty array by default.

    sys_tags

    Array of tags

    Only the op_service permission can obtain this field.

    1. Currently, only one tag structure key is used, _sys_enterprise_project_id.
    2. Currently, key contains only one value. 0 indicates the default enterprise project.

    This field cannot be returned in non-op_service scenarios.

    resource_name

    String

    Specifies the resource name.

  • Data structure of the resource_tag field

    Parameter

    Type

    Description

    key

    String

    Specifies the tag key. The value can contain a maximum of 36 characters. This parameter cannot be left blank. It cannot contain non-printable ASCII characters (0-31) or the following characters: =*<>\,|/

    value

    String

    Specifies the tag value. The value contains a maximum of 43 characters and can be an empty string. It cannot contain non-printable ASCII characters (0-31) or the following characters: =*<>\,|/

  • Example response
    {
        "resources":[
            {
                "resource_detail":{},
                "resource_id":"b1f3f06f-344d-446b-a4bf-647a225debae",
                "resource_name":"share_name",
                "tags":[
                    {
                        "key":"key1", 
                        "value": "value1"
                    },
                    {
                        "key":"key2", 
                        "value": "value2"
                    }
                ]
            }
        ],
        "total_count":1
    }

Status Codes

  • Normal

    200

  • Abnormal

    Status Code

    Description

    400 Bad Request

    Invalid value.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    Access to the requested page is forbidden.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    The request is not completed because of a service error.

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