vcs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string            `alloy:"username,attr"`
	Password alloytypes.Secret `alloy:"password,attr"`
}

func (*BasicAuth) Convert

func (b *BasicAuth) Convert() (t transport.AuthMethod)

Convert converts our type to the native prometheus type

type DownloadFailedError

type DownloadFailedError struct {
	Repository string
	Inner      error
}

DownloadFailedError represents a failure to download a repository.

func (DownloadFailedError) Error

func (err DownloadFailedError) Error() string

Error returns the error string, denoting the failed repository.

func (DownloadFailedError) Unwrap

func (err DownloadFailedError) Unwrap() error

Unwrap returns the inner error. It returns nil if there is no inner error.

type GitAuthConfig

type GitAuthConfig struct {
	BasicAuth *BasicAuth `alloy:"basic_auth,block,optional"`
	SSHKey    *SSHKey    `alloy:"ssh_key,block,optional"`
}

func (*GitAuthConfig) Convert

func (h *GitAuthConfig) Convert() transport.AuthMethod

Convert converts HTTPClientConfig to the native Prometheus type. If h is nil, the default client config is returned.

type GitRepo

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

GitRepo manages a Git repository for the purposes of retrieving a file from it.

func NewGitRepo

func NewGitRepo(ctx context.Context, storagePath string, opts GitRepoOptions) (*GitRepo, error)

NewGitRepo creates a new instance of a GitRepo, where the Git repository is managed at storagePath.

If storagePath is empty on disk, NewGitRepo initializes GitRepo by cloning the repository. Otherwise, NewGitRepo will do a pull.

After GitRepo is initialized, it checks out to the Revision specified in GitRepoOptions.

func (*GitRepo) CurrentRevision

func (repo *GitRepo) CurrentRevision() (string, error)

CurrentRevision returns the current revision of the repository (by SHA).

func (*GitRepo) ReadDir

func (repo *GitRepo) ReadDir(path string) ([]fs.FileInfo, error)

ReadDir returns info about the content of the directory in the repository.

func (*GitRepo) ReadFile

func (repo *GitRepo) ReadFile(path string) ([]byte, error)

ReadFile returns a file from the repository specified by path.

func (*GitRepo) Stat

func (repo *GitRepo) Stat(path string) (fs.FileInfo, error)

Stat returns info from the repository specified by path.

func (*GitRepo) Update

func (repo *GitRepo) Update(ctx context.Context) error

Update updates the repository by pulling new content and re-checking out to latest version of Revision.

type GitRepoOptions

type GitRepoOptions struct {
	Repository string
	Revision   string
	Auth       GitAuthConfig
}

type InvalidRevisionError

type InvalidRevisionError struct {
	Revision string
}

InvalidRevisionError represents an invalid revision.

func (InvalidRevisionError) Error

func (err InvalidRevisionError) Error() string

Error returns the error string, denoting the invalid revision.

type SSHKey

type SSHKey struct {
	Username   string            `alloy:"username,attr"`
	Key        alloytypes.Secret `alloy:"key,attr,optional"`
	Keyfile    string            `alloy:"key_file,attr,optional"`
	Passphrase alloytypes.Secret `alloy:"passphrase,attr,optional"`
}

func (*SSHKey) Convert

func (s *SSHKey) Convert() (transport.AuthMethod, error)

Convert converts our type to the native prometheus type

type UpdateFailedError

type UpdateFailedError struct {
	Repository string
	Inner      error
}

UpdateFailedError represents a failure to update a repository.

func (UpdateFailedError) Error

func (err UpdateFailedError) Error() string

Error returns the error string, denoting the failed repository.

func (UpdateFailedError) Unwrap

func (err UpdateFailedError) Unwrap() error

Unwrap returns the inner error. It returns nil if there is no inner error.

Jump to

Keyboard shortcuts

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