oci

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations

type Annotations map[string]string

func (Annotations) CreatedTime added in v0.13.0

func (a Annotations) CreatedTime() time.Time

func (Annotations) DocumentationURL added in v0.13.0

func (a Annotations) DocumentationURL() string

func (Annotations) Source

func (a Annotations) Source() string

func (Annotations) URL added in v0.13.0

func (a Annotations) URL() string

type AuthorizeFunc

type AuthorizeFunc func(context.Context, Reference, *http.Request) error

func (AuthorizeFunc) AuthorizeOCIRequest

func (f AuthorizeFunc) AuthorizeOCIRequest(ctx context.Context, image Reference, req *http.Request) error

type Authorizer

type Authorizer interface {
	AuthorizeOCIRequest(context.Context, Reference, *http.Request) error
}

type AuthorizerToken

type AuthorizerToken string

func (AuthorizerToken) AuthorizeOCIRequest

func (s AuthorizerToken) AuthorizeOCIRequest(ctx context.Context, image Reference, req *http.Request) error

type Client

type Client struct {
	Client     *httputil.Client
	Authorizer Authorizer
}

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(ctx context.Context, image Reference, options *GetAnnotationsOptions) (Annotations, error)

GetAnnotations tries to identify annotations for the image. Fetches manifests as necessary. To narrow down the search and to avoid unnecessary fetches, specify the available options.

func (*Client) GetBlob

func (c *Client) GetBlob(ctx context.Context, image Reference, digest string) ([]byte, error)

func (*Client) GetManifest

func (c *Client) GetManifest(ctx context.Context, image Reference, digest string) ([]byte, error)

func (*Client) GetManifests

func (c *Client) GetManifests(ctx context.Context, image Reference) ([]Manifest, error)

TODO: Rewrite to return a ManifestList / ManifestIndex instead, which then contains the manifests. That way we can differentiate with the content types of actual manifests as returned by GetManifest...

func (*Client) GetTags

func (c *Client) GetTags(ctx context.Context, image Reference, options *GetTagsOptions) ([]string, error)

func (*Client) ReadBlob

func (c *Client) ReadBlob(ctx context.Context, image Reference, digest string) (io.ReadCloser, error)

type DockerDistributionManifestListV2

type DockerDistributionManifestListV2 struct {
	// 2
	SchemaVersion int `json:"schemaVersion"`
	// application/vnd.docker.distribution.manifest.list.v2+json
	MediaType string                         `json:"mediaType"`
	Manifests []DockerDistributionManifestV2 `json:"manifests"`
}

type DockerDistributionManifestV1

type DockerDistributionManifestV1 struct {
	// 1
	SchemaVersion int    `json:"schemaVersion"`
	Name          string `json:"name"`
	Tag           string `json:"tag"`
	Architecture  string `json:"architecture"`
}

application/vnd.docker.distribution.manifest.v1+prettyjws

type DockerDistributionManifestV2

type DockerDistributionManifestV2 struct {
	// 2
	SchemaVersion int `json:"schemaVersion"`
	// application/vnd.docker.distribution.manifest.v2+json
	MediaType string `json:"mediaType"`
	Digest    string `json:"digest"`
	Platform  struct {
		Architecture string `json:"architecture"`
		OS           string `json:"os"`
		Variant      string `json:"variant"`
	} `json:"platform"`
	Size int `json:"size"`
}

type GetAnnotationsOptions

type GetAnnotationsOptions struct {
	Manifests    []Manifest
	Digest       string
	Architecture string
	OS           string
	Variant      string
}

type GetTagsOptions

type GetTagsOptions struct {
	Last     string
	Count    int
	AllPages bool
}

type Manifest

type Manifest struct {
	SchemaVersion int    `json:"schemaVersion"`
	MediaType     string `json:"mediaType"`
	// Annotations contains manifest / image annotations. Nil if none were found.
	// Note the even if annotations were found at the top level, they might not
	// match the annotations / label of the image itself.
	Annotations Annotations `json:"annotations"`
	Digest      string      `json:"digest"`
	Platform    *Platform   `json:"platform,omitempty"`
}

type OCIImageIndexV1

type OCIImageIndexV1 struct {
	// 2
	SchemaVersion int `json:"schemaVersion"`
	// application/vnd.oci.image.index.v1+json
	MediaType string               `json:"mediaType"`
	Manifests []OCIImageManifestV1 `json:"manifests"`
}

type OCIImageManifestV1

type OCIImageManifestV1 struct {
	// 2
	SchemaVersion int `json:"schemaVersion"`
	// application/vnd.oci.image.manifest.v1+json
	MediaType   string            `json:"mediaType"`
	Annotations map[string]string `json:"annotations"`
	Digest      string            `json:"digest"`
	Platform    struct {
		Architecture string `json:"architecture"`
		OS           string `json:"os"`
		Variant      string `json:"variant"`
	} `json:"platform"`
}

type Platform

type Platform struct {
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
	Variant      string `json:"variant"`
}

type Reference

type Reference struct {
	Domain string
	Path   string

	HasTag bool
	Tag    string

	HasDigest bool
	Digest    string
}

func ParseReference

func ParseReference(v string) (Reference, error)

func (Reference) Canonical

func (r Reference) Canonical() Reference

func (Reference) MarshalJSON

func (r Reference) MarshalJSON() ([]byte, error)

func (Reference) Name

func (r Reference) Name() string

func (Reference) String

func (r Reference) String() string

func (*Reference) UnmarshalJSON

func (r *Reference) UnmarshalJSON(b []byte) error

func (Reference) Version

func (r Reference) Version() string

Version is the familiar version of the reference, such as its tag, digest or "latest", if no tag or digest is specified.

type TagsPage

type TagsPage struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

Jump to

Keyboard shortcuts

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