v1

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 15

Documentation

Index

Constants

View Source
const (
	KIND_LABEL                 = "label"
	KIND_VALUE_MERGE_ALGORITHM = "label merge algorithm"
)
View Source
const (
	// ExcludeFromSignature used in digest field for normalisationAlgorithm (in combination with NoDigest for hashAlgorithm and value)
	// to indicate the resource content should not be part of the signature.
	ExcludeFromSignature = "EXCLUDE-FROM-SIGNATURE"

	// NoDigest used in digest field for hashAlgorithm and value (in combination with ExcludeFromSignature for normalisationAlgorithm)
	// to indicate the resource content should not be part of the signature.
	NoDigest = "NO-DIGEST"
)
View Source
const (
	// SystemIdentityName is the name attribute of an element in
	// a component version. It is always present.
	SystemIdentityName = "name"
	// SystemIdentityVersion is the version attribute optionally
	// added to the identity of an element in a component version.
	// It is required, if the name and the other explicitly defined
	// extra identity attributes are not unique for a dedicated
	// kind of element in the context of a component version.
	SystemIdentityVersion = "version"
)

These constants describe identity attributes predefined by the model used to identify elements (resources, sources and references) in a component version.

View Source
const (
	GROUP = "ocm.software"
	KIND  = "ComponentVersion"
)
View Source
const IdentityKeyValidationErrMsg string = "" /* 147-byte string literal not displayed */

Variables

This section is empty.

Functions

func CheckLabelVersion

func CheckLabelVersion(v string) bool

func IsASCII

func IsASCII(s string) bool

IsAscii checks whether a string only contains ascii characters.

func IsIdentity

func IsIdentity(s string) bool

func ValidateIdentity

func ValidateIdentity(fldPath *field.Path, id Identity) field.ErrorList

ValidateIdentity validates the identity of object.

func ValidateLabels

func ValidateLabels(fldPath *field.Path, labels Labels) field.ErrorList

ValidateLabels validates a list of labels.

func ValidateRelation

func ValidateRelation(fldPath *field.Path, relation ResourceRelation) *field.Error

Types

type ArtefactDigest added in v0.3.0

type ArtefactDigest struct {
	Name          string     `json:"name"`
	Version       string     `json:"version"`
	ExtraIdentity Identity   `json:"extraIdentity,omitempty"`
	Digest        DigestSpec `json:"digest"`
}

ArtefactDigest defines artefact digest information. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*ArtefactDigest) Copy added in v0.3.0

func (d *ArtefactDigest) Copy() *ArtefactDigest

func (*ArtefactDigest) DeepCopy added in v0.3.0

func (in *ArtefactDigest) DeepCopy() *ArtefactDigest

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtefactDigest.

func (*ArtefactDigest) DeepCopyInto added in v0.3.0

func (in *ArtefactDigest) DeepCopyInto(out *ArtefactDigest)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ArtefactDigest) String added in v0.3.0

func (d *ArtefactDigest) String() string

type ArtefactDigests added in v0.3.0

type ArtefactDigests []ArtefactDigest

ArtefactDigests defines a list of artefact digest information. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (ArtefactDigests) DeepCopy added in v0.3.0

func (in ArtefactDigests) DeepCopy() ArtefactDigests

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtefactDigests.

func (ArtefactDigests) DeepCopyInto added in v0.3.0

func (in ArtefactDigests) DeepCopyInto(out *ArtefactDigests)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ArtefactDigests) Lookup added in v0.3.0

func (d ArtefactDigests) Lookup(name, version string, extra Identity) *ArtefactDigest

func (ArtefactDigests) Match added in v0.3.0

type DigestSpec

type DigestSpec struct {
	HashAlgorithm          string `json:"hashAlgorithm"`
	NormalisationAlgorithm string `json:"normalisationAlgorithm"`
	Value                  string `json:"value"`
}

DigestSpec defines a digest. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func NewExcludeFromSignatureDigest

func NewExcludeFromSignatureDigest() *DigestSpec

NewExcludeFromSignatureDigest returns the special digest notation to indicate the resource content should not be part of the signature.

func (*DigestSpec) Copy

func (d *DigestSpec) Copy() *DigestSpec

Copy provides a copy of the digest spec.

