repoiface

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Helm    = "helm"
	Vmbased = "vmbased"
)
View Source
const IndexYaml = "index.yaml"

Variables

View Source
var SupportedPackageType = []string{Helm, Vmbased}

Functions

func GetFileName

func GetFileName(packageName string) string

func LoadPackage added in v0.4.0

func LoadPackage(ctx context.Context, t string, pkg []byte) (wrapper.VersionInterface, error)

func URLJoin

func URLJoin(repoUrl, fileName string) string

Types

type AppVersions

type AppVersions map[string]Versions

type Err

type Err error
var (
	ErrParseUrlFailed       Err = fmt.Errorf("parse url failed")
	ErrDecodeJsonFailed     Err = fmt.Errorf("decode json failed")
	ErrEmptyAccessKeyId     Err = fmt.Errorf("access key id is empty")
	ErrEmptySecretAccessKey Err = fmt.Errorf("secret access key is empty")
	ErrSchemeNotMatched     Err = fmt.Errorf("scheme not matched")
	ErrInvalidType          Err = fmt.Errorf("invalid repo type")
	ErrWriteIsUnsupported   Err = fmt.Errorf("write is unsupported")
)

type HttpInterface

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

func NewHttpInterface

func NewHttpInterface(ctx context.Context, url *neturl.URL) (*HttpInterface, error)

func (*HttpInterface) CheckFile

func (i *HttpInterface) CheckFile(ctx context.Context, filename string) (bool, error)

func (*HttpInterface) CheckRead

func (i *HttpInterface) CheckRead(ctx context.Context) error

func (*HttpInterface) CheckWrite

func (i *HttpInterface) CheckWrite(ctx context.Context) error

func (*HttpInterface) DeleteFile

func (i *HttpInterface) DeleteFile(ctx context.Context, filename string) error

func (*HttpInterface) ReadFile

func (i *HttpInterface) ReadFile(ctx context.Context, filename string) ([]byte, error)

func (*HttpInterface) WriteFile

func (i *HttpInterface) WriteFile(ctx context.Context, filename string, data []byte) error

type Reader

type Reader struct {
	RepoInterface
	// contains filtered or unexported fields
}

func NewReader

func NewReader(ctx context.Context, r *pb.Repo) (*Reader, error)

func (*Reader) AddPackage

func (r *Reader) AddPackage(ctx context.Context, pkg []byte) error

func (*Reader) DeletePackage

func (r *Reader) DeletePackage(ctx context.Context, appName, version string) error

func (*Reader) GetAppVersions

func (r *Reader) GetAppVersions(ctx context.Context) (AppVersions, error)

func (*Reader) GetIndex added in v0.2.3

func (r *Reader) GetIndex(ctx context.Context) (wrapper.IndexInterface, error)

func (*Reader) LoadPackage

func (r *Reader) LoadPackage(ctx context.Context, pkg []byte) (wrapper.VersionInterface, error)

type RepoInterface

type RepoInterface interface {
	CheckFile(ctx context.Context, filename string) (bool, error)
	ReadFile(ctx context.Context, filename string) ([]byte, error)
	WriteFile(ctx context.Context, filename string, data []byte) error
	DeleteFile(ctx context.Context, filename string) error
	CheckRead(ctx context.Context) error
	CheckWrite(ctx context.Context) error
}

func New

func New(ctx context.Context, repoType, url, credential string) (RepoInterface, error)

type S3Credential

type S3Credential struct {
	AccessKeyId     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
}

type S3Interface

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

func NewS3Interface

func NewS3Interface(ctx context.Context, u *neturl.URL, credential string) (*S3Interface, error)

func (*S3Interface) CheckFile

func (i *S3Interface) CheckFile(ctx context.Context, filename string) (bool, error)

func (*S3Interface) CheckRead

func (i *S3Interface) CheckRead(ctx context.Context) error

func (*S3Interface) CheckWrite

func (i *S3Interface) CheckWrite(ctx context.Context) error

func (*S3Interface) DeleteFile

func (i *S3Interface) DeleteFile(ctx context.Context, filename string) error

func (*S3Interface) ReadFile

func (i *S3Interface) ReadFile(ctx context.Context, filename string) ([]byte, error)

func (*S3Interface) WriteFile

func (i *S3Interface) WriteFile(ctx context.Context, filename string, data []byte) error

type Versions

type Versions map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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