stubrepo

package
v0.0.0-...-b228686 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentSrcBytes

func ContentSrcBytes(label string, content []byte) func() (_body io.ReadCloser, _length int64, _err error)

func ContentSrcString

func ContentSrcString(label, content string) func() (_body io.ReadCloser, _length int64, _err error)

func DigestSha256

func DigestSha256(content io.Reader) (string, error)

func FreeLocalhostTcp4Port

func FreeLocalhostTcp4Port() (int, error)

func ImageRepoDirRelUrlSegments

func ImageRepoDirRelUrlSegments(platform *saya.Platform, name string, version string) []string

func ImageRepoRelUrlSegments

func ImageRepoRelUrlSegments(
	baseDirSegs []string, platform *saya.Platform,
	name string, version string, imgType string,
) ([]string, error)

func ImgFileName

func ImgFileName(imgType string) (string, error)

func LoadConfig

func LoadConfig(
	ctx context.Context,
	endpointSpec *AwsEndpointSpec, credentialsSpec *aws.Credentials, region string,
) (cfg *aws.Config, err error)

func NewS3Client

func NewS3Client(
	endpointSpec *AwsEndpointSpec, credentialsSpec *aws.Credentials, region string,
) (*s3.Client, error)

func PersistImgMeta

func PersistImgMeta(target io.Writer, imgMeta *saya.ImageTagMetaData) error

func StubLogCtx

func StubLogCtx() context.Context

func TransferToS3

func TransferToS3(ctx context.Context, ftSpec *S3FilesTransferSpec) error

func WithStubLogCtxLevel

func WithStubLogCtxLevel(level string)

Types

type AwsEndpointSpec

type AwsEndpointSpec struct {
	// default endpoint url
	Url string //revive:disable-line:var-naming
	// endpoint url to use when interaction with s3 service
	S3Url string //revive:disable-line:var-naming
	// endpoint url to use when interacting with the ec2 service
	Ec2Url string //revive:disable-line:var-naming
}

type DummyImg

type DummyImg struct {
	BasicAuth *saya.AuthHttpBasic
	UrlPath   string
	// contains filtered or unexported fields
}

func NewDummyImg

func NewDummyImg(
	img []byte, withMeta bool,
	pullSpecData PullImgSpecData,
	basicAuth *saya.AuthHttpBasic,
) (*DummyImg, error)

func (*DummyImg) MetaDataAsBytes

func (img *DummyImg) MetaDataAsBytes() ([]byte, error)

type HttpRepo

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

func NewDummyHttpRepo

func NewDummyHttpRepo() *HttpRepo

func (*HttpRepo) AsRepos

func (repo *HttpRepo) AsRepos() *saya.Repos

func (*HttpRepo) Close

func (repo *HttpRepo) Close() error

func (*HttpRepo) GetData

func (repo *HttpRepo) GetData(ginCtx *gin.Context)

func (*HttpRepo) NoRoot

func (repo *HttpRepo) NoRoot(ginCtx *gin.Context)

func (*HttpRepo) RegisterDummyImg

func (repo *HttpRepo) RegisterDummyImg(img *DummyImg) error

func (*HttpRepo) RepoContent

func (repo *HttpRepo) RepoContent() map[string]string

func (*HttpRepo) RepoUrl

func (repo *HttpRepo) RepoUrl(relPath string) string

func (*HttpRepo) Start

func (repo *HttpRepo) Start() error

type ImgInRepo

type ImgInRepo struct {
	Img    DummyImg
	Sha256 string
	Repos  *saya.Repos
}

func GivenImgInRemoteRepo

func GivenImgInRemoteRepo(
	imgRegisterer func(*DummyImg) error,
	remoteImg *DummyImg,
) (*ImgInRepo, error)

func GivenImgInRemoteRepoBySpec

func GivenImgInRemoteRepoBySpec(
	imgRegisterer func(*DummyImg) error,
	specData PullImgSpecData, metaInRemoteRepo bool,
) (*ImgInRepo, error)

func (*ImgInRepo) HasHttpRepo

func (r *ImgInRepo) HasHttpRepo() bool

func (*ImgInRepo) HasS3Repo

func (r *ImgInRepo) HasS3Repo() bool

func (*ImgInRepo) HasS3RepoCredentials

func (r *ImgInRepo) HasS3RepoCredentials() bool

type ImgRegisterer

type ImgRegisterer interface {
	RegisterDummyImg(img *DummyImg) error
}

type PullImgSpecData

type PullImgSpecData struct {
	Tag       saya.Reference
	Hash      string
	OsVariant string
	Platform  saya.Platform
	RepoType  string
	ImgType   string
}

type RemoteRepos

type RemoteRepos struct {
	Http *HttpRepo
	S3   *RepoS3
}

func (*RemoteRepos) Close

func (drs *RemoteRepos) Close() error

func (*RemoteRepos) GivenHttpRepoStarted

func (drs *RemoteRepos) GivenHttpRepoStarted() error

func (*RemoteRepos) GivenS3RepoStarted

func (drs *RemoteRepos) GivenS3RepoStarted() error

type RepoS3

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

func (*RepoS3) AsRepos

func (repo *RepoS3) AsRepos() *saya.Repos

func (*RepoS3) Close

func (repo *RepoS3) Close() error

func (*RepoS3) Log

func (repo *RepoS3) Log(logf func(format string, args ...any))

func (*RepoS3) RegisterDummyImg

func (repo *RepoS3) RegisterDummyImg(img *DummyImg) error

func (*RepoS3) Start

func (repo *RepoS3) Start() error

type S3FilesTransferSpec

type S3FilesTransferSpec struct {
	Endpoint    *AwsEndpointSpec
	Credentials *aws.Credentials
	Region      string
	Tx          []S3FilesTransferSpecTx
}

type S3FilesTransferSpecTx

type S3FilesTransferSpecTx struct {
	Label        string
	Bucket       string
	Key          string
	WithProgress bool
	BodyProvider func() (_body io.ReadCloser, _length int64, _err error)
}

Jump to

Keyboard shortcuts

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