CLI tool for your Amrayn account
• • •
• • •
Installation
npm -g i amrayn-cli
yarn global add amrayn-cli
Usage
amrayn <command> [parameters]
Commands
Details
login
Log in to your amrayn account.
Notes:
- You must have
login.cli
signature. - If you want to log out of all the CLI sessions at once, simply delete this signature.
- You can disable CLI logins by not having
login.cli
signature - Non permanent logins expire in 24 hours (AEST)
- Refresh tokens are valid for 30 days and renewed every time
refresh-login
is run.
Optional parameters:
--email <email address>
--permanent
– Permanently login that does not require refresh token.--ssh-key
– SSH private key to log in without password--passphrase
– Ask for passphrase for encrypted private key (only applicable when --ssh-key
option provided)--signature <signature>
– Use custom signature name instead of login.cli
. The signature must be enabled for CLI authentication. You can enable it from settings page. Once you have logged in, changing the CLI authentication status will not revoke the tokens. You will need to deactivate the signature to disable the logged in sessions.
rlogin
Refreshes the non-permanent session. The request must be made within 30 days of login
or last rlogin
commands. If the refresh token is expired or login.cli
signature is revoked, you will need to re-login
Optional parameters:
--passphrase
– Ask for passphrase for encrypted private key (only applicable when the original login was using encrypted SSH key, i.e, via --ssh-key
option)
logout
Log out of your amrayn account.
whoami
Print currently logged in user information.
Optional parameters:
--raw
– Print just logged in email address.
test
Tests connection for current project
Optional parameters:
--details
– Print details if connection fails
logs
Stream or download the logs from your function box
Optional parameters:
--tail <number>
- Number of lines to start with--notail
- Do not request any lines to start with (Similar to --tail 0
)--download <filename>
- Save the file instead of streaming to the specified file--verbose
create-project
Create a project
Optional parameters:
--token <token>
--name <project name>
--domain <primary domain>
--username <project username>
init
Initializes a project and create relevant directories.
Optional parameters:
--project-id <project ID>
--services <[Hosting,Functions,...]>
--site-source <source directory>
--site-target <site target>
--site-name <site name>
create-function
Initialize function from one of the available templates.
Alias for this command is create-fn
Optional parameters:
--template <template name>
--name <function name>
--description <description>
--trigger <trigger name>
--trigger-value <trigger value>
create-site
Create new hosting site
Optional parameters:
--token <token>
--name <site name>
--target <site target>
connect-domain
Connect new domain to the specified site. The site must already exist. See create-site
command.
Optional parameters:
--token <token>
--site-name <Site name>
--domain <FQDN>
deploy-site
Deploys the site
Optional parameters:
--token <token>
--message <message>
--verbose
If you want to ignore a file, you can use hosting.ignore
array in wetsand.json
or create .wetsandignore
file with glob pattern per line.
deploy-function
Deploys single function from wetsand.json
Alias for this command is deploy-fn
Required parameters:
Optional parameters:
--token <token>
--message <message>
--version <new version>
--verbose
If you want to ignore a file, you can use functions.list[*].ignore
array in wetsand.json
or create .wetsandignore
file with glob pattern per line.
deploy-db
Deployes single data table from wetsand.json
Required parameters:
Optional parameters:
--token <token>
--verbose
--create-new
--confirm-data-loss
create-db
Creates new data table and add it to wetsand.json
Optional parameters:
--token <token>
--name <Data table name>
--title <Data table title>
--public-access
--schema-file <json file>
--ui-schema-file <json file>
--options-file <json file>
--verbose
--confirm-data-loss
upload-media
Upload media files
Required parameters:
--file <media file path> --file <more>
Optional parameters:
--token <token>
--verbose
--variants 150,64
- Create variants of specified sizes--dir <dir path>
- Subdirectory to upload to--keep-names
- Keep original file names instead of random generated names--skip-cdn
- Do not save the file/s to CDN (if CDN is enabled on the account)
delete-media
Delete single media file (and their respective variants if available)
Required parameters:
Optional parameters:
Config
Although you shouldn't worry about config file structure because this CLI will take care of it, nevertheless, some people are interested in how it is structured.
{
"projectId": "<project_id>",
"hosting": {
"target": "<target>",
"name": "<definitive name>",
"source": "build",
"ignore": [
"README.md"
]
},
"functions": {
"source": "functions",
"list": [
{
"name": "<public name of function>",
"module": "<module name in source>",
"trigger": "HTTP|HTTP_WITH_AUTH|HTTP_WITH_SCOPED_AUTH|SCHEDULE",
"triggerValue": "GET|POST|PUT|DELETE|ANY|<cron expression>",
"timeout": <timeout in seconds (<=30)>,
"overwrite": true|false,
"alwaysUseLatest": true|false,
"group": 1,
"ignore": [
"README.md",
"docs/*.md"
]
}
]
},
"dataTables": [
{
"name": "weekly_programs",
"title": "Weekly Programs",
"publicAccess": true,
"icon": "CalendarAlt",
"schemaFile": "db/weekly.schema.json",
"uiSchemaFile": "db/weekly.uischema.json",
"optionsFile": "db/weekly.options.json"
}
]
}
License
Copyright (c) 2020-present Amrayn Web Services
Copyright (c) 2020-present @abumusamq
https://amrayn.com
https://github.com/amrayn/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.