registry

package
v0.32.12 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MPL-2.0 Imports: 21 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

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

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

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

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

func (Hub) Get

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

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

MockRegistry is a mock of Registry interface.

func NewMockRegistry

func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry

NewMockRegistry creates a new mock instance.

func (*MockRegistry) CheckUpdate

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

CheckUpdate mocks base method.

func (*MockRegistry) Download

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

Download mocks base method.

func (*MockRegistry) EXPECT

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

func (*MockRegistry) Get

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

Get mocks base method.

type MockRegistryMockRecorder

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

MockRegistryMockRecorder is the mock recorder for MockRegistry.

func (*MockRegistryMockRecorder) CheckUpdate

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

CheckUpdate indicates an expected call of CheckUpdate.

func (*MockRegistryMockRecorder) Download

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

Download indicates an expected call of Download.

func (*MockRegistryMockRecorder) Get

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

func WithPluginDirectory(d string) Option

func WithProgress

func WithProgress(u ui.Progress) Option

type Provider

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

func (p Provider) String() string

type ProviderBinary

type ProviderBinary struct {
	Provider
	FilePath string
}

type Providers

type Providers []Provider

func (Providers) Get

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

func (Providers) GetMany

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

func (Providers) String

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