Skip to main content

Get

Show one method of a behavior: its fields, constraints, output and examples.

Each input field is a flag of its command and a field of its request. --json has the JSON Schema of the input and the output, with each constraint that osapi checks before it queues the job.

osapi dsl behavior method get [flags]

Examples​

osapi dsl behavior method get --name sysctl --method update
osapi dsl behavior method get --name sysctl --method update --json

Result​

The command prints:

$ osapi dsl behavior method get --name sysctl --method update
Method:
  Name:         update
  Verb:         write
  Description:  Set a kernel parameter, manage it, and apply it
  HTTP:         PUT
  Route:        /api/node/{hostname}/sysctl/{key}
  Permission:   sysctl:write
  Command:      osapi client node sysctl update
  Input type:   UpdateInput
  Output type:  MutationResult

Input (2):
  FIELD  TYPE    REQUIRED  CONSTRAINTS                                         DESCRIPTION
  key    string  yes       pattern ^[a-zA-Z0-9][a-zA-Z0-9._-]*$, min length 1  Parameter name, such as net.ipv4.ip_forward
  value  string  yes       pattern ^[^\r\n]*$                                  Value to set

Output (2):
  FIELD    TYPE     DESCRIPTION
  key      string   Parameter name
  changed  boolean  Whether the host changed

Examples (1):
  EXAMPLE           INPUT                        OUTPUT
  Lower swappiness  key=vm.swappiness, value=10  key=vm.swappiness, changed=true

With --json, the command prints:

{
"name": "update",
"verb": "write",
"doc": "Set a kernel parameter, manage it, and apply it",
"http_method": "PUT",
"route": "/api/node/{hostname}/sysctl/{key}",
"permission": "sysctl:write",
"command": "osapi client node sysctl update",
"input_type": "UpdateInput",
"output_type": "MutationResult",
"fields": [
{
"field": "key",
"type": "string",
"required": true,
"constraints": "pattern ^[a-zA-Z0-9][a-zA-Z0-9._-]*$, min length 1",
"description": "Parameter name, such as net.ipv4.ip_forward"
},
{
"field": "value",
"type": "string",
"required": true,
"constraints": "pattern ^[^\\r\\n]*$",
"description": "Value to set"
}
],
"results": [
{
"field": "key",
"type": "string",
"description": "Parameter name"
},
{
"field": "changed",
"type": "boolean",
"description": "Whether the host changed"
}
],
"example_rows": [
{
"example": "Lower swappiness",
"input": "key=vm.swappiness, value=10",
"output": "key=vm.swappiness, changed=true"
}
],
"input": null,
"output": null
}

Flags​

FlagDescriptionDefault
--methodThe method, from osapi dsl behavior get (required)
--nameThe behavior, from osapi dsl behavior list (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.