Documentation
¶
Overview ¶
Package sdk is the sdk group: osapi sdk list, get, spec get and validate, which describe and check the Go SDK in this binary, as each DSL's group does and as osapi agent collector does for gohai's collectors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Group = command.Register(command.Define( "sdk", "List, describe and check the Go SDK in this binary: its types and its services", command.Uses[Deps](), command.SubDoc("spec", "Print the parts of the Go SDK"), command.Method[ListInput, ListOutput]("list"). Short("List the types for values and the services of the client"). Example(""). Prints(sampleList). Example("--json"). Handle(List), command.Method[GetInput, GetOutput]("get"). Short("Show a type with its values, or a service with its methods"). Long("A name of a type, such as ContentType, shows its doc and its values. A\n"+ "name of a service, such as Hostname, shows each method with the permission\n"+ "that it needs, its route, its input and its result."). Example("--name Hostname"). Prints(sampleGet). Example("--name ContentType --json"). Fails("no name", GetInput{}). Handle(Get), command.Method[SpecInput, SpecOutput]("get"). Sub("spec"). Short("Print the Go SDK: its packages, how a call works, its types and its services"). Long("The list comes from this binary, from types.All and client.Services. Thus it\n"+ "agrees with the build that you run. The SDK skill is made from it."). Example(""). Prints(sampleSpec). Example("--json"). Handle(Spec), command.Method[ValidateInput, ValidateOutput]("validate"). Short("Check the SDK against its rules"). Long("It prints each problem with its name, rule and message, then the fix of each\n"+ "rule, and exits 1 when a rule fails.\n\n"+ "The rules:\n\n"+sdkspec.Checks.Help()). Example(""). Prints(sampleValidate). Example("--json"). Handle(Validate), ))
Group is the sdk group's definition.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
// Types are the types for values, types.All in the binary.
Types func() []types.TypeSpec
// Services are the services of the client, client.Services in the binary.
Services func() []client.ServiceSpec
}
Deps is what the sdk commands read: the SDK's description of itself.
type GetInput ¶
type GetInput struct {
Name string `json:"name" validate:"required" doc:"A type, such as ContentType, or a service, such as Hostname"`
}
GetInput names a type or a service.
type GetOutput ¶
type GetOutput struct {
Type *types.TypeSpec ` json:"type,omitempty"`
Service *client.ServiceSpec ` json:"service,omitempty"`
// contains filtered or unexported fields
}
GetOutput is the type or the service of the name.
type Item ¶
type Item struct {
Kind Kind `json:"kind"`
Name string `json:"name"`
Count int `json:"count" doc:"The values of a type, or the methods of a service"`
Doc string `json:"doc" render:"short=60"`
}
Item is one row of list.
type Kind ¶
type Kind string
Kind is what a row of list is: a type or a service.
type ListOutput ¶
type ListOutput struct {
Items []Item ` json:"items"`
// contains filtered or unexported fields
}
ListOutput is each type for values, then each service.
type SpecOutput ¶
SpecOutput is each kind of term of the SDK, with its terms.
type ValidateInput ¶
type ValidateInput struct{}
ValidateInput is the input of validate, which has none.
type ValidateOutput ¶
type ValidateOutput struct {
Types int ` json:"types"`
Services int ` json:"services"`
Valid bool ` json:"valid"`
Problems []sdkspec.Problem ` json:"problems,omitempty"`
Fixes map[string]any ` json:"fixes,omitempty"`
// contains filtered or unexported fields
}
ValidateOutput is each problem of the SDK, and the fix of each rule that one breaks.
func Validate ¶
func Validate( _ context.Context, d Deps, _ ValidateInput, ) (ValidateOutput, error)
Validate is each problem of the SDK against sdkspec.Checks.