The bare minimum for a chart is a directory in the charts
directory with a manifest.yaml
file. The name of the chart is based on the directory name. The manifest file should have the following structure:
description: "Sample chart using ReqRes API"
environments:
default:
host: https://reqres.in
verify_ssl: true
config:
data1: value1
nested:
data2: value2
config:
data1: value1
nested:
data2: value2
secrets:
- password
description
: some descriptive message for the chartenvironments
: list of environments to submit requests against{name}
: name of the environmenthost
: host for the environmentverify_ssl
: (optional) do ssl verification on the request, true by defaultconfig
: (optional) set of environment-specific values to reference in the chart requests
config
: (optional) set of global values to reference in the chart requestssecrets
: (optional) list of state values that should be masked forstarman space state
and verbose output
Requests are represented as yaml files in the chart directory. The CLI command for the request is based on the filename and any subdirectories. For example, see the following directory tree:
get.yaml
get
└── users.yaml
This will make the requests get
and get users
available.
Request files have the following structure:
method: POST
endpoint: /api/user
description: "Create a new user"
host: "{{ host_override }}"
headers:
Authorization: Bearer {{ auth_token }}
Content-Type: application/json
required:
- key: auth_token
message: Need to provide an authentication token
optional:
- key: leader.name
payload: >
{
"name": "{{ leader.name | default("morpheus", true) }}",
"job": "leader"
}
cleanup:
- user_id
capture:
from_request:
- path: name
dest: name
from_response:
- path: id
dest: user_id
method
: HTTP method for the requestendpoint
: endpoint fordescription
: some description for the API requesthost
: (optional) override value for the host declared in the manifestheaders
: (optional) set of key value pairs for headers that should be set as part of the requestrequired
: (optional) set of variables that must be either set via state or CLI parameterkey
: name of the variablemessage
: (optional) custom message to return if the variable isn't setvalues
: (optional) array of accepted string values for the variable (for enums)
optional
: (optional) set of optional variables that can be set for the requestkey
: name of the variablevalues
: (optional) array of accepted string values for the variable (for enums)
parameters
: (optional) set of request parameters to set in the request URL (e.g. /api/user?key=value)name
: name of the request parametervalue
: (optional) value for the request parameter
payload
: (optional) payload to set in the requestrequired_payload
: (optional) boolean indicating that a payload must be provided via CLI parameterresponse_type
: (optional) enum indicating the expected type of the response object. Normally Starman will guess the type based on response headers, etc. but sometimes it's preferred to explicitly define it. Valid values arejson
,xml
,text
.cleanup
: (optional) list of state values that should be cleared on a successful requestcapture
: (optional) set of values that should be captured and saved to state on a successful requestfrom_request
: (optional) set of values that should be pulled from the request objectpath
: path of the value in the requestdest
: where the value should be saved in state
from_response
: (optional) set of values that should be pulled from the response objectpath
: path of the value in the responsedest
: where the value should be saved in state
from_header
: (optional) set of values that should be pulled from the response headersname
: name of the response headerdest
: where the value should be saved in state
from_config
: (optional) set of values that should be pulled from state / CLI parameterspath
: path of the value in state / CLI parameterdest
: where the value should be saved in state
You'll notice that many of the request yaml fields use a {{ value }}
syntax. That's because the request file object supports templating via Jinja. This allows callers to manipulate the request based on available state values or CLI parameters. The following fields support Jinja templates:
endpoint
headers
{header}
required
key
optional
key
parameters
value
payload
capture
from_request
path
dest
from_response
path
dest
from_config
path
dest
There are also some custom commands included with the templating logic:
increment(key)
: takes the value at keykey
and increments by one (assumes integer value)random_uuid()
: generates a random guiddatetime(format)
: returns the current date using the provided format (format can be omitted)basic_auth(username, password)
: takes values at keysusername
andpassword
and builds a base64-encoded header value