fakes

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessOptionFunc

type AccessOptionFunc func(map[string]any)

AccessOptionFunc modifies the resource's access settings.

func SetAccessRef

func SetAccessRef(t string) AccessOptionFunc

SetAccessRef completely overrides the globalAccess field of the resource.

func SetAccessType

func SetAccessType(t string) AccessOptionFunc

SetAccessType sets a custom access type for a resource.

type Component

type Component struct {
	ocm.ComponentVersionAccess

	Name                string
	Version             string
	Sign                *Sign
	References          map[string]ocm.ComponentReference
	Resources           []*Resource[*compdesc.ResourceMeta]
	ComponentDescriptor *compdesc.ComponentDescriptor
	// contains filtered or unexported fields
}

Component presents a simple layout for a component. If `Sign` is not empty, it's used to sign the component. It should be the byte representation of a private key. This has to implement ocm.ComponentVersionAccess. Add References. Right now, only resources are supported.

func (*Component) Close

func (c *Component) Close() error

func (*Component) Dup

func (*Component) GetContext

func (c *Component) GetContext() ocm.Context

func (*Component) GetDescriptor

func (c *Component) GetDescriptor() *compdesc.ComponentDescriptor

func (*Component) GetName

func (c *Component) GetName() string

func (*Component) GetReference added in v0.21.5

func (c *Component) GetReference(identity ocmmetav1.Identity) (ocm.ComponentReference, error)

func (*Component) GetResource

func (c *Component) GetResource(meta ocmmetav1.Identity) (ocm.ResourceAccess, error)

func (*Component) GetResources

func (c *Component) GetResources() []ocm.ResourceAccess

func (*Component) GetVersion

func (c *Component) GetVersion() string

func (*Component) Repository

func (c *Component) Repository() ocm.Repository

func (*Component) Update added in v0.19.0

func (c *Component) Update() error

type Context

type Context struct {
	// Make sure our context is compliant with ocm.Context. Implemented methods will be added on a need-to basis.
	ocm.Context
	// contains filtered or unexported fields
}

Context defines a mock OCM context.

func NewFakeOCMContext

func NewFakeOCMContext() *Context

NewFakeOCMContext creates a new fake OCM context.

func (*Context) AccessSpecForSpec added in v0.14.0

func (c *Context) AccessSpecForSpec(spec compdesc.AccessSpec) (ocm.AccessSpec, error)

func (*Context) AddComponent

func (c *Context) AddComponent(component *Component) error

func (*Context) AttributesContext added in v0.19.0

func (c *Context) AttributesContext() datacontext.AttributesContext

func (*Context) BlobDigesters

func (c *Context) BlobDigesters() ocm.BlobDigesterRegistry

func (*Context) Close

func (c *Context) Close() error

func (*Context) CredentialsContext

func (c *Context) CredentialsContext() credentials.Context

func (*Context) GetAttributes

func (c *Context) GetAttributes() datacontext.Attributes

func (*Context) GetContext

func (c *Context) GetContext() ocm.Context

func (*Context) IsAttributesContext added in v0.19.0

func (c *Context) IsAttributesContext() bool

func (*Context) LoggingContext

func (c *Context) LoggingContext() logging.Context

func (*Context) OCMContext added in v0.19.0

func (c *Context) OCMContext() ocm.Context

func (*Context) RepositoryForSpec

func (c *Context) RepositoryForSpec(
	_ ocm.RepositorySpec,
	_ ...credentials.CredentialsSource,
) (ocm.Repository, error)

type Resource

type Resource[M any] struct {
	Name     string
	Labels   ocmmetav1.Labels
	Version  string
	Data     []byte
	Kind     string
	Type     string
	Relation ocmmetav1.ResourceRelation

	// The component that contains this resource. This is a backlink in OCM.
	Component *Component

	// AccessOptions to modify the access of the resource.
	AccessOptions []AccessOptionFunc
}

Resource presents a simple layout for a resource that AddComponentVersionToRepository will use.

func (*Resource[M]) Access

func (r *Resource[M]) Access() (ocm.AccessSpec, error)

Access provides some canned settings. This will later on by made configurable as is in getComponentMock.

func (*Resource[M]) AccessMethod

func (r *Resource[M]) AccessMethod() (ocm.AccessMethod, error)

AccessMethod implementation for this is provided by the resource itself to avoid even further indirections.

func (*Resource[M]) AccessSpec

func (r *Resource[M]) AccessSpec() ocm.AccessSpec

func (*Resource[M]) AsBlobAccess added in v0.19.0

func (r *Resource[M]) AsBlobAccess() ocm.BlobAccess

func (*Resource[M]) BlobAccess added in v0.19.0

func (r *Resource[M]) BlobAccess() (ocm.BlobAccess, error)

func (*Resource[M]) Close

func (r *Resource[M]) Close() error

func (*Resource[M]) ComponentVersion

func (r *Resource[M]) ComponentVersion() ocm.ComponentVersionAccess

func (*Resource[M]) Dup added in v0.19.0

func (r *Resource[M]) Dup() (ocm.AccessMethod, error)

func (*Resource[M]) Get

func (r *Resource[M]) Get() ([]byte, error)

func (*Resource[M]) GetComponentVersion added in v0.19.0

func (r *Resource[M]) GetComponentVersion() (ocm.ComponentVersionAccess, error)

func (*Resource[M]) GetKind

func (r *Resource[M]) GetKind() string

func (*Resource[M]) GetOCMContext added in v0.19.0

func (r *Resource[M]) GetOCMContext() ocm.Context

func (*Resource[M]) GlobalAccess added in v0.19.0

func (r *Resource[M]) GlobalAccess() ocm.AccessSpec

func (*Resource[M]) IsLocal added in v0.19.0

func (r *Resource[M]) IsLocal() bool

func (*Resource[M]) Meta

func (r *Resource[M]) Meta() *ocm.ResourceMeta

func (*Resource[M]) MimeType

func (r *Resource[M]) MimeType() string

func (*Resource[M]) Reader

func (r *Resource[M]) Reader() (io.ReadCloser, error)

func (*Resource[M]) ReferenceHint added in v0.19.0

func (r *Resource[M]) ReferenceHint() string

type Sign

type Sign struct {
	Name    string
	PubKey  []byte
	PrivKey []byte
	Digest  string
}

Sign defines the two needed values to perform a component signing.

Jump to

Keyboard shortcuts

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