overriding

package
v2.0.0-...-01444cd Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: EPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeDevWorkspaceTemplateSpec

func MergeDevWorkspaceTemplateSpec(
	mainContent *dw.DevWorkspaceTemplateSpecContent,
	parentFlattenedContent *dw.DevWorkspaceTemplateSpecContent,
	pluginFlattenedContents ...*dw.DevWorkspaceTemplateSpecContent) (*dw.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) (*dw.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

func OverrideDevWorkspaceTemplateSpec(original *dw.DevWorkspaceTemplateSpecContent, patch dw.Overrides) (*dw.DevWorkspaceTemplateSpecContent, error)

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) (*dw.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