All Products
Search
Document Center

Microservices Engine:ApplyTagPolicies

Last Updated:Nov 13, 2024

Modifies a tag-based routing rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mse:ApplyTagPoliciesupdate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionstringYes

The region ID.

cn-hangzhou
NamespacestringNo

The Microservices Engine (MSE) namespace to which the application belongs.

default
AppNamestringNo

The name of the application.

example-app
AppIddeprecatedstringYes

The ID of the application.

h5pohqu3gd@xxx
RulesstringNo

The details of the routing rule.

{ "blue": { # Tag key. "rate": 20, # Rate. A value of 20 indicates that 20% of the traffic is routed to the node identified by the tag. "name": "luoye-route-test", # Routing rule name. "carryData": false, # Specifies whether to enable pass-through. This parameter is applicable to end-to-end canary release. "rules": { # Rule information. "dubbo": \[{ # Dubbo rule. The system also supports Spring Cloud and Istio rule. "serviceName": "com.taobao.hsf.common.DemoService", # Service name (operation name). "group": "", # Group name. "version": "", # Service version. "methodName": "sayHello", # Method name. "condition": "AND", # Logical operator used by the following items. Valid values: AND and OR. "argumentItems": \[{ # Array of rule details. "index": 0, # Index field. "expr": "", # Expression. Its details is described below. "operator": "rawvalue", # The comparison mode. A value of rawvalue indicates direct comparison. A value of mode indicates the modulo operation. A value of list indicates using a whitelist. "value": "jim", # Base value. The value obtained by the expression will be compared with this value. If operator is set to list, separate the items specified for this parameter with commas (,). Example: 1,2,3. "cond": "==" # Comparison operator. Valid values: >=, <=, >, <, and ==. }] }] } }, "\_base": { # Another tag key. "rate": 80 # Rate. A value of 20 indicates that 20% of the traffic is routed to the node identified by the tag. } }
NamespaceIdstringNo

Optional. The ID of the namespace.

12233****
EnablebooleanNo

Specifies whether to enable the routing rule.

true
AcceptLanguagestringNo

The language of the response. Valid values:

  • zh: Chinese
  • en: English
zh

Response parameters

ParameterTypeDescriptionExample
object
Messagestring

The message returned.

success
RequestIdstring

The ID of the request.

316F5F64-F73D-42DC-8632-01E308B6****
Dataarray<object>

The details of the data.

RouteRuleVOobject

The details of the data.

Statusinteger

The status.

1
InstanceNuminteger

The number of instances.

1
Removeboolean

Indicates whether the routing rule was deleted.

CarryDataboolean

Indicates whether the field is the primary key.

true
Tagstring

The tag.

gray
Namestring

The policy name.

test
Rulesstring

The details of the routing rule.

{\"_base\": {\"rate\": 100, \"remove\": true}, \"blue\": {\"rate\": 0}}
Idlong

The ID of the primary key.

12
Rateinteger

The rate.

10
Enableboolean

Indicates whether the rule is enabled. Valid values:

  • true: The rule is enabled.
  • false: The rule is disabled.
true
Successboolean

Indicates whether the request is successful.

true

Examples

Sample success responses

JSONformat

{
  "Message": "success",
  "RequestId": "316F5F64-F73D-42DC-8632-01E308B6****",
  "Data": [
    {
      "Status": 1,
      "InstanceNum": 1,
      "Remove": true,
      "CarryData": true,
      "Tag": "gray",
      "Name": "test",
      "Rules": "{\\\"_base\\\": {\\\"rate\\\": 100, \\\"remove\\\": true}, \\\"blue\\\": {\\\"rate\\\": 0}}",
      "Id": 12,
      "Rate": 10,
      "Enable": true
    }
  ],
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
400IllegalRequestInvalid request:%sInvalid request: %s
400InvalidParameterParameter error:%sRequest parameter error: %s
403NoPermissionYou are not authorized to perform this operation:%sYou do not have the permission to use this interface:%s
404NotFoundNot found:%sThe resource does not exist:%s
500InternalErrorConsole error. Try again later:%sConsole error. Try again later: %s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-09-06The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-09-06The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-08-16The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-07-07The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-07-06The request parameters of the API has changed. The response structure of the API has changedView Change Details
2023-03-24API Description Update. The request parameters of the API has changedView Change Details