func (*DigestSpec) DeepCopy added in v0.3.0

func (in *DigestSpec) DeepCopy() *DigestSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigestSpec.

func (*DigestSpec) DeepCopyInto added in v0.3.0

func (in *DigestSpec) DeepCopyInto(out *DigestSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DigestSpec) Equal added in v0.4.1

func (d *DigestSpec) Equal(o *DigestSpec) bool

func (*DigestSpec) Equivalent added in v0.4.1

func (d *DigestSpec) Equivalent(o *DigestSpec) equivalent.EqualState

func (*DigestSpec) IsComplete added in v0.4.1

func (d *DigestSpec) IsComplete() bool

func (*DigestSpec) IsExcluded added in v0.4.1

func (d *DigestSpec) IsExcluded() bool

func (*DigestSpec) IsNone added in v0.4.1

func (d *DigestSpec) IsNone() bool

func (*DigestSpec) String

func (d *DigestSpec) String() string

type Identity

type Identity map[string]string

Identity describes the identity of an object. Only ascii characters are allowed +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func NewExtraIdentity added in v0.4.1

func NewExtraIdentity(extras ...string) Identity

func NewIdentity

func NewIdentity(name string, extras ...string) Identity

NewIdentity return a simple name identity.

func (Identity) Copy

func (i Identity) Copy() Identity

Copy copies identity.

func (Identity) DeepCopy added in v0.3.0

func (in Identity) DeepCopy() Identity

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity.

func (Identity) DeepCopyInto added in v0.3.0

func (in Identity) DeepCopyInto(out *Identity)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Identity) Digest

func (i Identity) Digest() []byte

Digest returns the object digest of an identity.

func (Identity) Equals

func (i Identity) Equals(o Identity) bool

Equals compares two identities.

func (Identity) Equivalent added in v0.4.1

func (i Identity) Equivalent(o Identity) equivalent.EqualState

func (Identity) Get

func (i Identity) Get(name string) string

func (Identity) Match

func (i Identity) Match(obj map[string]string) (bool, error)

Match implements the selector interface.

func (Identity) Remove

func (i Identity) Remove(name string) bool

func (*Identity) Set

func (i *Identity) Set(name, value string)

func (Identity) String

func (i Identity) String() string

type Label

type Label struct {
	// Name is the unique name of the label.
	Name string `json:"name"`
	// Value is the json/yaml data of the label
	// +kubebuilder:pruning:PreserveUnknownFields
	// +kubebuilder:validation:Schemaless
	Value json.RawMessage `json:"value"`

	// Version is the optional specification version of the attribute value
	Version string `json:"version,omitempty"`
	// Signing describes whether the label should be included into the signature
	Signing bool `json:"signing,omitempty"`

	// MergeAlgorithm optionally describes the desired merge handling used to
	// merge the label value during a transfer.
	Merge *MergeAlgorithmSpecification `json:"merge,omitempty"`
}

Label is a label that can be set on objects. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func NewLabel

func NewLabel(name string, value interface{}, opts ...LabelOption) (*Label, error)

func (*Label) DeepCopy added in v0.3.0

func (in *Label) DeepCopy() *Label

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Label.

func (*Label) DeepCopyInto

func (in *Label) DeepCopyInto(out *Label)

DeepCopyInto copies labels.

func (*Label) GetValue added in v0.4.1

func (in *Label) GetValue(dest interface{}) error

GetValue returns the label value with the given name as parsed object.

func (*Label) SetValue added in v0.4.1

func (in *Label) SetValue(value interface{}) error

SetValue sets the label value by marshalling the given object. A passed byte slice is validated to be valid json.

type LabelMergeHandlerConfig added in v0.4.1

type LabelMergeHandlerConfig interface{}

LabelMergeHandlerConfig must be label merge handler config. but cannot be checked because of cyclic package dependencies.

type LabelOption

type LabelOption interface {
	ApplyToLabel(l *Label) error
}

func WithMerging added in v0.4.1

func WithMerging(algo string, cfg LabelMergeHandlerConfig) LabelOption

func WithSigning

func WithSigning(b ...bool) LabelOption

func WithVersion

func WithVersion(v string) LabelOption

type Labels

type Labels []Label

Labels describe a list of labels +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*Labels) AsMap

