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

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

Creating a Rule

Updated on 2024-04-23 GMT+08:00

Function

This API is used to create a rule.

URI

POST /v2/{project_id}/routemgr/rules

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request

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

rule

No

Rule object

Rule details.

Table 4 Rule

Parameter

Mandatory

Type

Description

description

No

String

Rule description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

ief_instance_id

No

String

Platinum edition instance ID. This parameter is left blank for a professional edition instance.

in_using

No

Boolean

Whether to enable the rule. The default value is true, indicating that the rule is enabled.

name

Yes

String

Rule name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

The rule name must be unique in the account.

source

Yes

String

Source endpoint ID.

source_resource

Yes

Map<String,Object>

Source endpoint resource.

Example:

  • rest: The value of path must be in the standard URI format.
    {"path":"/a/b/c"}
  • eventbus:
    {"topic": "<project id>/nodes/<node id>/user/<Customized character string that meets the Eventbus topic requirements>","node_id":"<Node ID>"}

target

Yes

String

Destination endpoint ID.

target_resource

Yes

Map<String,Object>

Destination endpoint resource. Example:

  • dis:
    {"channel": "dis channel name"}
  • servicebus:
    {"path": "/request path"}
  • apigw:
    {"resource": "http://ssss.com"}
  • eventbus:
    {"topic": "/xxxx"}

Response

When the status code is 201, the response parameters are as follows.

Table 5 Parameters in the response body

Parameter

Type

Description

rule

RuleResponse object

Rule details.

Table 6 RuleResponse

Parameter

Type

Description

created_at

String

Creation time.

description

String

Rule description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

fail_messages

Integer

Number of messages that fail to be forwarded.

id

String

Rule ID.

ief_instance_id

String

Platinum edition instance ID. This parameter is left blank for a professional edition instance.

in_using

Boolean

Whether to enable the rule. The default value is true, indicating that the rule is enabled.

name

String

Rule name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

The rule name must be unique in the account.

project_id

String

Project ID.

source

EndpointResponse object

Source endpoint information.

source_resource

Map<String,Object>

Source endpoint resource. Example:

  • rest:
    {"path":"<standard uri format>"}
  • eventbus:
    {"topic": "<project id>/nodes/<node id>/user/<Customized character string that meets the Eventbus topic requirements>","node_id":"<Node ID>"}

success_messages

Integer

Number of messages that are successfully forwarded.

target

EndpointResponse object

Destination endpoint information.

target_resource

Map<String,Object>

Destination endpoint resource. Example:

  • dis:
    {"channel": "dis channel name"}
  • servicebus:
    {"path": "/request path"}
  • apigw:
    {"resource": "http://ssss.com"}
  • eventbus:
    {"topic": "/xxxx"}

updated_at

String

Update time.

Table 7 EndpointResponse

Parameter

Type

Description

created_at

String

Creation time.

description

String

Endpoint description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

id

String

Endpoint ID.

ief_instance_id

String

Platinum edition instance ID. This parameter is left blank for a professional edition instance.

is_shared

Boolean

Whether the endpoint is shared.

name

String

Endpoint name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

The endpoint name must be unique in the account.

project_id

String

Project ID.

properties

Map<String,Object>

Endpoint properties to be displayed. Example:

  • dis:
    {"domain_id":"user's domain id"}
  • servicebus:
    {"service_port":8080}
  • apigw:
    {"domain_id":"user's domain id"}

type

String

Endpoint type.

The options are as follows:

  • dis
  • servicebus
  • apigw

updated_at

String

Update time.

When the status code is 400, the response parameters are as follows:

Table 8 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

When the status code is 401, the response parameters are as follows.

Table 9 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

When the status code is 500, the response parameters are as follows:

Table 10 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

Example Request

{
  "rule" : {
    "name" : "haha",
    "source" : "88626dd0-0616-47c0-9980-e702e0fb8f7c",
    "source_resource" : {
      "topic" : "d16e6eb6cc0d49a0941df2f31285757a/device/c978f393-d80a-4aa0-b182-ec8ae879bab8/messages/#",
      "node_id" : "f90347b6-9659-4f8b-a839-f9396696b2fb"
    },
    "target" : "e7d02d47-961d-4e65-9f15-856272983ca9",
    "target_resource" : {
      "channel" : "AAA"
    }
  }
}

Example Response

None

Status Codes

Status Code

Description

201

Creation succeeded.

400

Error response.

401

Error response.

500

Error response.

Error Codes

For details, see Error Codes.

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

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback