Documentation
¶
Overview ¶
Package spec holds the operation table generated from the Gyro Public API OpenAPI document (internal/spec/openapi.yaml, synced from moduller/gyro-api/openapi.yaml by scripts/sync-spec.sh).
The table (zz_generated_ops.go) is produced by cmd/gyro-gen. Every operation becomes a CLI command automatically (see internal/cli/generated.go); hand-written commands only add nicer UX on top.
Index ¶
- Constants
- Variables
- func Dangerous(method, opID, action, scope string, hasConfirm bool) bool
- func FirstWord(id string) string
- func Kebab(s string) string
- func Name(in NameInput) (resource []string, action string)
- func Singular(s string) string
- func Verb(opID string) string
- type Field
- type NameInput
- type Op
- type Param
Constants ¶
const APIVersion = "2.24.2"
APIVersion is info.version of the spec this table was generated from.
Variables ¶
var Ops = []Op{}/* 432 elements not displayed */
Ops lists every API operation.
Functions ¶
Types ¶
type Field ¶
type Field struct {
Name string
Type string
Items string
Enum []string
Default string
Required bool
Desc string
DescTR string
}
Field is one top-level property of a JSON request body.
type NameInput ¶
type NameInput struct {
Method, Path, OpID string
ListResp bool // data is an array
HasGet bool // a GET exists on the same path
HasOtherMethods bool // PUT/PATCH/DELETE exist on the same path
HasChildParam bool // a path "<this>/{param}" exists (so this path is a collection)
TrailingEnum bool // last path parameter has an enum (one command per value)
}
NameInput describes an operation and its neighbourhood in the spec.
type Op ¶
type Op struct {
ID string
Method string
Path string
Tag string
Summary string
SummaryTR string
Desc string
DescTR string
Scope string // x-scope (cloud_read, cloud_order, ...)
Params []Param
Body []Field
HasBody bool
BodyRequired bool
ListResponse bool // data is an array (or data.<ItemsKey> is)
ItemsKey string // "items" when the list is wrapped: {"data": {"items": [...], "quota_gb": 5}}
Paginated bool // has a page query parameter
Columns []string // default table columns (response item properties, spec order)
Command []string // e.g. ["server", "snapshot", "list"]; derived by Name() unless x-cli.command is set
Confirm bool // destructive or money: ask before running
Money bool // spends money (dry-run gives a quote when the body supports it)
Hidden bool // x-cli.hidden
}
Op is one API operation plus the CLI command derived from it.
func (*Op) PathParams ¶
PathParams returns the path parameters in URL order.
type Param ¶
type Param struct {
Name string
In string // path | query | header
Type string // string | integer | number | boolean | array | object
Items string // element type for arrays
Enum []string
Default string
Required bool
Desc string
DescTR string
}
Param is a path, query or header parameter.