Resources can be created directly from files on disk through shell redirects like shown below. Using the file listener-catalog.json with the following content:
To list available commands run with the global help flag, greymatter create --help:
$ greymatter create --help
NAME
create - create an object within the Grey Matter API
USAGE
greymatter [GLOBAL OPTIONS] create [OPTIONS] <object type>
VERSION
v1.2.1
DESCRIPTION
object type is one of: zone, proxy, listener, domain, route, shared_rules, cluster
Editor Selection
When changes need to be made an initial version of the object can be presented in an
editor. The command used to launch the editor is taken from the EDITOR environment
variable and must block execution until the changes are saved and the editor is
closed. The current editor command is 'vim'.
Example EDITOR values:
vim
emacs
atom -w
Using STDIN
For scripting purposes it may be useful to use STDIN to provide the created object
instead of using an interactive editor. If so, simply make the new version available
on STDIN through standard use of pipes.
Example: cat "new_cluster.json" | greymatter create cluster
GLOBAL OPTIONS
--api.header=header
Specifies a custom header to send with every API request. Headers are given as
name:value pairs. Leading and trailing whitespace will be stripped from the
name and value. For multiple headers, this flag may be repeated or multiple
headers can be delimited with commas.
--api.host=host:port
(default: localhost:80)
The address (host:port) for API requests. If no port is given, it defaults to
port 443 if --api.ssl is true and port 80 otherwise.
--api.insecure
(default: false)
If true, don't validate server cert when using SSL for API requests
--api.key=string
(default: "none")
[SENSITIVE] The auth key for API requests
--api.prefix=value
The url prefix for API requests. Forms the path part of <host>:<port><path>
--api.ssl
(default: true)
If true, use SSL for API requests
--api.sslCert=value
Specifies the SSL cert to use for every API request.
--api.sslKey=value
Specifies the SSL key to use for every API request.
--console.level=level
(default: "info")
(valid values: "debug", "info", "error", or "none")
Selects the log level for console logs messages.
--format=string
(default: "json")
The I/O format (json or yaml)
--help (default: false)
Show a list of commands or help for one command
--version
(default: false)
Print the version and exit
Global options can also be configured via upper-case, underscore-delimited environment
variables prefixed with "GREYMATTER_". For example, "--some-flag" becomes
"GREYMATTER_SOME_FLAG". Command-line flags take precedence over environment variables.
OPTIONS
--help (default: false)
Show a list of commands or help for one command
--version
(default: false)
Print the version and exit
Options can also be configured via upper-case, underscore-delimited environment
variables prefixed with "GREYMATTER_CREATE_". For example, "--some-flag" becomes
"GREYMATTER_CREATE_SOME_FLAG". Command-line flags take precedence over environment
variables.