catalog

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetChecker

type AssetChecker interface {
	// Verify that the content in the asset as expected.
	CheckContent([]byte) error
}

type FSCatalog

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

FSCatalog is an implementation of the Catalog interface. It is responsible for fetching assets held by a Private CA from the local filesystem.

func NewFSCatalog

func NewFSCatalog(uri uriapi.FSURI, alias string, checker AssetChecker) *FSCatalog

func (*FSCatalog) Fetch

func (f *FSCatalog) Fetch(ctx context.Context) ([]byte, error)

Use the os package to open the file with the provided file path and return the content of the file as a byte slice.

func (*FSCatalog) WithLogger

func (f *FSCatalog) WithLogger(l Logger) *FSCatalog

type FetchError

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

FetchError is used to represent an error that occurs when fetching a data fails.

func (FetchError) Error

func (e FetchError) Error() string

type GitHubCatalog

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

GitHubCatalog is an implementation of the Catalog interface. It is responsible for fetching assets held by a Private CA from a GitHub repository. It uses the GitHub Get Repository Content API for this purpose.

func NewGitHubCatalog

func NewGitHubCatalog(uri uriapi.GitHubURI, alias string, checker AssetChecker) *GitHubCatalog

func (*GitHubCatalog) Fetch

func (g *GitHubCatalog) Fetch(ctx context.Context) ([]byte, error)

The Fetch function utilizes the Get repository content API in GitHub. It requires the usage of an environment variable called "GITHUB_TOKEN" to authorize the request. The function then returns the content of the file as a byte slice.

func (*GitHubCatalog) WithLogger

func (g *GitHubCatalog) WithLogger(l Logger) *GitHubCatalog

type Logger

type Logger interface {
	// Log about provided URI.
	Log(uriText string)
}

type S3Catalog

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

S3Catalog is an implementation of the Catalog interface. It is responsible for fetching assets held by a Private CA from a AWS S3. It uses the AWS S3 GetObject API for this purpose.

func NewS3Catalog

func NewS3Catalog(uri uriapi.S3URI, alias string, checker AssetChecker) *S3Catalog

func (*S3Catalog) Fetch

func (s *S3Catalog) Fetch(ctx context.Context) ([]byte, error)

The Fetch function utilizes the GetObjcet API in AWS S3. It requires the usage of an environment variable "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY", "AWS_DEFAULT_REGION", to authorize the request. The function then returns the content of the file as a byte slice.

func (*S3Catalog) WithLogger

func (s *S3Catalog) WithLogger(l Logger) *S3Catalog

Jump to

Keyboard shortcuts

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