fakes

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 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
	Resources           []*Resource
	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) 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

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) AddComponent

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

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) LoggingContext

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

func (*Context) RepositoryForSpec

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

type Resource

type Resource struct {
	Name     string
	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) Access

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

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

func (*Resource) AccessMethod

func (r *Resource) AccessMethod() (ocm.AccessMethod, error)

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

func (*Resource) AccessSpec

func (r *Resource) AccessSpec() ocm.AccessSpec

func (*Resource) Close

func (r *Resource) Close() error

func (*Resource) ComponentVersion

func (r *Resource) ComponentVersion() ocm.ComponentVersionAccess

func (*Resource) Get

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

func (*Resource) GetKind

func (r *Resource) GetKind() string

func (*Resource) Meta

func (r *Resource) Meta() *ocm.ResourceMeta

func (*Resource) MimeType

func (r *Resource) MimeType() string

func (*Resource) Reader

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

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