Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONSchema ¶
type JSONSchema struct {
// contains filtered or unexported fields
}
JSONSchema implements Schema and uses json-schema to validate spec data.
func (*JSONSchema) Validate ¶
func (j *JSONSchema) Validate(data []byte) error
func (*JSONSchema) ValidateGo ¶
func (j *JSONSchema) ValidateGo(data interface{}) error
type Schema ¶
type Schema interface {
// Validate takes the data to be validated as a byte array.
Validate(data []byte) error
// ValidateGo takes the data to be validated as an arbitrary go data structure.
ValidateGo(data interface{}) error
}
Schema is a step spec schema. It provides a Validate method for ensuring at runtime, specs for steps meet the schema's requirements.
type SchemaDoesNotExistError ¶
type SchemaDoesNotExistError struct {
Name string
}
func (*SchemaDoesNotExistError) Error ¶
func (e *SchemaDoesNotExistError) Error() string
type SchemaRegistry ¶
type SchemaRegistry interface {
// GetByStepRepository returns the spec Schema for repo. Implementations of
// this interface might use the image repo as the repo string to look up
// schemas.
GetByImage(ref name.Reference) (Schema, error)
}
SchemaRegistry is a registry of spec schemas for steps.
type StepMetadata ¶
type StepMetadata struct {
// Publish is the step image publishing metadata
Publish struct {
// Repository is the image repo for the step
Repository string `json:"repository"`
} `json:"publish"`
// Schemas is a map of schemas available for the given step repository
Schemas map[string]json.RawMessage `json:"schemas"`
}
StepMetadata is a subset of fields for relaysh step-metadata.json. It is used for decoding that payload into schema objects for step spec validation.
type StepMetadataFetchError ¶
type StepMetadataFetchError struct {
StatusCode int
}
func (*StepMetadataFetchError) Error ¶
func (e *StepMetadataFetchError) Error() string
type StepMetadataSchemaRegistry ¶
type StepMetadataSchemaRegistry struct {
LastResponse *http.Response
sync.RWMutex
// contains filtered or unexported fields
}
StepMetadataSchemaRegistry is a registry that loads spec schemas for steps from a single file at a URL. An example of this file can be found in `testdata/step-metadata.json`.
func NewStepMetadataSchemaRegistry ¶
func NewStepMetadataSchemaRegistry(u *url.URL, opts ...StepMetadataSchemaRegistryOption) (*StepMetadataSchemaRegistry, error)
NewStepMetadataSchemaRegistry returns a new StepMetadataSchemaRegistry for a given URL. An initial request for the repo file is made and could return an error if the file does not exist, or is otherwise broken.
func (*StepMetadataSchemaRegistry) GetByImage ¶
func (s *StepMetadataSchemaRegistry) GetByImage(ref name.Reference) (Schema, error)
GetByImage takes an image repo ref and looks up the schema for its spec and returns a Schema for it. If the repo cannot be found, it returns SchemaDoesNotExistError.
type StepMetadataSchemaRegistryOption ¶
type StepMetadataSchemaRegistryOption func(*StepMetadataSchemaRegistry)
StepMetadataSchemaRegistryOption is for setting optional configuration on StepMetadataSchemaRegistry objects when using NewStepMetadataSchemaRegistry.
func WithStepMetadataSchemaRegistryClient ¶
func WithStepMetadataSchemaRegistryClient(client *http.Client) StepMetadataSchemaRegistryOption
WithStepMetadataSchemaRegistryClient sets the http.Client to use when StepMetadataSchemaRegistry is making requests to fetch step-metadata.json files.