Skip to content

New CLI examples for API Gateway #9544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions awscli/examples/apigatewayv2/create-routing-rule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
**To create a routing rule**

The following ``create-routing-rule`` example creates a routing rule with a priority of ``50``. ::

aws apigatewayv2 create-routing-rule \
--domain-name 'regional.example.com' \
--priority 50 \
--conditions '[ \
{ \
"MatchBasePaths": { \
"AnyOf": [ \
"PetStoreShopper" \
] \
} \
} \
]' \
--actions '[ \
{ \
"InvokeApi": { \
"ApiId": "abcd1234", \
"Stage": "prod" \
} \
} \
]'

Output::

{
"Actions": [
{
"InvokeApi": {
"ApiId": "abcd1234",
"Stage": "prod",
"StripBasePath": false
}
}
],
"Conditions": [
{
"MatchBasePaths": {
"AnyOf": [
"PetStoreShopper"
]
}
}
],
"Priority": 50,
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
"RoutingRuleId": "aaa111"
}

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*.
11 changes: 11 additions & 0 deletions awscli/examples/apigatewayv2/delete-routing-rule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**To delete a routing rule**

The following ``delete-routing-rule`` example deletes a routing rule for a custom domain name. ::

aws apigatewayv2 delete-routing-rule \
--domain-name 'regional.example.com' \
--routing-rule-id aaa111

This command produces no output.

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*.
35 changes: 35 additions & 0 deletions awscli/examples/apigatewayv2/get-routing-rule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
**To get a routing rule**

The following ``get-routing-rule`` example gets a routing rule for a domain name. ::

aws apigatewayv2 get-routing-rule \
--domain-name 'regional.example.com' \
--routing-rule-id aaa111

Output::

{
"Actions": [
{
"InvokeApi": {
"ApiId": "abcd1234",
"Stage": "prod",
"StripBasePath": false
}
}
],
"Conditions": [
{
"MatchBasePaths": {
"AnyOf": [
"PetStoreShopper"
]
}
}
],
"Priority": 50,
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
"RoutingRuleId": "aaa111"
}

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*.
38 changes: 38 additions & 0 deletions awscli/examples/apigatewayv2/list-routing-rules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
**To list routing rules**

The following ``list-routing-rules`` example lists the routing rules for a domain name. ::

aws apigatewayv2 list-routing-rules \
--domain-name 'regional.example.com'

Output::

{
"RoutingRules": [
{
"Actions": [
{
"InvokeApi": {
"ApiId": "abcd1234",
"Stage": "prod",
"StripBasePath": false
}
}
],
"Conditions": [
{
"MatchBasePaths": {
"AnyOf": [
"PetStoreShopper"
]
}
}
],
"Priority": 150,
"RoutingRuleArn": "arn:aws:apigateway:us-east-1:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
"RoutingRuleId": "aaa111"
}
]
}

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*.
52 changes: 52 additions & 0 deletions awscli/examples/apigatewayv2/put-routing-rule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
**To update a routing rule**

The following ``put-routing-rule`` example updates the priority of a routing rule. ::

aws apigatewayv2 put-routing-rule \
--domain-name 'regional.example.com' \
--priority 150 \
--conditions '[ \
{ \
"MatchBasePaths": { \
"AnyOf": [ \
"PetStoreShopper" \
] \
} \
} \
]' \
--actions '[ \
{ \
"InvokeApi": { \
"ApiId": "abcd1234", \
"Stage": "prod" \
} \
} \
]'

Output::

{
"Actions": [
{
"InvokeApi": {
"ApiId": "abcd1234",
"Stage": "prod",
"StripBasePath": false
}
}
],
"Conditions": [
{
"MatchBasePaths": {
"AnyOf": [
"PetStoreShopper"
]
}
}
],
"Priority": 150,
"RoutingRuleArn": "arn:aws:apigateway:us-east-2:123456789012:/domainnames/regional.example.com/routingrules/aaa111",
"RoutingRuleId": "aaa111"
}

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*.