registry

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package registry is a generated GoMock package.

nolint: staticcheck

Index

Constants

View Source
const (
	DefaultOrganization = "cloudquery"
)
View Source
const LatestVersion = "latest"

Variables

This section is empty.

Functions

func GetBinarySuffix

func GetBinarySuffix() string

func ParseProviderName added in v0.13.4

func ParseProviderName(name string) (org string, providerName string, err error)

ParseProviderName parses a name of a provider which can be just a name or a name + organization For example aws <-> cloudquery/aws will download the cq-provider-aws in cloudquery organization The organization defaults to cloudquery, if you want to download from a different repo set the name <your_org_name>/<provider_name>

func ProviderRepoName added in v0.20.2

func ProviderRepoName(name string) string

ProviderRepoName returns a repository name for a given provider name.

Types

type Hub

type Hub struct {
	// Optional: Where to save downloaded providers, by default current working directory, defaults to ./cq/providers
	PluginDirectory string
	// Optional: Download propagator allows the creator to get called back on download progress and completion.
	ProgressUpdater ui.Progress
	// contains filtered or unexported fields
}

func NewRegistryHub

func NewRegistryHub(url string, opts ...Option) *Hub

func (Hub) CheckUpdate added in v0.23.0

func (Hub) CheckUpdate(ctx context.Context, provider Provider) (string, error)

CheckUpdate checks if there is an update available for the requested provider. Returns a new version if there is one, otherwise empty string. Call will be cancelled either if ctx is cancelled or after a timeout set by versionCheckHTTPTimeout. This function should not be called for a provider having Version set to "latest".

func (Hub) Download added in v0.23.0

func (h Hub) Download(ctx context.Context, provider Provider, noVerify bool) (ProviderBinary, error)

func (Hub) Get added in v0.23.0

func (h Hub) Get(providerName, providerVersion string) (ProviderBinary, error)

Get returns a loaded provider from the hub without downloading it again, returns an error if not found.

type MockRegistry added in v0.23.0

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

MockRegistry is a mock of Registry interface.

func NewMockRegistry added in v0.23.0

func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry

NewMockRegistry creates a new mock instance.

func (*MockRegistry) CheckUpdate added in v0.23.0

func (m *MockRegistry) CheckUpdate(arg0 context.Context, arg1 Provider) (string, error)

CheckUpdate mocks base method.

func (*MockRegistry) Download added in v0.23.0

func (m *MockRegistry) Download(arg0 context.Context, arg1 Provider, arg2 bool) (ProviderBinary, error)

Download mocks base method.

func (*MockRegistry) EXPECT added in v0.23.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRegistry) Get added in v0.23.0

func (m *MockRegistry) Get(arg0, arg1 string) (ProviderBinary, error)

Get mocks base method.

type MockRegistryMockRecorder added in v0.23.0

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

MockRegistryMockRecorder is the mock recorder for MockRegistry.

func (*MockRegistryMockRecorder) CheckUpdate added in v0.23.0

func (mr *MockRegistryMockRecorder) CheckUpdate(arg0, arg1 interface{}) *gomock.Call

CheckUpdate indicates an expected call of CheckUpdate.

func (*MockRegistryMockRecorder) Download added in v0.23.0

func (mr *MockRegistryMockRecorder) Download(arg0, arg1, arg2 interface{}) *gomock.Call

Download indicates an expected call of Download.

func (*MockRegistryMockRecorder) Get added in v0.23.0

func (mr *MockRegistryMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

type Option

type Option func(h *Hub)

func WithPluginDirectory added in v0.23.0

func WithPluginDirectory(d string) Option

func WithProgress added in v0.23.0

func WithProgress(u ui.Progress) Option

type Provider added in v0.23.0

type Provider struct {
	// Name of the provider
	Name string
	// Version of the provider we want to download
	Version string
	// Source from where we want to download the provider from
	Source string
}

func (Provider) String added in v0.23.0

func (p Provider) String() string

type ProviderBinary added in v0.23.0

type ProviderBinary struct {
	Provider
	FilePath string
}

type Providers added in v0.23.0

type Providers []Provider

func (Providers) Get added in v0.23.0

func (pp Providers) Get(name string) (Provider, bool)

func (Providers) GetMany added in v0.23.0

func (pp Providers) GetMany(names ...string) []Provider

func (Providers) String added in v0.23.0

func (pp Providers) String() string

type Registry

type Registry interface {
	// Get returns a loaded provider from the hub without downloading it again, returns an error if not found
	Get(providerName, providerVersion string) (ProviderBinary, error)
	// CheckUpdate checks if there is an update available for the requested provider.
	CheckUpdate(ctx context.Context, provider Provider) (string, error)
	// Download downloads a single provider from remote source.
	Download(ctx context.Context, provider Provider, noVerify bool) (ProviderBinary, error)
}

Jump to

Keyboard shortcuts

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