func (l *Labels) AsMap() map[string]interface{}

AsMap return an unmarshalled map representation.

func (*Labels) Clear added in v0.4.1

func (l *Labels) Clear()

func (Labels) Copy

func (l Labels) Copy() Labels

Copy copies labels.

func (Labels) DeepCopy added in v0.3.0

func (in Labels) DeepCopy() Labels

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Labels.

func (Labels) DeepCopyInto added in v0.3.0

func (in Labels) DeepCopyInto(out *Labels)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Labels) Equivalent added in v0.4.1

func (l Labels) Equivalent(o Labels) equivalent.EqualState

func (Labels) Get

func (l Labels) Get(name string) ([]byte, bool)

Get returns the label value with the given name as json string.

func (Labels) GetDef added in v0.4.0

func (l Labels) GetDef(name string) *Label

GetDef returns the label definition of the given label.

func (Labels) GetIndex added in v0.4.0

func (l Labels) GetIndex(name string) int

GetIndex returns the index of the given label or -1 if not found.

func (Labels) GetValue

func (l Labels) GetValue(name string, dest interface{}) (bool, error)

GetValue returns the label value with the given name as parsed object.

func (*Labels) Remove

func (l *Labels) Remove(name string) bool

func (*Labels) Set

func (l *Labels) Set(name string, value interface{}, opts ...LabelOption) error

Set sets or modifies a label including its meta data.

func (*Labels) SetDef added in v0.4.1

func (l *Labels) SetDef(name string, value *Label)

SetDef ets a label definition.

func (*Labels) SetOptions added in v0.4.1

func (l *Labels) SetOptions(name string, opts ...LabelOption) error

Set sets or modifies the label meta data.

func (*Labels) SetValue added in v0.4.0

func (l *Labels) SetValue(name string, value interface{}) error

SetValue sets or modifies the value of a label, the label metadata is not touched.

type MergeAlgorithmSpecification added in v0.4.1

type MergeAlgorithmSpecification struct {
	// Algorithm optionally described the Merge algorithm used to
	// merge the label value during a transfer.
	Algorithm string `json:"algorithm"`
	// eConfig contains optional config for the merge algorithm.
	Config json.RawMessage `json:"config,omitempty"`
}

func NewMergeAlgorithmSpecification added in v0.4.1

func NewMergeAlgorithmSpecification(algo string, spec interface{}) (*MergeAlgorithmSpecification, error)

func (*MergeAlgorithmSpecification) Description added in v0.4.1

func (s *MergeAlgorithmSpecification) Description() string

type Metadata

type Metadata struct {
	// Version is the schema version of the component descriptor.
	Version string `json:"schemaVersion"`
}

Metadata defines the metadata of the component descriptor. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*Metadata) DeepCopy added in v0.3.0

func (in *Metadata) DeepCopy() *Metadata

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata.

func (*Metadata) DeepCopyInto added in v0.3.0

func (in *Metadata) DeepCopyInto(out *Metadata)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NestedComponentDigests added in v0.3.0

type NestedComponentDigests struct {
	Name      string          `json:"name"`
	Version   string          `json:"version"`
	Digest    *DigestSpec     `json:"digest,omitempty"`
	Resources ArtefactDigests `json:"resourceDigests,omitempty"`
}

NestedComponentDigests defines nested components. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*NestedComponentDigests) Copy added in v0.3.0

func (*NestedComponentDigests) DeepCopy added in v0.3.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NestedComponentDigests.

func (*NestedComponentDigests) DeepCopyInto added in v0.3.0

func (in *NestedComponentDigests) DeepCopyInto(out *NestedComponentDigests)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NestedComponentDigests) Lookup added in v0.3.0

func (d *NestedComponentDigests) Lookup(name, version string, extra Identity) *ArtefactDigest

func (*NestedComponentDigests) String added in v0.3.0

func (d *NestedComponentDigests) String() string

type NestedDigests added in v0.3.0

type NestedDigests []NestedComponentDigests

NestedDigests defines a list of nested components. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (NestedDigests) Copy added in v0.3.0

func (d NestedDigests) Copy() NestedDigests

func (NestedDigests) DeepCopy added in v0.3.0

func (in NestedDigests) DeepCopy() NestedDigests

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NestedDigests.

