overriding

package
v0.0.0-...-071eeca Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: EPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeDevWorkspaceTemplateSpec

func MergeDevWorkspaceTemplateSpec(
	mainContent *workspaces.DevWorkspaceTemplateSpecContent,
	parentFlattenedContent *workspaces.DevWorkspaceTemplateSpecContent,
	pluginFlattenedContents ...*workspaces.DevWorkspaceTemplateSpecContent) (*workspaces.DevWorkspaceTemplateSpecContent, error)

MergeDevWorkspaceTemplateSpec implements the merging logic of a main devfile content with flattened, already-overridden parent devfiles or plugins. On a `main` `DevWorkspaceTemplateSpec` (which is the core part of a devfile, without the `apiVersion` and `metadata`), it allows adding all the new overridden elements provided by flattened parent and plugins

Returns non-nil error if there are duplicate (== with same key) commands, components or projects between the main content and the parent or plugins.

The result is a transformed `DevWorkspaceTemplateSpec` object, that does not contain any `plugin` component (since they are expected to be provided as flattened overridden devfiles in the arguments)

func MergeDevWorkspaceTemplateSpecBytes

func MergeDevWorkspaceTemplateSpecBytes(originalBytes []byte, flattenedParentBytes []byte, flattenPluginsBytes ...[]byte) (*workspaces.DevWorkspaceTemplateSpecContent, error)

MergeDevWorkspaceTemplateSpecBytes implements the merging logic of a main devfile content with flattened, already-overridden parent devfiles or plugins. On an json or yaml document that contains the core content of the devfile (which is the core part of a devfile, without the `apiVersion` and `metadata`), it allows adding all the new overridden elements provided by flattened parent and plugins (also provided as json or yaml documents)

It is not allowed for to have duplicate (== with same key) commands, components or projects between the main content and the parent or plugins. An error would be thrown

The result is a transformed `DevfileWorkspaceTemplateSpec` object, that does not contain any `plugin` component (since they are expected to be provided as flattened overridden devfiles in the arguments)

func OverrideDevWorkspaceTemplateSpec

OverrideDevWorkspaceTemplateSpec implements the overriding logic for parent devfiles or plugins. On an `original` `DevfileWorkspaceTemplateSpec` (which is the core part of a devfile, without the `apiVersion` and `metadata`), it allows applying a `patch` which is a `ParentOverrides` or a `PluginOverrides` object.

The Overriding logic is implemented according to strategic merge patch rules, as defined here: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md#background

The result is a transformed `DevfileWorkspaceTemplateSpec` object.

func OverrideDevWorkspaceTemplateSpecBytes

func OverrideDevWorkspaceTemplateSpecBytes(originalBytes []byte, patchBytes []byte) (*workspaces.DevWorkspaceTemplateSpecContent, error)

OverrideDevWorkspaceTemplateSpecBytes implements the overriding logic for parent devfiles or plugins. On a json or yaml document that contains the core content of the devfile (without the `apiVersion` and `metadata`), it allows applying a `patch` which is a document fragment of the same schema.

The Overriding logic is implemented according to strategic merge patch rules, as defined here: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md#background

The result is a transformed `DevfileWorkspaceTemplateSpec` object that can be serialized back to yaml or json.

Types

This section is empty.

Jump to

Keyboard shortcuts

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