Run gohan -h
to list available commands
NAME:
gohan - Gohan
USAGE:
gohan [global options] command [command options] [arguments...]
VERSION:
0.0.0
COMMANDS:
validate, v Validate Json Schema file
init-db, id Init DB
convert, conv Convert DB
server, srv Run API Server
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--version, -v print the version
--help, -h show help
NAME:
validate - Validate Json Schema file
USAGE:
command validate [command options] [arguments...]
DESCRIPTION:
OPTIONS:
--schema, -s '../schema/core.json' Json schema path
--json, -i '../example/example.json' json path
NAME:
template - Convert gohan schema using pongo2 template
USAGE:
command template [command options] [arguments...]
DESCRIPTION:
Convert gohan schema using pongo2 template
OPTIONS:
--config-file "gohan.yaml" Server config File
--template, -t Template File
NAME:
openapi - Convert gohan schema to OpenAPI
USAGE:
command openapi [command options] [arguments...]
DESCRIPTION:
Convert gohan schema to OpenAPI
OPTIONS:
--config-file "gohan.yaml" Server config File
--template, -t "embed://etc/templates/openapi.tmpl" Template File
NAME:
markdown - Convert gohan schema using pongo2 template
USAGE:
command markdown [command options] [arguments...]
DESCRIPTION:
Convert gohan schema using pongo2 template
OPTIONS:
--config-file "gohan.yaml" Server config File
--template, -t "embed://etc/templates/markdown.tmpl" Template File
You can use gohan client command to connect to gohan.
Gohan client will show quick help for sub command for current server schema.
Gohan CLI Client is configured though environment variables. Configuration can be divided into few sections.
You can use default configuraion for client with:
source ./etc/gohan_client.rc
To configure keystone access for Gohan Client CLI, only few options should be set (they are compatible with those from rackspace/gophercloud:
OS_AUTH_URL
- keystone urlOS_USERNAME
- keystone usernameOS_PASSWORD
- keystone passwordOS_TENANT_NAME
orOS_TENANT_ID
- keystone tenant name or idOS_DOMAIN_NAME
orOS_DOMAIN_ID
- keystone domain name or id (for keystone v3 only)OS_TOKEN_ID
- token ID used to authenticate requests
Gohan enpoint url can be specified directly or Gohan Client can get it from configured keystone.
To specify endpoint directly, just set GOHAN_ENDPOINT_URL
to proper url.
When using keystone:
GOHAN_SERVICE_NAME
- Gohan service name in keystoneGOHAN_REGION
- Gohan region name in keystone
Note: setting all above options will result in using GOHAN_ENDPOINT_URL
!
Gohan CLI Client is fetching available schemas from Gohan endpoint and can cache them in temp file for performance:
GOHAN_SCHEMA_URL
- Gohan schema urlGOHAN_CACHE_SCHEMAS
- should cache schemas (default - true)GOHAN_CACHE_TIMEOUT
- how long cache is valid, uses 1h20m10s format (default - 5m)GOHAN_CACHE_PATH
- where to store cache schemas (default -/tmp/.cached_gohan_schemas
)
Usage can be briefly described with:
gohan client schema_id command [arguments...] [resource_identifier]
Each part of above command is described below.
schema_id
determines which resource type we want to manage.
If used schema_id
is not defined in Gohan, Gohan CLI Client will return Command not found
error.
Commands are identical for each resources:
list
- List all resourcesshow
- Show resource detailscreate
- Create resourceset
- Update existing resourcedelete
- Delete resource
Arguments should be specified in --name value
format.
Passing JSON null value: --name "<null>"
Passing JSON not null value: --name '{"name": [{"name": "value"}, {"name": "value"}]}'
Common arguments
In addition to resource related commands, some formatting commands are available:
--output-format [json/table]
- specifies in which format results should be shown. Can also be specified withGOHAN_OUTPUT_FORMAT
environment variable.json
, e.g:{ "name": "Resource name", "description": "Resource very long and meaningful description", "some_list": [ "list_element_1", "list_element_2" ] }
table
, e.g:+-------------+--------------------------------------+ | FIELD | TYPE | +-------------+--------------------------------------+ | name | Resource name | | description | Resource description | | some_list | ["list_element_1", "list_element_2"] | +-------------+--------------------------------------+
--verbosity [0-3]
- specifies how much information Gohan Client should show - handy for dubugging. Can also be specified withGOHAN_VERBOSITY
environment variable.0
- no additional debug information is shown1
- Sent request url and method is shown2
- same as level1
+ request & response body3
- same as level2
+ used auth token
Some commands (show, set, delete
) are executed on one resource only. To identify whis reource,
it's name or id could be used:
gohan client network show network-id
gohan client network show "Network Name"
gohan client subnet create --network "Network Name"
gohan client subnet create --network network-id
gohan client subnet create --network_id network-id