Skip to content

Commit c5b5f44

Browse files
New CLI examples for APi Gateway v2 (#9568)
1 parent df9bac5 commit c5b5f44

File tree

5 files changed

+188
-0
lines changed

5 files changed

+188
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
**To create a routing rule**
2+
3+
The following ``create-routing-rule`` example creates a routing rule with a priority of ``50``. ::
4+
5+
aws apigatewayv2 create-routing-rule \
6+
--domain-name 'regional.example.com' \
7+
--priority 50 \
8+
--conditions '[ \
9+
{ \
10+
"MatchBasePaths": { \
11+
"AnyOf": [ \
12+
"PetStoreShopper" \
13+
] \
14+
} \
15+
} \
16+
]' \
17+
--actions '[ \
18+
{ \
19+
"InvokeApi": { \
20+
"ApiId": "abcd1234", \
21+
"Stage": "prod" \
22+
} \
23+
} \
24+
]'
25+
26+
Output::
27+
28+
{
29+
"Actions": [
30+
{
31+
"InvokeApi": {
32+
"ApiId": "abcd1234",
33+
"Stage": "prod",
34+
"StripBasePath": false
35+
}
36+
}
37+
],
38+
"Conditions": [
39+
{
40+
"MatchBasePaths": {
41+
"AnyOf": [
42+
"PetStoreShopper"
43+
]
44+
}
45+
}
46+
],
47+
"Priority": 50,
48+
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
49+
"RoutingRuleId": "aaa111"
50+
}
51+
52+
For more information, see `Routing rules to connect API stages to a custom domain name for REST APIs <https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-routing-rules.html>`__ in the *Amazon API Gateway Developer Guide*.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**To delete a routing rule**
2+
3+
The following ``delete-routing-rule`` example deletes a routing rule for a custom domain name. ::
4+
5+
aws apigatewayv2 delete-routing-rule \
6+
--domain-name 'regional.example.com' \
7+
--routing-rule-id aaa111
8+
9+
This command produces no output.
10+
11+
For more information, see `Routing rules to connect API stages to a custom domain name for REST APIs <https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-routing-rules.html>`__ in the *Amazon API Gateway Developer Guide*.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
**To get a routing rule**
2+
3+
The following ``get-routing-rule`` example gets a routing rule for a domain name. ::
4+
5+
aws apigatewayv2 get-routing-rule \
6+
--domain-name 'regional.example.com' \
7+
--routing-rule-id aaa111
8+
9+
Output::
10+
11+
{
12+
"Actions": [
13+
{
14+
"InvokeApi": {
15+
"ApiId": "abcd1234",
16+
"Stage": "prod",
17+
"StripBasePath": false
18+
}
19+
}
20+
],
21+
"Conditions": [
22+
{
23+
"MatchBasePaths": {
24+
"AnyOf": [
25+
"PetStoreShopper"
26+
]
27+
}
28+
}
29+
],
30+
"Priority": 50,
31+
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
32+
"RoutingRuleId": "aaa111"
33+
}
34+
35+
For more information, see `Routing rules to connect API stages to a custom domain name for REST APIs <https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-routing-rules.html>`__ in the *Amazon API Gateway Developer Guide*.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
**To list routing rules**
2+
3+
The following ``list-routing-rules`` example lists the routing rules for a domain name. ::
4+
5+
aws apigatewayv2 list-routing-rules \
6+
--domain-name 'regional.example.com'
7+
8+
Output::
9+
10+
{
11+
"RoutingRules": [
12+
{
13+
"Actions": [
14+
{
15+
"InvokeApi": {
16+
"ApiId": "abcd1234",
17+
"Stage": "prod",
18+
"StripBasePath": false
19+
}
20+
}
21+
],
22+
"Conditions": [
23+
{
24+
"MatchBasePaths": {
25+
"AnyOf": [
26+
"PetStoreShopper"
27+
]
28+
}
29+
}
30+
],
31+
"Priority": 150,
32+
"RoutingRuleArn": "arn:aws:apigateway:us-east-1:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
33+
"RoutingRuleId": "aaa111"
34+
}
35+
]
36+
}
37+
38+
For more information, see `Routing rules to connect API stages to a custom domain name for REST APIs <https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-routing-rules.html>`__ in the *Amazon API Gateway Developer Guide*.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
**To update a routing rule**
2+
3+
The following ``put-routing-rule`` example updates the priority of a routing rule. ::
4+
5+
aws apigatewayv2 put-routing-rule \
6+
--domain-name 'regional.example.com' \
7+
--priority 150 \
8+
--conditions '[ \
9+
{ \
10+
"MatchBasePaths": { \
11+
"AnyOf": [ \
12+
"PetStoreShopper" \
13+
] \
14+
} \
15+
} \
16+
]' \
17+
--actions '[ \
18+
{ \
19+
"InvokeApi": { \
20+
"ApiId": "abcd1234", \
21+
"Stage": "prod" \
22+
} \
23+
} \
24+
]'
25+
26+
Output::
27+
28+
{
29+
"Actions": [
30+
{
31+
"InvokeApi": {
32+
"ApiId": "abcd1234",
33+
"Stage": "prod",
34+
"StripBasePath": false
35+
}
36+
}
37+
],
38+
"Conditions": [
39+
{
40+
"MatchBasePaths": {
41+
"AnyOf": [
42+
"PetStoreShopper"
43+
]
44+
}
45+
}
46+
],
47+
"Priority": 150,
48+
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
49+
"RoutingRuleId": "aaa111"
50+
}
51+
52+
For more information, see `Routing rules to connect API stages to a custom domain name for REST APIs <https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-routing-rules.html>`__ in the *Amazon API Gateway Developer Guide*.

0 commit comments

Comments
 (0)