func (NestedDigests) DeepCopyInto added in v0.3.0

func (in NestedDigests) DeepCopyInto(out *NestedDigests)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (NestedDigests) Lookup added in v0.3.0

func (d NestedDigests) Lookup(name, version string) *NestedComponentDigests

func (NestedDigests) String added in v0.3.0

func (d NestedDigests) String() string

type ObjectMeta

type ObjectMeta struct {
	// Name is the name of the component.
	Name string `json:"name"`
	// Version is the version of the component.
	Version string `json:"version"`
	// Labels describe additional properties of the component version
	Labels Labels `json:"labels,omitempty"`
	// Provider described the component provider
	Provider Provider `json:"provider"`
	// CreationTime is the creation time of component version
	// +optional
	CreationTime *Timestamp `json:"creationTime,omitempty"`
}

ObjectMeta defines the metadata of the component descriptor.

func (*ObjectMeta) Copy

func (o *ObjectMeta) Copy() *ObjectMeta

GetName returns the name of the object.

func (*ObjectMeta) Equal added in v0.4.1

func (o *ObjectMeta) Equal(obj interface{}) bool

func (ObjectMeta) Equivalent added in v0.4.1

func (o ObjectMeta) Equivalent(a ObjectMeta) equivalent.EqualState

func (ObjectMeta) GetLabels

func (o ObjectMeta) GetLabels() Labels

GetLabels returns the label of the object.

func (*ObjectMeta) GetName

func (o *ObjectMeta) GetName() string

GetName returns the name of the object.

func (ObjectMeta) GetVersion

func (o ObjectMeta) GetVersion() string

GetVersion returns the version of the object.

func (*ObjectMeta) SetLabels

func (o *ObjectMeta) SetLabels(labels []Label)

SetLabels sets the labels of the object.

func (*ObjectMeta) SetName

func (o *ObjectMeta) SetName(name string)

SetName sets the name of the object.

func (*ObjectMeta) SetVersion

func (o *ObjectMeta) SetVersion(version string)

SetVersion sets the version of the object.

type Provider

type Provider struct {
	Name ProviderName `json:"name"`
	// Labels describe additional properties of provider
	Labels Labels `json:"labels,omitempty"`
}

Provider describes the provider information of a component version.

func (*Provider) Copy

func (o *Provider) Copy() *Provider

Copy copies the provider info.

func (Provider) Equivalent added in v0.4.1

func (o Provider) Equivalent(a Provider) equivalent.EqualState

func (Provider) GetLabels

func (o Provider) GetLabels() Labels

GetLabels returns the label of the provider.

func (Provider) GetName

func (o Provider) GetName() ProviderName

GetName returns the name of the provider.

func (*Provider) SetLabels

func (o *Provider) SetLabels(labels []Label)

SetLabels sets the labels of the provider.

func (*Provider) SetName

func (o *Provider) SetName(name ProviderName)

SetName sets the name of the provider.

type ProviderName

type ProviderName string

ProviderName describes the provider type of component in the origin's context. Defines whether the component is created by a third party or internally. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

type ResourceReference

type ResourceReference struct {
	Resource      Identity   `json:"resource,omitempty"`
	ReferencePath []Identity `json:"referencePath,omitempty"`
}

ResourceReference describes re resource identity relative to an (aggregation) component version.

func NewNestedResourceRef

func NewNestedResourceRef(id Identity, path []Identity) ResourceReference

func NewResourceRef

func NewResourceRef(id Identity) ResourceReference

func (*ResourceReference) String

func (r *ResourceReference) String() string

type ResourceRelation

type ResourceRelation string

ResourceRelation describes the type of a resource. Defines whether the component is created by a third party or internally. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

const (
	// LocalRelation defines a internal relation
	// which describes a internally maintained resource in the origin's context.
	LocalRelation ResourceRelation = "local"
	// ExternalRelation defines a external relation
	// which describes a resource maintained by a third party vendor in the origin's context.
	ExternalRelation ResourceRelation = "external"
)

type Signature

type Signature struct {
	Name      string         `json:"name"`
	Digest    DigestSpec     `json:"digest"`
	Signature SignatureSpec  `json:"signature"`
	Timestamp *TimestampSpec `json:"timestamp,omitempty"`
}

