...

Package libdevfile

Overview ▾

Package libdevfile is a generated GoMock package.

Index ▾

Constants
func AddKubernetesComponentToDevfile(crd, name string, devfileObj parser.DevfileObj) (parser.DevfileObj, error)
func Build(ctx context.Context, devfileObj parser.DevfileObj, buildCmd string, handler Handler) error
func Deploy(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error
func ExecPostStartEvents(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error
func ExecPreStopEvents(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error
func ExecuteCommandByName(ctx context.Context, devfileObj parser.DevfileObj, cmdName string, handler Handler, ignoreCommandNotFound bool) error
func ExecuteCommandByNameAndKind(ctx context.Context, devfileObj parser.DevfileObj, cmdName string, kind v1alpha2.CommandGroupKind, handler Handler, ignoreCommandNotFound bool) error
func FindComponentByName(d data.DevfileData, n string) (v1alpha2.Component, bool, error)
func GetCommand(devfileObj parser.DevfileObj, commandName string, groupType v1alpha2.CommandGroupKind) (v1alpha2.Command, bool, error)
func GetContainerComponentsForCommand(devfileObj parser.DevfileObj, cmd v1alpha2.Command) ([]string, error)
func GetContainerEndpointMapping(containers []v1alpha2.Component, includeDebug bool) map[string][]v1alpha2.Endpoint
func GetDebugEndpointsForComponent(cmp v1alpha2.Component) ([]v1alpha2.Endpoint, error)
func GetDevfileContainerEndpointMapping(devFileObj parser.DevfileObj, includeDebug bool) (map[string][]v1alpha2.Endpoint, error)
func GetEndpointsFromDevfile(devfileObj parser.DevfileObj, ignoreExposures []v1alpha2.EndpointExposure) ([]v1alpha2.Endpoint, error)
func GetImageComponentsToPushAutomatically(devfileObj parser.DevfileObj) ([]v1alpha2.Component, error)
func GetK8sAndOcComponentsToPush(devfileObj parser.DevfileObj, allowApply bool) ([]v1alpha2.Component, error)
func GetK8sComponentAsUnstructuredList(devfileObj parser.DevfileObj, componentName string, context string, fs devfilefs.Filesystem) ([]unstructured.Unstructured, error)
func GetK8sManifestsWithVariablesSubstituted(devfileObj parser.DevfileObj, devfileCmpName string, context string, fs devfilefs.Filesystem) (string, error)
func GetReferencedLocalFiles(devfileObj parser.DevfileObj) (result []string, err error)
func HasDebugCommand(devfileData data.DevfileData) bool
func HasDeployCommand(devfileData data.DevfileData) bool
func HasPostStartEvents(devfileObj parser.DevfileObj) bool
func HasPreStopEvents(devfileObj parser.DevfileObj) bool
func HasRunCommand(devfileData data.DevfileData) bool
func IsComponentReferenced(allApplyCommands []v1alpha2.Command, cmpName string) bool
func IsDebugEndpoint(ep v1alpha2.Endpoint) bool
func IsDebugPort(name string) bool
func ListKubernetesComponents(devfileObj parser.DevfileObj, path string) (list []unstructured.Unstructured, err error)
func ListOpenShiftComponents(devfileObj parser.DevfileObj, path string) (list []unstructured.Unstructured, err error)
func ValidateAndGetCommand(devfileObj parser.DevfileObj, commandName string, groupType v1alpha2.CommandGroupKind) (v1alpha2.Command, error)
func ValidateAndGetPushCommands(devfileObj parser.DevfileObj, devfileBuildCmd, devfileRunCmd string) (map[v1alpha2.CommandGroupKind]v1alpha2.Command, error)
type ComponentNotExistError
    func NewComponentNotExistError(name string) ComponentNotExistError
    func (e ComponentNotExistError) Error() string
type ComponentTypeNotFoundError
    func NewComponentTypeNotFoundError(componentType v1alpha2.ComponentType) ComponentTypeNotFoundError
    func (e ComponentTypeNotFoundError) Error() string
type ComponentsWithSameNameError
    func NewComponentsWithSameNameError(name string) ComponentsWithSameNameError
    func (e ComponentsWithSameNameError) Error() string
type DevfileCommands
type DevfileEventType
type Handler
type MockHandler
    func NewMockHandler(ctrl *gomock.Controller) *MockHandler
    func (m *MockHandler) ApplyImage(image v1alpha2.Component) error
    func (m *MockHandler) ApplyKubernetes(kubernetes v1alpha2.Component, kind v1alpha2.CommandGroupKind) error
    func (m *MockHandler) ApplyOpenShift(openshift v1alpha2.Component, kind v1alpha2.CommandGroupKind) error
    func (m *MockHandler) EXPECT() *MockHandlerMockRecorder
    func (m *MockHandler) ExecuteNonTerminatingCommand(ctx context.Context, command v1alpha2.Command) error
    func (m *MockHandler) ExecuteTerminatingCommand(ctx context.Context, command v1alpha2.Command) error
type MockHandlerMockRecorder
    func (mr *MockHandlerMockRecorder) ApplyImage(image interface{}) *gomock.Call
    func (mr *MockHandlerMockRecorder) ApplyKubernetes(kubernetes, kind interface{}) *gomock.Call
    func (mr *MockHandlerMockRecorder) ApplyOpenShift(openshift, kind interface{}) *gomock.Call
    func (mr *MockHandlerMockRecorder) ExecuteNonTerminatingCommand(ctx, command interface{}) *gomock.Call
    func (mr *MockHandlerMockRecorder) ExecuteTerminatingCommand(ctx, command interface{}) *gomock.Call
type MoreThanOneDefaultCommandFoundError
    func NewMoreThanOneDefaultCommandFoundError(kind v1alpha2.CommandGroupKind) MoreThanOneDefaultCommandFoundError
    func (e MoreThanOneDefaultCommandFoundError) Error() string
type NoCommandForGroup
    func (n NoCommandForGroup) Error() string
type NoCommandFoundError
    func NewNoCommandFoundError(kind v1alpha2.CommandGroupKind, name string) NoCommandFoundError
    func (e NoCommandFoundError) Error() string
type NoDefaultCommandFoundError
    func NewNoDefaultCommandFoundError(kind v1alpha2.CommandGroupKind) NoDefaultCommandFoundError
    func (e NoDefaultCommandFoundError) Error() string

Package files

command.go command_apply.go command_composite.go command_composite_parallel.go command_exec.go component.go component_container.go component_image.go component_kubernetes.go component_kubernetes_utils.go component_openshift.go component_volume.go errors.go handler_mock.go libdevfile.go types.go uris.go

Constants

const DebugEndpointNamePrefix = "debug"

func AddKubernetesComponentToDevfile

func AddKubernetesComponentToDevfile(crd, name string, devfileObj parser.DevfileObj) (parser.DevfileObj, error)

AddKubernetesComponentToDevfile adds a resource definition to devfile object as an inlined Kubernetes component

func Build

func Build(ctx context.Context, devfileObj parser.DevfileObj, buildCmd string, handler Handler) error

Build executes the default Build command of the devfile. If buildCmd is empty, this looks for the default Build command in the Devfile. No error is returned and no operation is performed if the default command could not be found. An error is returned if buildCmd is not empty and has no corresponding command in the Devfile.

func Deploy

func Deploy(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error

Deploy executes the default deploy command of the devfile.

func ExecPostStartEvents

func ExecPostStartEvents(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error

func ExecPreStopEvents

func ExecPreStopEvents(ctx context.Context, devfileObj parser.DevfileObj, handler Handler) error

func ExecuteCommandByName

func ExecuteCommandByName(ctx context.Context, devfileObj parser.DevfileObj, cmdName string, handler Handler, ignoreCommandNotFound bool) error

ExecuteCommandByName executes the specified command cmdName in the Devfile. If ignoreCommandNotFound is true, nothing is executed if the command is not found and no error is returned.

func ExecuteCommandByNameAndKind

func ExecuteCommandByNameAndKind(ctx context.Context, devfileObj parser.DevfileObj, cmdName string, kind v1alpha2.CommandGroupKind, handler Handler, ignoreCommandNotFound bool) error

ExecuteCommandByNameAndKind executes the specified command cmdName of the given kind in the Devfile. If cmdName is empty, it executes the default command for the given kind or returns an error if there is no default command. If ignoreCommandNotFound is true, nothing is executed if the command is not found and no error is returned.

func FindComponentByName

func FindComponentByName(d data.DevfileData, n string) (v1alpha2.Component, bool, error)

FindComponentByName returns the Devfile component that matches the specified name.

func GetCommand

func GetCommand(
    devfileObj parser.DevfileObj,
    commandName string,
    groupType v1alpha2.CommandGroupKind,
) (v1alpha2.Command, bool, error)

GetCommand iterates through the devfile commands and returns the devfile command with the specified name and group kind. If commandName is empty, it returns the default command for the group kind; or, if there is only one command for the specified kind, it will return that (even if it is not marked as the default). It returns an error if there is more than one default command.

func GetContainerComponentsForCommand

func GetContainerComponentsForCommand(devfileObj parser.DevfileObj, cmd v1alpha2.Command) ([]string, error)

GetContainerComponentsForCommand returns the list of container components that would get used if the specified command runs.

func GetContainerEndpointMapping

func GetContainerEndpointMapping(containers []v1alpha2.Component, includeDebug bool) map[string][]v1alpha2.Endpoint

GetContainerEndpointMapping returns a map of container names and slice of its endpoints. Debug endpoints will be included only if includeDebug is true.

func GetDebugEndpointsForComponent

func GetDebugEndpointsForComponent(cmp v1alpha2.Component) ([]v1alpha2.Endpoint, error)

GetDebugEndpointsForComponent returns all Debug endpoints for the specified component. It returns an error if the component specified is not a container component.

func GetDevfileContainerEndpointMapping

func GetDevfileContainerEndpointMapping(devFileObj parser.DevfileObj, includeDebug bool) (map[string][]v1alpha2.Endpoint, error)

GetDevfileContainerEndpointMapping returns a map of container components names and slice of its endpoints, given a Devfile object in parameter. Debug endpoints will be included only if includeDebug is true.

func GetEndpointsFromDevfile

func GetEndpointsFromDevfile(devfileObj parser.DevfileObj, ignoreExposures []v1alpha2.EndpointExposure) ([]v1alpha2.Endpoint, error)

GetEndpointsFromDevfile returns a slice of all endpoints in a devfile and ignores the endpoints with exposure values in ignoreExposures

func GetImageComponentsToPushAutomatically

func GetImageComponentsToPushAutomatically(devfileObj parser.DevfileObj) ([]v1alpha2.Component, error)

GetImageComponentsToPushAutomatically returns the list of Image components that can be automatically created on startup. The list returned is governed by the AutoBuild field in each component. All components with AutoBuild set to true are included, along with those with no AutoBuild set and not-referenced.

func GetK8sAndOcComponentsToPush

func GetK8sAndOcComponentsToPush(devfileObj parser.DevfileObj, allowApply bool) ([]v1alpha2.Component, error)

GetK8sAndOcComponentsToPush returns the list of Kubernetes and OpenShift components to push, The list returned is governed by the DeployByDefault field in each component. All components with DeployByDefault set to true are included, along with those with no DeployByDefault set and not-referenced. It takes an additional allowApply boolean, which set to true, will append the components referenced from apply commands to the list.

func GetK8sComponentAsUnstructuredList

func GetK8sComponentAsUnstructuredList(devfileObj parser.DevfileObj, componentName string,
    context string, fs devfilefs.Filesystem) ([]unstructured.Unstructured, error)

GetK8sComponentAsUnstructuredList parses the Inlined/URI K8s of the Devfile K8s component and returns a list of unstructured.Unstructured objects; List is returned here because it is possible to define multiple K8s resources against a single Devfile K8s component

func GetK8sManifestsWithVariablesSubstituted

func GetK8sManifestsWithVariablesSubstituted(devfileObj parser.DevfileObj, devfileCmpName string,
    context string, fs devfilefs.Filesystem) (string, error)

GetK8sManifestsWithVariablesSubstituted returns the full content of either a Kubernetes or an Openshift Devfile component, either Inlined or referenced via a URI. No matter how the component is defined, it returns the content with all variables substituted using the global variables map defined in `devfileObj`. An error is returned if the content references an invalid variable key not defined in the Devfile object.

func GetReferencedLocalFiles

func GetReferencedLocalFiles(devfileObj parser.DevfileObj) (result []string, err error)

GetReferencedLocalFiles returns the local files referenced by the Devfile. This includes: - the non-inlined Kubernetes and Openshift components - the Dockerfiles of Image components - the parent devfile - resursively, the local files referenced by the parent Devfile The passed Devfile must be flattened

func HasDebugCommand

func HasDebugCommand(devfileData data.DevfileData) bool

func HasDeployCommand

func HasDeployCommand(devfileData data.DevfileData) bool

func HasPostStartEvents

func HasPostStartEvents(devfileObj parser.DevfileObj) bool

func HasPreStopEvents

func HasPreStopEvents(devfileObj parser.DevfileObj) bool

func HasRunCommand

func HasRunCommand(devfileData data.DevfileData) bool

func IsComponentReferenced

func IsComponentReferenced(allApplyCommands []v1alpha2.Command, cmpName string) bool

func IsDebugEndpoint

func IsDebugEndpoint(ep v1alpha2.Endpoint) bool

IsDebugEndpoint returns whether the specified endpoint represents a Debug endpoint, based on the following naming convention: it is considered a Debug endpoint if it's named "debug" or if its name starts with "debug-".

func IsDebugPort

func IsDebugPort(name string) bool

IsDebugPort returns whether the specified string represents a Debug endpoint, based on the following naming convention: it is considered a Debug endpoint if it's named "debug" or if its name starts with "debug-".

func ListKubernetesComponents

func ListKubernetesComponents(devfileObj parser.DevfileObj, path string) (list []unstructured.Unstructured, err error)

ListKubernetesComponents lists all the kubernetes components from the devfile

func ListOpenShiftComponents

func ListOpenShiftComponents(devfileObj parser.DevfileObj, path string) (list []unstructured.Unstructured, err error)

ListOpenShiftComponents lists all the openshift components from the devfile

func ValidateAndGetCommand

func ValidateAndGetCommand(devfileObj parser.DevfileObj, commandName string, groupType v1alpha2.CommandGroupKind) (v1alpha2.Command, error)

ValidateAndGetCommand validates and returns the command specified if it is valid. It works just like GetCommand, except that it returns an error if it could not find the command.

If commandName is empty, it looks up the default command for the given kind.

A command is "valid" here if it was found given its name (if commandName is not empty), or (for a default command), if there is no other default command for the same kind.

func ValidateAndGetPushCommands

func ValidateAndGetPushCommands(
    devfileObj parser.DevfileObj,
    devfileBuildCmd,
    devfileRunCmd string,
) (map[v1alpha2.CommandGroupKind]v1alpha2.Command, error)

ValidateAndGetPushCommands validates the build and the run commands, if provided through odo dev or else checks the devfile for devBuild and devRun. It returns the build and run commands if validated successfully, or an error otherwise.

type ComponentNotExistError

ComponentNotExistError is returned when a component referenced in a command or component does not exist

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

func NewComponentNotExistError

func NewComponentNotExistError(name string) ComponentNotExistError

func (ComponentNotExistError) Error

func (e ComponentNotExistError) Error() string

type ComponentTypeNotFoundError

ComponentTypeNotFoundError is returned when no component with the specified type has been found in Devfile

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

func NewComponentTypeNotFoundError

func NewComponentTypeNotFoundError(componentType v1alpha2.ComponentType) ComponentTypeNotFoundError

func (ComponentTypeNotFoundError) Error

func (e ComponentTypeNotFoundError) Error() string

type ComponentsWithSameNameError

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

func NewComponentsWithSameNameError

func NewComponentsWithSameNameError(name string) ComponentsWithSameNameError

func (ComponentsWithSameNameError) Error

func (e ComponentsWithSameNameError) Error() string

type DevfileCommands

type DevfileCommands struct {
    BuildCmd string
    RunCmd   string
    DebugCmd string
}

type DevfileEventType

type DevfileEventType string
const (

    // PreStop is a devfile event
    PreStop DevfileEventType = "preStop"
)

type Handler

type Handler interface {
    ApplyImage(image v1alpha2.Component) error
    ApplyKubernetes(kubernetes v1alpha2.Component, kind v1alpha2.CommandGroupKind) error
    ApplyOpenShift(openshift v1alpha2.Component, kind v1alpha2.CommandGroupKind) error
    ExecuteNonTerminatingCommand(ctx context.Context, command v1alpha2.Command) error
    ExecuteTerminatingCommand(ctx context.Context, command v1alpha2.Command) error
}

type MockHandler

MockHandler is a mock of Handler interface.

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

func NewMockHandler

func NewMockHandler(ctrl *gomock.Controller) *MockHandler

NewMockHandler creates a new mock instance.

func (*MockHandler) ApplyImage

func (m *MockHandler) ApplyImage(image v1alpha2.Component) error

ApplyImage mocks base method.

func (*MockHandler) ApplyKubernetes

func (m *MockHandler) ApplyKubernetes(kubernetes v1alpha2.Component, kind v1alpha2.CommandGroupKind) error

ApplyKubernetes mocks base method.

func (*MockHandler) ApplyOpenShift

func (m *MockHandler) ApplyOpenShift(openshift v1alpha2.Component, kind v1alpha2.CommandGroupKind) error

ApplyOpenShift mocks base method.

func (*MockHandler) EXPECT

func (m *MockHandler) EXPECT() *MockHandlerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHandler) ExecuteNonTerminatingCommand

func (m *MockHandler) ExecuteNonTerminatingCommand(ctx context.Context, command v1alpha2.Command) error

ExecuteNonTerminatingCommand mocks base method.

func (*MockHandler) ExecuteTerminatingCommand

func (m *MockHandler) ExecuteTerminatingCommand(ctx context.Context, command v1alpha2.Command) error

ExecuteTerminatingCommand mocks base method.

type MockHandlerMockRecorder

MockHandlerMockRecorder is the mock recorder for MockHandler.

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

func (*MockHandlerMockRecorder) ApplyImage

func (mr *MockHandlerMockRecorder) ApplyImage(image interface{}) *gomock.Call

ApplyImage indicates an expected call of ApplyImage.

func (*MockHandlerMockRecorder) ApplyKubernetes

func (mr *MockHandlerMockRecorder) ApplyKubernetes(kubernetes, kind interface{}) *gomock.Call

ApplyKubernetes indicates an expected call of ApplyKubernetes.

func (*MockHandlerMockRecorder) ApplyOpenShift

func (mr *MockHandlerMockRecorder) ApplyOpenShift(openshift, kind interface{}) *gomock.Call

ApplyOpenShift indicates an expected call of ApplyOpenShift.

func (*MockHandlerMockRecorder) ExecuteNonTerminatingCommand

func (mr *MockHandlerMockRecorder) ExecuteNonTerminatingCommand(ctx, command interface{}) *gomock.Call

ExecuteNonTerminatingCommand indicates an expected call of ExecuteNonTerminatingCommand.

func (*MockHandlerMockRecorder) ExecuteTerminatingCommand

func (mr *MockHandlerMockRecorder) ExecuteTerminatingCommand(ctx, command interface{}) *gomock.Call

ExecuteTerminatingCommand indicates an expected call of ExecuteTerminatingCommand.

type MoreThanOneDefaultCommandFoundError

MoreThanOneDefaultCommandFoundError is returned when several default commands of the specified kind exist

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

func NewMoreThanOneDefaultCommandFoundError

func NewMoreThanOneDefaultCommandFoundError(kind v1alpha2.CommandGroupKind) MoreThanOneDefaultCommandFoundError

func (MoreThanOneDefaultCommandFoundError) Error

func (e MoreThanOneDefaultCommandFoundError) Error() string

type NoCommandForGroup

NoCommandForGroup indicates an error when no command was found for the given Group

type NoCommandForGroup struct {
    Group v1alpha2.CommandGroupKind
}

func (NoCommandForGroup) Error

func (n NoCommandForGroup) Error() string

type NoCommandFoundError

NoCommandFoundError is returned when no command of the specified kind is found in devfile

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

func NewNoCommandFoundError

func NewNoCommandFoundError(kind v1alpha2.CommandGroupKind, name string) NoCommandFoundError

func (NoCommandFoundError) Error

func (e NoCommandFoundError) Error() string

type NoDefaultCommandFoundError

NoDefaultCommandFoundError is returned when several commands of the specified kind exist but no one is the default one

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

func NewNoDefaultCommandFoundError

func NewNoDefaultCommandFoundError(kind v1alpha2.CommandGroupKind) NoDefaultCommandFoundError

func (NoDefaultCommandFoundError) Error

func (e NoDefaultCommandFoundError) Error() string

Subdirectories

Name Synopsis
..
generator