Documentation
¶
Overview ¶
Package catalog is the catalog endpoint group: what the UI reads from the controller after sign-in. The behaviors with their methods, the areas, the permissions and the roles, the permission of each operation, the tones of the statuses and the counts, and the host families. The controller builds it from its registries on each request, so a page shows each behavior that the controller has, and nobody edits the UI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Group = endpoint.Register(endpoint.Define( "catalog", "The catalog of what the controller serves", endpoint.Area(area.Fleet), endpoint.Title("Catalog API"), endpoint.Tag("catalog", "Catalog", "The behaviors, the permissions and the roles that the controller serves, for the UI."), endpoint.Uses[Deps](), endpoint.Doc[types.Permission]("A permission that osapi knows, as resource:verb."), endpoint.Doc[OperationID]("An operationId of an operation that needs a permission."), endpoint.Doc[types.MethodKind]( "What a method does to a host, by the verb of its permission: read, write or action.", ), endpoint.Get[GetInput, Response]("get"). Handle(Get). ID("GetCatalog"). Describe("Get the catalog"). Explain("Returns each behavior with its methods, the areas, the permissions, "+ "the built-in roles, the permission of each operation, the tones of the "+ "statuses and the counts, and the host families. The UI reads it after "+ "sign-in. Each built-in role has catalog:read."). Returns("The catalog."). Command("Get the catalog of the controller", "The catalog is what the UI reads after sign-in: each behavior with its\n"+ "methods, the areas, the permissions, the built-in roles, the permission\n"+ "of each operation, the tones of the statuses and the counts, and the\n"+ "host families. The controller builds it from its registries."). Notes("The table leaves out the permissions, the tones and the doc of each\n"+ "behavior, and the permissions of each role. --json prints the whole\n"+ "catalog, with the methods of each behavior. osapi controller role get\n"+ "--name <role> shows the permissions of a role."). Example(""). Prints(sampleCatalog). Example("--json"), ))
Group is the catalog group's definition. The routes, the spec, the CLI commands and their pages come from it. osapi dsl endpoint spec get lists every option.
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area struct {
Name string `json:"name" doc:"The name of the area." example:"networking"`
Label string `json:"label" doc:"The label of the area." example:"Networking"`
// contains filtered or unexported fields
}
Area is one area: a section of the Behaviors page.
type Behavior ¶
type Behavior struct {
Name string `json:"name" doc:"The name of the behavior." example:"dns"`
Title string `json:"title" doc:"The title of the behavior." example:"DNS"`
Area string `json:"area" doc:"The area of the behavior, or empty for an internal behavior." example:"networking"`
Doc string `` /* 126-byte string literal not displayed */
Internal bool `json:"internal" doc:"Only other behaviors call it: it has no route."`
Parent string `json:"parent,omitempty" doc:"The behavior that the behavior is under, such as user for sshkey."`
Platforms []string `json:"platforms" doc:"The platforms of the providers of the behavior."`
Uses []string `json:"uses" doc:"The behaviors that the behavior calls."`
UsedBy []string `json:"used_by" doc:"The behaviors that call the behavior."`
Chain string `json:"chain" doc:"The chain of the behavior, as osapi dsl chain list prints it."`
Methods []Method `json:"methods" doc:"The methods of the behavior."`
// contains filtered or unexported fields
}
Behavior is one behavior, as the UI shows it. An internal behavior is in the catalog so a chain can name it, but it has no route: only another behavior calls it.
type Call ¶
type Call struct {
Behavior string `json:"behavior" doc:"The behavior that is called." example:"package"`
Method string `json:"method" doc:"The method that is called." example:"get"`
Calls []Call `json:"calls,omitempty" doc:"The calls that the call makes."`
// contains filtered or unexported fields
}
Call is one call that a method makes to another behavior, with the calls that it makes in turn, as the examples of the method record them.
type Column ¶
type Column struct {
Name string `json:"name" doc:"The json name of the field." example:"total"`
Label string `json:"label" doc:"The label of the field." example:"Total"`
Doc string `json:"doc" doc:"What the field is."`
Render string `json:"render,omitempty" doc:"The render tag of the field, such as bytes." example:"bytes"`
Kind types.ColumnKind `json:"kind" doc:"What the field holds: value, values, object or list." example:"value" validate:"enum"`
Columns []Column `json:"columns,omitempty" doc:"The columns of an object, or of a list of objects."`
// contains filtered or unexported fields
}
Column is one field of the rows that a method answers, as the CLI's output shows it: its label, and its render tag, such as bytes. A field that holds an object or a list of objects has the columns of the object, so the UI shows it as the CLI does, with no card of its own.
type ControllerMethod ¶
type ControllerMethod struct {
Group string `json:"group" doc:"The endpoint group." example:"file"`
Method string `json:"method" doc:"The method." example:"list"`
Doc string `json:"doc" doc:"What the method does, in one line."`
Operation OperationID `json:"operation" doc:"The operationId that the method calls."`
Permission types.Permission `json:"permission" doc:"The permission that it needs."`
// contains filtered or unexported fields
}
ControllerMethod is a method of an endpoint group of the controller.
type Deps ¶
type Deps struct{}
Deps is what the group's handlers use, such as the job client. Give each one as an interface, so a test can fake it. While it is empty, the controller needs no wiring; once it has a field, give it in internal/controller/handlers.go, as agentDeps does.
type Example ¶
type Example struct {
Doc string `json:"doc" doc:"What the example does."`
Input any `json:"input" doc:"The input of the example."`
Output any `json:"output,omitempty" doc:"The output of the example."`
// contains filtered or unexported fields
}
Example is one example of a method: what it does, its input and its output. A secret of an input is [redacted].
type Field ¶
type Field struct {
Name string `` /* 132-byte string literal not displayed */
In types.FieldIn `` /* 148-byte string literal not displayed */
Kind types.FieldKind `` /* 148-byte string literal not displayed */
Required bool `json:"required" doc:"The request needs the field."`
Doc string `json:"doc" doc:"What the field is."`
Options []string `json:"options,omitempty" doc:"The values that the field takes: those of its type with enum, or of its oneof rule."`
Secret bool `json:"secret,omitempty" doc:"The field is a secret."`
// contains filtered or unexported fields
}
Field is one input field of a method: a field of the form of a step.
type Method ¶
type Method struct {
Name string `` /* 180-byte string literal not displayed */
Kind types.MethodKind `` /* 179-byte string literal not displayed */
Doc string `json:"doc" doc:"What the method does."`
Long string `json:"long,omitempty" doc:"The rest of what the method does."`
HTTPMethod string `` /* 177-byte string literal not displayed */
Path string `json:"path,omitempty" doc:"The path of the route."`
Permission types.Permission `json:"permission,omitempty" doc:"The permission of the method. An internal behavior has none."`
Platforms []string `` /* 141-byte string literal not displayed */
RunsOn []string `` /* 163-byte string literal not displayed */
Input string `json:"input" doc:"The input type and its fields, a required one marked *."`
Output string `json:"output" doc:"The output type and its fields."`
Fields []Field `json:"fields" doc:"The fields of the input."`
Columns []Column `json:"columns" doc:"The fields of the rows that the method answers, as the CLI's output reads them."`
Calls []Call `json:"calls" doc:"The calls that the examples of the method make to other behaviors."`
Examples []Example `json:"examples" doc:"The examples of the method."`
Disruptive bool `json:"disruptive,omitempty" doc:"The method can interrupt a host, such as a reboot."`
Disruption string `json:"disruption,omitempty" doc:"What the method interrupts."`
// contains filtered or unexported fields
}
Method is one method of a behavior, as the UI shows and runs it.
type Operation ¶
type Operation struct {
ID OperationID `json:"id" doc:"The operationId."`
Permission types.Permission `json:"permission" doc:"The permission that the operation needs."`
// contains filtered or unexported fields
}
Operation is the permission of one operation.
type OperationID ¶
type OperationID string
OperationID is the operationId of an operation of the API, such as GetAgents. Its schema is an enum of each operation that needs a permission.
func (OperationID) Valid ¶
func (id OperationID) Valid() bool
Valid reports whether id is an operation that needs a permission.
func (OperationID) Values ¶
func (OperationID) Values() []OperationID
Values are each operation that needs a permission, in order.
type Response ¶
type Response struct {
Behaviors []Behavior `` /* 160-byte string literal not displayed */
Areas []Area ` json:"areas" doc:"Each area, in order, with its label."`
Permissions []types.Permission `` /* 184-byte string literal not displayed */
Roles []Role `` /* 127-byte string literal not displayed */
Operations []Operation `` /* 150-byte string literal not displayed */
StatusTones map[string]string `` /* 184-byte string literal not displayed */
CountTones map[string]string `` /* 184-byte string literal not displayed */
HostFamilies []string `` /* 150-byte string literal not displayed */
Targets []Target `` /* 128-byte string literal not displayed */
Controller []ControllerMethod `` /* 173-byte string literal not displayed */
RenderTags []string `` /* 167-byte string literal not displayed */
Outcomes []string `` /* 153-byte string literal not displayed */
// contains filtered or unexported fields
}
Response is what the UI reads from the controller after sign-in: the behaviors, the areas, the permissions and the roles, the permission of each operation, the tones of the statuses and the counts, and the host families.
type Role ¶
type Role struct {
Name types.Role `json:"name" doc:"The name of the role, as a token names it." example:"operator"`
Description string `json:"description" doc:"Who the role is for."`
Permissions []types.Permission `json:"permissions" doc:"The permissions of the role." table:"-"`
// contains filtered or unexported fields
}
Role is one built-in role.
type Runs ¶
type Runs func(b *behavior.Behavior) []behaviortest.ChainRun
Runs are the runs of the examples of a behavior, with the calls that each made: behaviortest.Chains.
type Target ¶
type Target struct {
Value string `json:"value" doc:"The target, as a method takes it." example:"_all"`
Label string `json:"label" doc:"Its label." example:"All agents"`
Doc string `json:"doc" doc:"What it sends the job to."`
// contains filtered or unexported fields
}
Target is a target that names no host.