Signature defines a digest and corresponding signature, identifiable by name. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*Signature) ConvertToSigning

func (s *Signature) ConvertToSigning() *signing.Signature

ConvertToSigning converts a cd signature to a signing signature.

func (*Signature) Copy

func (s *Signature) Copy() *Signature

Copy provides a copy of the signature data.

func (*Signature) DeepCopy added in v0.3.0

func (in *Signature) DeepCopy() *Signature

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Signature.

func (*Signature) DeepCopyInto added in v0.3.0

func (in *Signature) DeepCopyInto(out *Signature)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SignatureSpec

type SignatureSpec struct {
	Algorithm string `json:"algorithm"`
	Value     string `json:"value"`
	MediaType string `json:"mediaType"`
	Issuer    string `json:"issuer,omitempty"`
}

SignatureSpec defines a signature. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func SignatureSpecFor added in v0.4.1

func SignatureSpecFor(s *signing.Signature) *SignatureSpec

func (*SignatureSpec) ConvertToSigning added in v0.4.1

func (s *SignatureSpec) ConvertToSigning() *signing.Signature

ConvertToSigning converts a cd signature to a signing signature.

func (*SignatureSpec) DeepCopy added in v0.3.0

func (in *SignatureSpec) DeepCopy() *SignatureSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SignatureSpec.

func (*SignatureSpec) DeepCopyInto added in v0.3.0

func (in *SignatureSpec) DeepCopyInto(out *SignatureSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Signatures

type Signatures []Signature

Signatures is a list of signatures.

func (Signatures) Copy

func (s Signatures) Copy() Signatures

func (Signatures) Equivalent added in v0.4.1

func (s Signatures) Equivalent(o Signatures) equivalent.EqualState

func (Signatures) Get

func (s Signatures) Get(i int) *Signature

func (Signatures) GetByName added in v0.4.1

func (s Signatures) GetByName(name string) *Signature

func (Signatures) GetIndex added in v0.4.1

func (s Signatures) GetIndex(name string) int

func (Signatures) Len

func (s Signatures) Len() int

func (*Signatures) Set added in v0.4.1

func (s *Signatures) Set(sig Signature)

type StringMap

type StringMap map[string]string

func (StringMap) Copy

func (l StringMap) Copy() StringMap

Copy copies map.

type Timestamp

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

Timestamp is time rounded to seconds. +k8s:deepcopy-gen=true

func NewTimestamp

func NewTimestamp() Timestamp

func NewTimestampFor

func NewTimestampFor(t time.Time) Timestamp

func NewTimestampP

func NewTimestampP() *Timestamp

func NewTimestampPFor added in v0.4.1

func NewTimestampPFor(t time.Time) *Timestamp

func (*Timestamp) Add

func (t *Timestamp) Add(d time.Duration) Timestamp

func (*Timestamp) DeepCopy added in v0.3.0

func (in *Timestamp) DeepCopy() *Timestamp

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timestamp.

func (*Timestamp) DeepCopyInto added in v0.3.0

func (in *Timestamp) DeepCopyInto(out *Timestamp)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Timestamp) Equal

func (t *Timestamp) Equal(o Timestamp) bool

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The time is a quoted string in RFC 3339 format, with sub-second precision added if present.

func (Timestamp) String added in v0.4.1

func (t Timestamp) String() string

func (*Timestamp) Time

func (t *Timestamp) Time() time.Time

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in RFC 3339 format.

type TimestampSpec added in v0.6.0

type TimestampSpec struct {
	// Value contains the PEM encoded TSA value.
	Value string     `json:"value"`
	Time  *Timestamp `json:"time,omitempty"`
}

TimestampSpec provides a timestamp and the appropriate pem encoded TSA value. +k8s:deepcopy-gen=true +k8s:openapi-gen=true

func (*TimestampSpec) DeepCopy added in v0.6.0

func (in *TimestampSpec) DeepCopy() *TimestampSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimestampSpec.

func (*TimestampSpec) DeepCopyInto added in v0.6.0

func (in *TimestampSpec) DeepCopyInto(out *TimestampSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TypeMeta

type TypeMeta struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
}

TypeMeta describes the schema of a descriptor.

Jump to

Keyboard shortcuts

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