Skip to content
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

Add option to test without using IAM credentials #12

Open
wants to merge 1 commit into
base: master
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ This command takes the following options:

- `api-gateway-region`
The API Gateway region. Defaults to `us-east-1`.

- `api-key`
The API key if required by the method. Defaults to none.

Expand All @@ -92,6 +92,9 @@ This command takes the following options:
- `body`
The request body as a JSON string. Defaults to `'{}'`.

- `anonymous`
Perform action anonymously, without IAM credentials.

For additional documentation on the format for `params` and `additional-params`; refer to the generic [API Gateway Client][apiGClient] docs.

### Local Development
Expand Down
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ var argv = require("yargs")
describe: "API request additional params",
default: "{}"
})
.option("anonymous", {
describe: "Perform action without IAM credentials",
demandOption: false
})
.option("body", {
describe: "API request body",
default: "{}"
Expand Down Expand Up @@ -195,6 +199,10 @@ function makeRequest(userTokens) {
});
}

authenticate(function(tokens) {
getCredentials(tokens, makeRequest);
});
if (argv.anonymous) {
makeRequest(null)
} else {
authenticate(function(tokens) {
getCredentials(tokens, makeRequest);
});
}