Creates a routing rule for an Alibaba Cloud Service Mesh (ASM) gateway.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateIstioGatewayRoutes

The operation that you want to perform. Set the value to CreateIstioGatewayRoutes.

ServiceMeshId String Yes c08ba3fd1e6484b0f8cc1ad8fe10d****

The ID of the ASM instance.

IstioGatewayName String No ingressgateway

The name of the ASM gateway.

GatewayRoute Object No

The information about the routing rule to be created for the ASM gateway.

RouteName String No reviews-v2-routes

The name of the routing rule.

RouteType String No HTTP

The type of the traffic to be routed. Valid values: HTTP, TLS, and TCP.

MatchRequest Object No

The matching rules for traffic routing.

URI Object No

The matching rule for URIs.

MatchingMode String No prefix

The matching mode. Valid values:

  • exact: exact match
  • prefix: match by prefix
  • regex: match by regular expression
MatchingContent String No /ratings/v2/

The content to be matched.

Headers Array No

The request headers to be matched.

Name String No x-request-id

The header key to be matched.

MatchingMode String No exact

The matching mode for the header value. Valid values:

  • exact: exact match
  • prefix: match by prefix
  • regex: match by regular expression
MatchingContent String No v1

The header value to be matched.

TLSMatchAttributes Array No

The matching rule for TLS traffic.

TLSPort Integer No 443

The TLS port.

SNIHosts Array of String No *.com

The Server Name Indication (SNI) values to be matched. Wildcards can be used as the prefix of an SNI value. For example, a value of *.com matches foo.example.com and example.com.

Note The SNI values must be a subset of the hostnames of the corresponding virtual hosts.
Ports Array of Integer No 443

The ports of the specified hosts to which the traffic is routed.

RouteDestinations Array No

The endpoints of destination services for Layer 4 weighted routing.

Destination Object No

The unique endpoint of the destination service to which the specified requests are sent.

Host String No reviews

The name of the service defined in the service registry.

Subset String No v1

The name of the service subset.

Weight Integer No 80

The weight of the service subset.

HTTPAdvancedOptions Object No

The advanced settings for routing HTTP traffic.

HTTPRedirect Object No

The HTTP redirect rule.

Uri String No /v1/getProductRatings

The value to be used to overwrite the URL path during redirection.

Authority String No newratings.default.svc.cluster.local

The value to be used to overwrite the value of the Authority or Host header during redirection.

RedirectCode Integer No 301

The response code to be used for indicating URL redirection. Default value: 301.

Delegate Object No

The virtual service that defines traffic routing.

Name String No reviews

The name of the virtual service.

Namespace String No default

The namespace to which the virtual service belongs.

Rewrite Object No

The configurations for rewriting the virtual service.

Uri String No /v1/getProductRatings

The value to be used to overwrite the path or prefix of the URI.

Authority String No newratings.default.svc.cluster.local

The value to be used to overwrite the value of the Authority or Host header.

Timeout String No 5s

The timeout period for requests.

Retries Object No

The configurations of retries for failed requests.

Attempts Integer No 3

The maximum number of retries allowed for a request.

PerTryTimeout String No 2s

The timeout period for each retry.

RetryOn String No connect-failure,refused-stream,503

The condition for retries. Example: connect-failure,refused-stream,503.

RetryRemoteLocalities Object No

Specifies whether to allow retries to other localities.

Value Boolean No false

Specifies whether to allow retries to other localities. Valid values:

  • true: allows retries to other localities.
  • false: does not allow retries to other localities.

Default value: false.

Fault Object No

The configurations of fault injection.

Delay Object No

The duration to delay a request.

FixedDelay String No 5s

The fixed duration for request delay.

Percentage Object No

The percentage of requests to which the delay fault is injected.

Value Float No 0.1

The percentage of requests to which the delay fault is injected, expressed as a decimal.

Abort Object No

The configurations for aborting requests with specified error codes.

HttpStatus Integer No 400

The specified HTTP error code.

Percentage Object No

The percentage of requests that are aborted with the specified error code.

Value Float No 0.1

The percentage of requests that are aborted with the specified error code, expressed as a decimal.

Mirror Object No

The configurations for mirroring HTTP traffic to another destination in addition to forwarding requests to the specified destination.

Host String No reviews.default.svc.cluster.local

The name of the service defined in the service registry.

Subset String No v1

The name of the service subset.

MirrorPercentage Object No

The percentage of requests that are mirrored to another destination except for the original destination.

Value Float No 0.2

The percentage of requests that are mirrored to another destination except for the original destination, expressed as a decimal.

Priority Integer No 1

The priority of the routing rule. The value of this parameter is an integer. A smaller value indicates a higher priority.

Status Integer No 1

The status of the routing rule. Valid values:

  • 0: The routing rule is valid.
  • 1: The routing rule is invalid.
  • 2: An error occurs during the creation or update of the routing rule.
Description String No demo route

The description of the routing rule.

Response parameters

Parameter Type Example Description
RequestId String 31d3a0f0-07ed-4f6e-9004-1804498c****

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateIstioGatewayRoutes
&ServiceMeshId=c08ba3fd1e6484b0f8cc1ad8fe10d****
&IstioGatewayName=ingressgateway
&GatewayRoute={"RouteName":"reviews-v2-routes","RouteType":"HTTP","MatchRequest":{"URI":{"MatchingMode":"prefix","MatchingContent":"/ratings/v2/"},"Headers":[{"Name":"x-request-id","MatchingMode":"exact","MatchingContent":"v1"}],"TLSMatchAttributes":[{"TLSPort":443,"SNIHosts":["*.com"]}],"Ports":[443]},"RouteDestinations":[{"Destination":{"Host":"reviews","Subset":"v1"},"Weight":80}],"HTTPAdvancedOptions":{"HTTPRedirect":{"Uri":"/v1/getProductRatings","Authority":"newratings.default.svc.cluster.local","RedirectCode":301},"Delegate":{"Name":"reviews","Namespace":"default"},"Rewrite":{"Uri":"/v1/getProductRatings","Authority":"newratings.default.svc.cluster.local"},"Timeout":"5s","Retries":{"Attempts":3,"PerTryTimeout":"connect-failure,refused-stream,503","RetryOn":"connect-failure,refused-stream,503","RetryRemoteLocalities":{"Value":false}},"Fault":{"Delay":{"FixedDelay":"5s","Percentage":{"Value":0.1}},"Abort":{"HttpStatus":400,"Percentage":{"Value":0.1}}},"Mirror":{"Host":"reviews.default.svc.cluster.local","Subset":"v1"},"MirrorPercentage":{"Value":0.2}}}
&Priority=1
&Status=1
&Description=demo route
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateIstioGatewayRoutesResponse>
    <RequestId>31d3a0f0-07ed-4f6e-9004-1804498c****</RequestId>
</CreateIstioGatewayRoutesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "31d3a0f0-07ed-4f6e-9004-1804498c****"
}

Error codes

For a list of error codes, visit the API Error Center.