inputs

package
v0.18.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ATTR_INPUT_TYPES = "ocm.software/ocm/cmds/ocm/common/inputs"
View Source
const KIND_INPUTTYPE = "input type"

Variables

View Source
var DefaultInputTypeScheme = NewInputTypeScheme(nil)

DefaultInputTypeScheme contains all globally known access serializer.

Functions

func FileInfo

func FileInfo(ctx clictx.Context, path string, inputFilePath string) (os.FileInfo, string, error)

func GetBaseDir

func GetBaseDir(fs vfs.FileSystem, filePath string) (string, error)

func GetPath

func GetPath(ctx clictx.Context, path string, inputFilePath string) (string, error)

func InputFieldDoc

func InputFieldDoc(name string, desc string, opt flagsets.ConfigOptionType) string

func RegisterInputType

func RegisterInputType(atype InputType)

func SetFor

func SetFor(ctx datacontext.Context, scheme InputTypeScheme)

func Usage

func Usage(scheme InputTypeScheme) string

Types

type Context

type Context interface {
	clictx.Context
	Printer() common.Printer
	Printf(msg string, args ...interface{}) (int, error)
	Variables() map[string]interface{}
	Section(msg string, args ...interface{}) Context
	AddGap(gap string) Context
}

func NewContext

func NewContext(ctx clictx.Context, pr common.Printer, variables map[string]interface{}) Context

type DefaultInputType

type DefaultInputType struct {
	runtime.ObjectVersionedType
	runtime.TypedObjectDecoder[InputSpec]
	// contains filtered or unexported fields
}

func (*DefaultInputType) ApplyConfig

func (t *DefaultInputType) ApplyConfig(opts flagsets.ConfigOptions, config flagsets.Config) error

func (*DefaultInputType) ConfigOptionTypeSetHandler

func (t *DefaultInputType) ConfigOptionTypeSetHandler() flagsets.ConfigOptionTypeSetHandler

func (*DefaultInputType) Usage

func (t *DefaultInputType) Usage() string

type FieldSetter

type FieldSetter func(opts flagsets.ConfigOptions, opt flagsets.ConfigOptionType, config flagsets.Config) error

type GenericInputSpec

type GenericInputSpec struct {
	// contains filtered or unexported fields
}

func ToGenericInputSpec

func ToGenericInputSpec(spec InputSpec) (*GenericInputSpec, error)

func (*GenericInputSpec) Evaluate

func (s *GenericInputSpec) Evaluate(scheme InputTypeScheme) (InputSpec, error)

func (*GenericInputSpec) GetBlob

func (*GenericInputSpec) GetInputVersion

func (s *GenericInputSpec) GetInputVersion(ctx Context) string

func (*GenericInputSpec) GetKind

func (s *GenericInputSpec) GetKind() string

func (*GenericInputSpec) GetRaw

func (s *GenericInputSpec) GetRaw() ([]byte, error)

func (*GenericInputSpec) GetType

func (s *GenericInputSpec) GetType() string

func (*GenericInputSpec) GetVersion

func (s *GenericInputSpec) GetVersion() string

func (GenericInputSpec) MarshalJSON

func (s GenericInputSpec) MarshalJSON() ([]byte, error)

func (*GenericInputSpec) UnmarshalJSON

func (s *GenericInputSpec) UnmarshalJSON(data []byte) error

func (*GenericInputSpec) Validate

func (s *GenericInputSpec) Validate(fldPath *field.Path, ctx Context, inputFilePath string) field.ErrorList

type InputField

type InputField interface {
	OptionType() flagsets.ConfigOptionType
	Usage() string
	AddConfig(opts flagsets.ConfigOptions, config flagsets.Config) error
}

func NewInputField

func NewInputField(name, desc string, opt flagsets.ConfigOptionType, setter FieldSetter) InputField

type InputFieldSource

type InputFieldSource interface {
	InputFields() []InputField
}

type InputFields

type InputFields []InputField

func NewInputFields

func NewInputFields(fields ...InputFieldSource) InputFields

func (InputFields) AddConfig

func (i InputFields) AddConfig(opts flagsets.ConfigOptions, config flagsets.Config) error

func (InputFields) InputFields

func (i InputFields) InputFields() []InputField

func (InputFields) Usage

func (i InputFields) Usage() string

type InputResourceInfo

type InputResourceInfo struct {
	// ComponentVersion is the name of the component version to generate.
	ComponentVersion common.NameVersion
	// ElementName is the name of the element to create.
	ElementName string
	// The path of the file the inputs description has been taken from.
	InputFilePath string
}

type InputSpec

type InputSpec interface {
	runtime.VersionedTypedObject
	Validate(fldPath *field.Path, ctx Context, inputFilePath string) field.ErrorList
	GetBlob(ctx Context, info InputResourceInfo) (blobaccess.BlobAccess, string, error)
	GetInputVersion(ctx Context) string
}

func CreateRepositorySpec

func CreateRepositorySpec(t runtime.TypedObject) (InputSpec, error)

func NewGenericInputSpec

func NewGenericInputSpec(data []byte, unmarshaler runtime.Unmarshaler) (InputSpec, error)

type InputSpecBase

type InputSpecBase struct {
	runtime.ObjectVersionedType `json:",inline"`
}

func (*InputSpecBase) GetInputVersion

func (*InputSpecBase) GetInputVersion(ctx Context) string

type InputSpecDecoder

type InputSpecDecoder = runtime.TypedObjectDecoder[InputSpec]

type InputType

type InputType interface {
	runtime.VersionedTypeInfo
	runtime.TypedObjectDecoder[InputSpec]

	ConfigOptionTypeSetHandler() flagsets.ConfigOptionTypeSetHandler

	Usage() string
}

func NewInputType

func NewInputType(name string, proto InputSpec, usage string, cfg flagsets.ConfigOptionTypeSetHandler) InputType

type InputTypeScheme

type InputTypeScheme interface {
	runtime.Scheme[InputSpec, InputType]

	ConfigTypeSetConfigProvider() flagsets.ConfigTypeOptionSetConfigProvider
	flagsets.ConfigProvider

	GetInputType(name string) InputType
	Register(atype InputType)

	GetInputSpecFor(opts flagsets.ConfigOptions) (InputSpec, error)
	DecodeInputSpec(data []byte, unmarshaler runtime.Unmarshaler) (InputSpec, error)
	CreateInputSpec(obj runtime.TypedObject) (InputSpec, error)
}

func NewInputTypeScheme

func NewInputTypeScheme(defaultRepoDecoder runtime.TypedObjectDecoder[InputSpec]) InputTypeScheme

type UnknownInputSpec

type UnknownInputSpec struct {
	runtime.UnstructuredVersionedTypedObject `json:",inline"`
}

func (*UnknownInputSpec) GetBlob

func (*UnknownInputSpec) GetInputVersion

func (s *UnknownInputSpec) GetInputVersion(ctx Context) string

func (*UnknownInputSpec) Validate

func (r *UnknownInputSpec) Validate(fldPath *field.Path, ctx Context, inputFilePath string) field.ErrorList

Directories

Path Synopsis
npm
ocm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL