@gapi/gcli
v1.8.151
Published
```bash curl -L "https://github.com/Stradivario/gapi/raw/master/packages/gcli/release/gcli-linux" -o ~/.local/bin/gcli ```
Downloads
9
Readme
Installation
curl -L "https://github.com/Stradivario/gapi/raw/master/packages/gcli/release/gcli-linux" -o ~/.local/bin/gcli
chmod +x ~/.local/bin/gcli
Using NPM
npm i -g @gapi/gcli
Login
gcli login --token 'GRAPHQL_TOKEN' --key 'GOOGLE_API_KEY' --url 'URL' --uploadUrl 'UPLOAD_URL'
List Projects
gcli project:list
use existing project
gcli use 'PROJECT_ID'
List Lambdas for project
gcli lambda:list
or
gcli lambda:list --project 'PROJECT_ID'
Get Lambda
gcli lambda:get --lambda 'LAMBDA_ID'
By name
gcli lambda:get --name 'MY_LAMBDA_NAME'
Create Lambda
gcli lambda:create --name pesho --route pesho --code 'module.exports = async (context) => ({ status: 200, body: "Hello, world!", headers: { "Access-Control-Allow-Origin": "https://graphql-server.com"}})'
Or from files
gcli lambda:create --name pesho --route pesho --file ./index.ts --script ./bash.sh --package ./package.json
Or from spec
gcli lambda:create --spec spec.json
If spec
already present
gcli lambda:create
example spec.json
{
"name": "pesho",
"route": "pesho",
"file": "index.ts",
"script": "bash.sh",
"package": "package.json",
"params": ["test", "proba"],
"config": "",
"secret": "",
"env": "NODEJS",
"method": "GET"
}
Updating Lambda
gcli lambda:update
Delete Lambda
gcli lambda:delete
Get Lambda
gcli lambda:get
Testing lambda
gcli lambda:test --queryParams '?test=1&proba=1&dada=5' --pathParams 'proba=5;test=7'
Default long lived token for CI/CD using github actions
Can be set using secret variable called GCLI_AUTH_TOKEN
npx gcli login --ci --token ${{ secrets.GCLI_AUTH_TOKEN }} --key '' --url '' --uploadUrl ''