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

Creating a Dark Launch Policy

Function

This API is used to create a dark launch policy.

URI

PUT /v3/{project_id}/govern/route-rule/microservices/{service_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Unique ID of a tenant's sub-project. The value contains 1 to 64 characters.

service_name

Yes

String

Microservice name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

environment

No

String

Environment. If this parameter is left blank,<empty> is used.

app_id

No

String

Application. If this parameter is left blank, default is used.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Enter application/json;charset=UTF-8.

X-Auth-Token

Yes

String

User token.

x-engine-id

Yes

String

Instance ID of an exclusive microservice engine.

X-Enterprise-Project-ID

Yes

String

Enterprise project ID.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

[items]

Yes

Array of CreateRules objects

Struct of the request for creating a dark launch policy.

Table 5 CreateRules

Parameter

Mandatory

Type

Description

precedence

No

Integer

Priority. A larger value indicates a higher priority.

match

No

CreateMatch object

Request matching rule. The value ranges from 0 to N. If this parameter is left empty, the request is matched.

route

No

Array of CreateRoute objects

Routing rule list.

Table 6 CreateMatch

Parameter

Mandatory

Type

Description

headers

No

headers object

Matched Headers.

Table 7 headers

Parameter

Mandatory

Type

Description

<header>

No

<header> object

Rule for matching Headers.

Table 8 <header>

Parameter

Mandatory

Type

Description

exact

No

String

Exactly matched value.

caseInsensitive

No

Boolean

Case insensitive or not.

Table 9 CreateRoute

Parameter

Mandatory

Type

Description

name

No

String

Rule name.

weight

No

Integer

Weight.

tags

No

tags object

List of matched instance tags.

Table 10 tags

Parameter

Mandatory

Type

Description

<tag>

No

String

Instance tag. Instances that meet the tag conditions are placed in this group.

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

result

String

Result message.

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

detail

String

Location details.

Example Requests

PUT https://{endpoint}/v3/{project_id}/govern/route-rule/microservices/{service_name}

[ {
  "precedence" : 1,
  "match" : {
    "headers" : {
      "<header>" : {
        "exact" : "test",
        "caseInsensitive" : false
      }
    }
  },
  "route" : [ {
    "name" : "rule_1",
    "weight" : 20,
    "tags" : {
      "<tag>" : "1.0.0"
    }
  } ]
} ]

Example Responses

Status code: 200

OK

{
  "result" : "string"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.