cmdutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandName added in v0.1.6

func CommandName(name, fullParentName string) string

func ConfigureRunnableAndCommandWithTargeting

func ConfigureRunnableAndCommandWithTargeting(runnable Runnable, cmd *cobra.Command)

func FlagValueIfSet added in v0.2.0

func FlagValueIfSet(cmd *cobra.Command, flagName string) string

FlagValueIfSet retrieves the value of the specified flag if it is set for the given command

func GenericRun

func GenericRun(o Runnable, cmd *cobra.Command, args []string)

func IsInteractive added in v0.2.0

func IsInteractive(cmd *cobra.Command) bool

func NewGenericCreate added in v0.2.0

func NewGenericCreate(fullParentName string, o *CreateOptions) *cobra.Command

func NewGenericDelete added in v0.1.6

func NewGenericDelete(fullParentName string, o *DeleteOptions) *cobra.Command

func NewGenericOperation added in v0.2.0

func NewGenericOperation(fullParentName string, o *GenericOperationOptions) *cobra.Command

func SetupEnvOptions added in v0.2.0

func SetupEnvOptions(o WithEnv, cmd *cobra.Command)

Types

type ComponentTargetingOptions

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

func NewTargetingOptions

func NewTargetingOptions() *ComponentTargetingOptions

func (*ComponentTargetingOptions) AttachFlagTo

func (o *ComponentTargetingOptions) AttachFlagTo(cmd *cobra.Command)

func (*ComponentTargetingOptions) Complete

func (o *ComponentTargetingOptions) Complete(name string, cmd *cobra.Command, args []string) error

func (*ComponentTargetingOptions) GetTargetedComponentDescriptor added in v0.1.3

func (o *ComponentTargetingOptions) GetTargetedComponentDescriptor() string

func (*ComponentTargetingOptions) GetTargetedComponentName added in v0.1.3

func (o *ComponentTargetingOptions) GetTargetedComponentName() string

func (*ComponentTargetingOptions) GetTargetedComponentPath added in v0.1.3

func (o *ComponentTargetingOptions) GetTargetedComponentPath() string

func (*ComponentTargetingOptions) Run

func (*ComponentTargetingOptions) Validate

func (o *ComponentTargetingOptions) Validate() error

type CreateOptions added in v0.2.0

type CreateOptions struct {
	*GenericOperationOptions
	Delegate Creator
	// contains filtered or unexported fields
}

func NewCreateOptions added in v0.2.0

func NewCreateOptions(resourceType ResourceType, client HalkyonEntity) *CreateOptions

func (*CreateOptions) Complete added in v0.2.0

func (o *CreateOptions) Complete(name string, cmd *cobra.Command, args []string) error

func (*CreateOptions) Run added in v0.2.0

func (o *CreateOptions) Run() error

func (*CreateOptions) Validate added in v0.2.0

func (o *CreateOptions) Validate() error

type Creator added in v0.2.0

type Creator interface {
	Runnable
	GeneratePrefix() string
	Build() runtime.Object
	Set(entity runtime.Object)
}

type DeleteOptions added in v0.1.6

type DeleteOptions struct {
	*GenericOperationOptions
}

func NewDeleteOptions added in v0.2.0

func NewDeleteOptions(resourceType ResourceType, client HalkyonEntity) *DeleteOptions

func (*DeleteOptions) Complete added in v0.1.6

func (o *DeleteOptions) Complete(name string, cmd *cobra.Command, args []string) error

func (*DeleteOptions) Run added in v0.1.6

func (o *DeleteOptions) Run() error

func (*DeleteOptions) Validate added in v0.1.6

func (o *DeleteOptions) Validate() error

type EnvOptions added in v0.2.0

type EnvOptions struct {
	EnvPairs []string
	Envs     []halkyon.NameValuePair
}

func (*EnvOptions) Complete added in v0.2.0

func (o *EnvOptions) Complete(name string, cmd *cobra.Command, args []string) error

type GenericOperationOptions added in v0.2.0

type GenericOperationOptions struct {
	ResourceType ResourceType
	Name         string
	Client       HalkyonEntity
	// contains filtered or unexported fields
}

func (*GenericOperationOptions) Complete added in v0.2.0

func (o *GenericOperationOptions) Complete(name string, cmd *cobra.Command, args []string) error

func (*GenericOperationOptions) Exists added in v0.2.0

func (o *GenericOperationOptions) Exists() (bool, error)

Exists checks if the object associated with this GenericOperationOptions exists. Returns (true, nil) if it exists, (false, nil) if it is determined to not exist or (false, error) if an error that doesn't determine existence occurred

func (*GenericOperationOptions) Run added in v0.2.0

func (o *GenericOperationOptions) Run() error

func (*GenericOperationOptions) Validate added in v0.2.0

func (o *GenericOperationOptions) Validate() error

type HalkyonDescriptor added in v0.2.0

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

func LoadAvailableHalkyonEntities added in v0.2.0

func LoadAvailableHalkyonEntities(path string) *HalkyonDescriptor

func LoadHalkyonDescriptor added in v0.2.0

func LoadHalkyonDescriptor(descriptor string) (*HalkyonDescriptor, error)

func (*HalkyonDescriptor) GetDefinedEntitiesWith added in v0.2.0

func (hd *HalkyonDescriptor) GetDefinedEntitiesWith(t ResourceType) entitiesRegistry

func (*HalkyonDescriptor) IsEmpty added in v0.2.0

func (hd *HalkyonDescriptor) IsEmpty() bool

func (*HalkyonDescriptor) Size added in v0.2.0

func (hd *HalkyonDescriptor) Size() int

type HalkyonDescriptorEntity added in v0.2.0

type HalkyonDescriptorEntity struct {
	Name   string
	Path   string
	Entity runtime.Object
}

type HalkyonEntity added in v0.1.6

type HalkyonEntity interface {
	Get(name string) (runtime.Object, error)
	Create(runtime.Object) error
	Delete(string, *v1.DeleteOptions) error
	GetKnown() ui.DisplayableMap
	GetNamespace() string
}

type ResourceType added in v0.2.0

type ResourceType string
const (
	Component  ResourceType = "component"
	Capability ResourceType = "capability"
)

func KnownResourceTypes added in v0.2.0

func KnownResourceTypes() []ResourceType

func ResourceTypeFor added in v0.2.0

func ResourceTypeFor(object runtime.Object) (ResourceType, error)

func (ResourceType) String added in v0.2.0

func (r ResourceType) String() string

type Runnable

type Runnable interface {
	Complete(name string, cmd *cobra.Command, args []string) error
	Validate() error
	Run() error
}

type WithEnv added in v0.2.0

type WithEnv interface {
	SetEnvOptions(o *EnvOptions)
}

Jump to

Keyboard shortcuts

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