Documentation
¶
Index ¶
Constants ¶
const (
BlockImportFile = "import.file"
BlockImportString = "import.string"
BlockImportHTTP = "import.http"
BlockImportGit = "import.git"
)
Variables ¶
var DefaultFileArguments = FileArguments{
Type: file.DetectorFSNotify,
PollFrequency: time.Minute,
}
var DefaultGitArguments = GitArguments{
Revision: "HEAD",
PullFrequency: time.Minute,
}
var DefaultHTTPArguments = HTTPArguments{
PollFrequency: 1 * time.Minute,
PollTimeout: 10 * time.Second,
Client: common_config.DefaultHTTPClientConfig,
Method: http.MethodGet,
}
DefaultHTTPArguments holds default settings for HTTPArguments.
Functions ¶
This section is empty.
Types ¶
type FileArguments ¶
type FileArguments struct {
// Filename indicates the file to watch.
Filename string `river:"filename,attr"`
// Type indicates how to detect changes to the file.
Type file.Detector `river:"detector,attr,optional"`
// PollFrequency determines the frequency to check for changes when Type is Poll.
PollFrequency time.Duration `river:"poll_frequency,attr,optional"`
}
FileArguments holds values which are used to configure the local.file component.
type GitArguments ¶
type GitArguments struct {
Repository string `river:"repository,attr"`
Revision string `river:"revision,attr,optional"`
Path string `river:"path,attr"`
PullFrequency time.Duration `river:"pull_frequency,attr,optional"`
GitAuthConfig vcs.GitAuthConfig `river:",squash"`
}
func (*GitArguments) SetToDefault ¶
func (args *GitArguments) SetToDefault()
SetToDefault implements river.Defaulter.
type HTTPArguments ¶
type HTTPArguments struct {
URL string `river:"url,attr"`
PollFrequency time.Duration `river:"poll_frequency,attr,optional"`
PollTimeout time.Duration `river:"poll_timeout,attr,optional"`
Method string `river:"method,attr,optional"`
Headers map[string]string `river:"headers,attr,optional"`
Body string `river:"body,attr,optional"`
Client common_config.HTTPClientConfig `river:"client,block,optional"`
}
HTTPArguments holds values which are used to configure the remote.http component.
func (*HTTPArguments) SetToDefault ¶
func (args *HTTPArguments) SetToDefault()
SetToDefault implements river.Defaulter.
type ImportFile ¶
type ImportFile struct {
// contains filtered or unexported fields
}
ImportFile imports a module from a file via the local.file component.
func NewImportFile ¶
func NewImportFile(managedOpts component.Options, eval *vm.Evaluator, onContentChange func(string)) *ImportFile
func (*ImportFile) CurrentHealth ¶
func (im *ImportFile) CurrentHealth() component.Health
CurrentHealth returns the health of the file component.
type ImportGit ¶
type ImportGit struct {
// contains filtered or unexported fields
}
ImportGit imports a module from a git repository. There are currently no remote.git component, the logic is implemented here.
func NewImportGit ¶
func NewImportGit(managedOpts component.Options, eval *vm.Evaluator, onContentChange func(string)) *ImportGit
func (*ImportGit) CurrentHealth ¶
func (im *ImportGit) CurrentHealth() component.Health
CurrentHealth implements component.HealthComponent.
func (*ImportGit) Update ¶
func (im *ImportGit) Update(args component.Arguments) (err error)
Update implements component.Component. Only acknowledge the error from Update if it's not a vcs.UpdateFailedError; vcs.UpdateFailedError means that the Git repo exists, but we were unable to update it. It makes sense to retry on the next poll and it may succeed.
type ImportHTTP ¶
type ImportHTTP struct {
// contains filtered or unexported fields
}
ImportHTTP imports a module from a HTTP server via the remote.http component.
func NewImportHTTP ¶
func NewImportHTTP(managedOpts component.Options, eval *vm.Evaluator, onContentChange func(string)) *ImportHTTP
func (*ImportHTTP) CurrentHealth ¶
func (im *ImportHTTP) CurrentHealth() component.Health
type ImportSource ¶
type ImportSource interface {
// Evaluate updates the arguments provided via the River block.
Evaluate(scope *vm.Scope) error
// Run the underlying source to be updated when the content changes.
Run(ctx context.Context) error
// CurrentHealth returns the current Health status of the running source.
CurrentHealth() component.Health
}
ImportSource retrieves a module from a source.
func NewImportSource ¶
func NewImportSource(sourceType SourceType, managedOpts component.Options, eval *vm.Evaluator, onContentChange func(string)) ImportSource
NewImportSource creates a new ImportSource depending on the type. onContentChange is used by the source when it receives new content.
type ImportString ¶
type ImportString struct {
// contains filtered or unexported fields
}
ImportString imports a module from a string.
func NewImportString ¶
func NewImportString(eval *vm.Evaluator, onContentChange func(string)) *ImportString
func (*ImportString) CurrentHealth ¶
func (im *ImportString) CurrentHealth() component.Health
ImportString is always healthy
type SourceType ¶
type SourceType int
const (
File SourceType = iota
String
Git
HTTP
)
func GetSourceType ¶
func GetSourceType(fullName string) SourceType
GetSourceType returns a SourceType matching a source name.