Documentation
¶
Index ¶
- func BindingRequestCoverage(request map[string]any) map[string]bool
- func CanonicalProduct(specDir, requested string) (string, bool)
- func DefaultDir() (string, error)
- func ResetCacheForTest()
- func Validate(spec ResourceSpec) error
- func ValidateProduct(spec ProductSpec) error
- func ValidateSchemaPaths(resources []ResourceSpec) error
- type AbsentRule
- type Binding
- type BindingHooks
- type BindingResponse
- type BindingResponseMatch
- type ConditionalRequirement
- type Conflict
- type Filter
- type HookAPICall
- type Idempotency
- type Identity
- type LocalizedText
- type Operation
- type OperationCall
- type OperationFieldRef
- type OperationFields
- type OperationInput
- type OperationOutput
- type OutputRoot
- type OutputSelect
- type Param
- type Probe
- type ProbeField
- type ProbeResponse
- type ProductSpec
- type Requirement
- type ResourceRef
- type ResourceSchema
- type ResourceSpec
- type SchemaField
- type Transition
- type TransitionRetry
- type Waiter
- type WaiterFailure
- type WaiterMatch
- type WaiterPending
- type WorkflowStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindingRequestCoverage ¶ added in v0.2.1
BindingRequestCoverage returns the set of API request parameter paths that a binding request mapping covers. The result mirrors how the executor consumes the mapping:
- a plain value covers the parameter name itself;
- `each` with `fields` covers Parent.Child paths for every child;
- a bare `each` or `from` covers the group path itself;
- a `raw` node contributes nothing (it is a passthrough escape hatch);
- nested `fields` are flattened recursively.
Callers use this set to compare a binding's request coverage against the OpenAPI metadata parameter list for the bound operation.
func CanonicalProduct ¶ added in v0.2.4
CanonicalProduct resolves a product name or declared product alias to the canonical product name used by specs and machine-readable schemas.
func DefaultDir ¶
func ResetCacheForTest ¶
func ResetCacheForTest()
func Validate ¶
func Validate(spec ResourceSpec) error
func ValidateProduct ¶
func ValidateProduct(spec ProductSpec) error
func ValidateSchemaPaths ¶
func ValidateSchemaPaths(resources []ResourceSpec) error
ValidateSchemaPaths rejects resource layouts whose dotted schema IDs would have two meanings. A nested resource product.parent.resource shares its three-segment shape with a top-level command product.resource.action, so the child resource name must not also be an action on its parent resource.
Types ¶
type AbsentRule ¶
type AbsentRule struct {
WhenEmptyForRequestedIDs bool `yaml:"when_empty_for_requested_ids"`
}
type Binding ¶
type Binding struct {
API string `yaml:"api"`
Each string `yaml:"each"`
Capture any `yaml:"capture"`
Hooks BindingHooks `yaml:"hooks"`
Request map[string]any `yaml:"request"`
Response BindingResponse `yaml:"response"`
RequireAny []Requirement `yaml:"require_any"`
RequireAll []Requirement `yaml:"require_all"`
Idempotency Idempotency `yaml:"idempotency"`
Retry TransitionRetry `yaml:"retry"`
IDFrom string `yaml:"id_from"`
RequestIDFrom string `yaml:"request_id_from"`
ContextFrom map[string]string `yaml:"context_from"`
Wait string `yaml:"wait"`
}
type BindingHooks ¶
type BindingHooks struct {
Before []string `yaml:"before"`
AfterError []string `yaml:"after_error"`
APICalls []HookAPICall `yaml:"api_calls"`
}
type BindingResponse ¶ added in v0.2.0
type BindingResponseMatch ¶ added in v0.2.0
type ConditionalRequirement ¶
type Filter ¶
type Filter struct {
Target string `yaml:"target"`
Type string `yaml:"type"`
KeyPrefix string `yaml:"key_prefix"`
Description LocalizedText `yaml:"description"`
}
type HookAPICall ¶
type HookAPICall struct {
Hook string `yaml:"hook"`
API string `yaml:"api"`
Phase string `yaml:"phase"`
Condition string `yaml:"condition"`
Purpose LocalizedText `yaml:"purpose"`
}
type Idempotency ¶
func OperationIdempotency ¶
func OperationIdempotency(resource ResourceSpec, operation Operation) (Idempotency, bool)
type Identity ¶
type Identity struct {
Field string `yaml:"field"`
Prefix string `yaml:"prefix"`
OutputRoot OutputRoot `yaml:"output_root"`
}
type LocalizedText ¶
func (LocalizedText) String ¶
func (t LocalizedText) String() string
func (LocalizedText) Text ¶
func (t LocalizedText) Text(lang string) string
func (*LocalizedText) UnmarshalYAML ¶
func (t *LocalizedText) UnmarshalYAML(unmarshal func(any) error) error
type Operation ¶
type Operation struct {
Description LocalizedText `yaml:"description"`
Help LocalizedText `yaml:"help"`
Input OperationInput `yaml:"input"`
RequireAny []Requirement `yaml:"require_any"`
RequireWhen []ConditionalRequirement `yaml:"require_when"`
Conflicts []Conflict `yaml:"conflicts"`
Filters map[string]Filter `yaml:"filters"`
Call OperationCall `yaml:"call"`
Workflow []WorkflowStep `yaml:"workflow"`
Emit any `yaml:"emit"`
Output OperationOutput `yaml:"output"`
Examples []string `yaml:"examples"`
Aliases []string `yaml:"aliases"`
}
type OperationCall ¶
type OperationFieldRef ¶
type OperationFieldRef struct {
Name string
Required bool
HasRequired bool
Repeatable bool
HasRepeatable bool
Positional bool
PositionalMany bool
AllowEmpty bool
Brief bool
HasBrief bool
Schema bool
HasSchema bool
FlagName string
InputStyle string
Default any
Enum []string
Description LocalizedText
}
type OperationFields ¶
type OperationFields []OperationFieldRef
func (*OperationFields) UnmarshalYAML ¶
func (fields *OperationFields) UnmarshalYAML(unmarshal func(any) error) error
type OperationInput ¶
type OperationInput struct {
Fields OperationFields `yaml:"fields"`
Controls OperationFields `yaml:"controls"`
}
type OperationOutput ¶
type OperationOutput struct {
Fields map[string]any `yaml:"fields"`
Select []OutputSelect `yaml:"select"`
}
type OutputRoot ¶
type OutputSelect ¶
type OutputSelect struct {
From string `yaml:"from"`
Match string `yaml:"match"`
By []string `yaml:"by"`
Fields []string `yaml:"fields"`
SingleKey string `yaml:"single_key"`
ManyKey string `yaml:"many_key"`
First bool `yaml:"first"`
UseMatchWhenMissing bool `yaml:"use_match_when_missing"`
FallbackToMatch bool `yaml:"-"`
}
type Param ¶
type Param struct {
Type string `yaml:"type"`
Description LocalizedText `yaml:"description"`
Required bool `yaml:"required"`
Repeatable bool `yaml:"repeatable"`
Positional bool `yaml:"positional"`
PositionalMany bool `yaml:"positional_many"`
AllowEmpty bool `yaml:"allow_empty"`
FlagName string `yaml:"-"`
Split string `yaml:"split"`
Use string `yaml:"use"`
Default any `yaml:"default"`
Max *int `yaml:"max"`
Enum []string `yaml:"enum"`
}
type ProbeField ¶
type ProbeField struct {
Path string `yaml:"path"`
From string `yaml:"from"`
Each map[string]ProbeField `yaml:"each"`
Lower string `yaml:"lower"`
First []string `yaml:"first"`
Int string `yaml:"int"`
Port string `yaml:"port"`
DefaultEmptyArray bool `yaml:"default_empty_array"`
}
func (*ProbeField) UnmarshalYAML ¶
func (f *ProbeField) UnmarshalYAML(unmarshal func(any) error) error
type ProbeResponse ¶
type ProbeResponse struct {
Items string `yaml:"items"`
Item string `yaml:"item"`
Total string `yaml:"total"`
NextToken string `yaml:"next_token"`
RequestID string `yaml:"request_id"`
ID string `yaml:"id"`
State string `yaml:"state"`
Normalize map[string]string `yaml:"normalize"`
Fields map[string]ProbeField `yaml:"fields"`
ExtraFields map[string]ProbeField `yaml:"extra_fields"`
Absent AbsentRule `yaml:"absent"`
}
type ProductSpec ¶
type ProductSpec struct {
SchemaVersion int `yaml:"schema_version"`
Product string `yaml:"product"`
Aliases []string `yaml:"aliases"`
Priority int `yaml:"priority"`
Resources []string `yaml:"resources"`
ExposeDefaultResource bool `yaml:"expose_default_resource"`
Description LocalizedText `yaml:"description"`
Examples []string `yaml:"examples"`
}
func LoadProduct ¶
func LoadProduct(specDir, product string) (ProductSpec, error)
func LoadProductFile ¶
func LoadProductFile(path string) (ProductSpec, error)
func LoadProductSpec ¶
func LoadProductSpec(raw []byte) (ProductSpec, error)
type Requirement ¶
type ResourceRef ¶
func ListResources ¶
func ListResources(specDir string) ([]ResourceRef, error)
type ResourceSchema ¶
type ResourceSchema struct {
Fields map[string]SchemaField `yaml:"fields"`
}
type ResourceSpec ¶
type ResourceSpec struct {
SchemaVersion int `yaml:"schema_version"`
Product string `yaml:"product"`
APIProduct string `yaml:"api_product"`
// Provider selects the request transport. Empty and "aliyun" use the
// Alibaba Cloud OpenAPI caller; other providers must be explicitly
// supported by the CLI.
Provider string `yaml:"provider"`
// FixedRegion pins the effective region for every operation of this
// resource, overriding the user-configured region. Used for API families
// served in a single region only: both the RegionId parameter and the
// endpoint are resolved from the pinned region.
FixedRegion string `yaml:"fixed_region"`
Resource string `yaml:"resource"`
Parent string `yaml:"parent"`
Kind string `yaml:"kind"`
Aliases []string `yaml:"aliases"`
DisplayName LocalizedText `yaml:"display_name"`
Description LocalizedText `yaml:"description"`
Help LocalizedText `yaml:"help"`
Examples []string `yaml:"examples"`
Messages map[string]LocalizedText `yaml:"messages"`
Identity Identity `yaml:"identity"`
Schema ResourceSchema `yaml:"schema"`
Controls map[string]SchemaField `yaml:"controls"`
Probes map[string]Probe `yaml:"probes"`
Waiters map[string]Waiter `yaml:"waiters"`
Bindings map[string]Binding `yaml:"bindings"`
Operations map[string]Operation `yaml:"operations"`
}
func Load ¶
func Load(raw []byte) (ResourceSpec, error)
func LoadFile ¶
func LoadFile(path string) (ResourceSpec, error)
func LoadResource ¶
func LoadResource(specDir, product, resource string) (ResourceSpec, error)
func LoadResourceWithParent ¶
func LoadResourceWithParent(specDir, product, resource, parent string) (ResourceSpec, error)
type SchemaField ¶
type SchemaField struct {
Type string `yaml:"type"`
Description LocalizedText `yaml:"description"`
Required bool `yaml:"required"`
Repeatable bool `yaml:"repeatable"`
Positional bool `yaml:"positional"`
PositionalMany bool `yaml:"positional_many"`
AllowEmpty bool `yaml:"allow_empty"`
InputStyle string `yaml:"input_style"`
Default any `yaml:"default"`
Max *int `yaml:"max"`
Enum []string `yaml:"enum"`
Items *SchemaField `yaml:"items"`
Fields map[string]SchemaField `yaml:"fields"`
}
type Transition ¶
type Transition struct {
Call string `yaml:"-"`
Request map[string]any `yaml:"-"`
Idempotency Idempotency `yaml:"-"`
Retry TransitionRetry `yaml:"-"`
IDFrom string `yaml:"-"`
RequestIDFrom string `yaml:"-"`
Wait string `yaml:"-"`
}
type TransitionRetry ¶
type TransitionRetry struct {
Policy string `yaml:"policy"`
Errors []string `yaml:"errors"`
InitialInterval string `yaml:"initial_interval"`
MaxInterval string `yaml:"max_interval"`
Timeout string `yaml:"timeout"`
// When optionally gates the retry on a condition evaluated against the
// execution context (e.g. "input.force"). When set and the condition is
// falsy, the matched errors surface immediately instead of being retried.
When string `yaml:"when"`
}
type Waiter ¶
type Waiter struct {
Probe string `yaml:"probe"`
Target string `yaml:"target"`
Interval string `yaml:"interval"`
Timeout string `yaml:"timeout"`
Failure WaiterFailure `yaml:"failure"`
Pending []WaiterPending `yaml:"pending"`
Match WaiterMatch `yaml:"match"`
}
type WaiterFailure ¶
type WaiterFailure struct {
States []string `yaml:"states"`
}
type WaiterMatch ¶
type WaiterPending ¶
type WorkflowStep ¶
type WorkflowStep struct {
Binding string `yaml:"binding"`
WaitUnless string `yaml:"wait_unless"`
Wait string `yaml:"wait"`
Probe string `yaml:"probe"`
Many bool `yaml:"many"`
IDs []string `yaml:"ids"`
As string `yaml:"as"`
NotFound string `yaml:"not_found"`
When string `yaml:"when"`
WhenAny []string `yaml:"when_any"`
Merge bool `yaml:"merge"`
Append bool `yaml:"append"`
Unless string `yaml:"unless"`
Emit any `yaml:"emit"`
}