provider

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MPL-2.0 Imports: 16 Imported by: 37

Documentation

Index

Constants

View Source
const AllTableNameWildcard = "*"

AllTableNameWildcard Table name Wildcard, which matches all tables

View Source
const (
	ErrMsgNotInitRuntime = "provider runtime not init"
)

Variables

View Source
var ErrorStorageNotInit = errors.New("storage not init")

Functions

This section is empty.

Types

type ConfigMeta

type ConfigMeta struct {

	// If the Provider has a configuration file, you can use this method to return a default configuration file template that will be written to
	// You can write the value constant directly or get it from the web, but it must be a valid YAML file or it will be rejected
	GetDefaultConfigTemplate func(ctx context.Context) string

	// You can provide a function to verify the correctness of the configuration file.
	// It is highly recommended that you configure this function when working with configuration files
	Validation func(ctx context.Context, config *viper.Viper) *schema.Diagnostics
	// contains filtered or unexported fields
}

func (*ConfigMeta) Runtime

func (x *ConfigMeta) Runtime() *ConfigMetaRuntime

type ConfigMetaRuntime

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

ConfigMetaRuntime After the provider runs, the relevant configuration may be passed from the previous dynamic pass

func NewConfigRuntime

func NewConfigRuntime(ctx context.Context, myConfig *ConfigMeta, configYamlString *string) (runtime *ConfigMetaRuntime, diagnostics *schema.Diagnostics)

func (*ConfigMetaRuntime) UpdateProviderConfig added in v0.0.2

func (x *ConfigMetaRuntime) UpdateProviderConfig(ctx context.Context, configYamlString *string) (diagnostics *schema.Diagnostics)

type EventCallback

type EventCallback struct {

	// Callback method that is triggered after the installation is complete init
	AfterInstallInitEventCallback func(ctx context.Context, provider *Provider) *schema.Diagnostics

	// The callback method that is executed every time the Provider is started
	InitEventCallback func(ctx context.Context, provider *Provider) *schema.Diagnostics
}

EventCallback Provider has some event callback methods, You can register callback events to do the right thing at the right time

type Provider

type Provider struct {
	shard.ProviderServer

	// provider's name
	Name string

	// provider's version
	Version string

	// provider's description, let others know what this provider does in general
	Description string

	// A provider may have many tables. Here are the corresponding tables
	TableList []*schema.Table

	ConfigMeta ConfigMeta

	EventCallback EventCallback

	ClientMeta schema.ClientMeta

	TransformerMeta schema.TransformerMeta

	ErrorsHandlerMeta schema.ErrorsHandlerMeta
	// contains filtered or unexported fields
}

Provider To represent a source from which data can be retrieved, the Provider's implementation is to declare and configure this struct

func (*Provider) GetProviderConfig

GetProviderConfig Obtain the configuration information of the Provider, must after Init

func (*Provider) GetProviderInformation

GetProviderInformation Obtain the information about the Provider, must after Init

func (*Provider) Init

func (*Provider) PullTables

func (x *Provider) PullTables(ctx context.Context, request *shard.PullTablesRequest, sender shard.ProviderServerSender) error

PullTables Pull the given resource

func (*Provider) Runtime

func (x *Provider) Runtime() *ProviderRuntime

func (*Provider) SetProviderConfig

SetProviderConfig Set the configuration information of the Provider, must after Init

type ProviderRuntime

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

ProviderRuntime provider's runtime, most of the runtime logic is encapsulated here

func NewProviderRuntime

func NewProviderRuntime(ctx context.Context, myProvider *Provider) (runtime *ProviderRuntime, diagnostics *schema.Diagnostics)

func (*ProviderRuntime) CreateAllTables

func (x *ProviderRuntime) CreateAllTables(ctx context.Context) *schema.Diagnostics

func (*ProviderRuntime) DropAllTables

func (x *ProviderRuntime) DropAllTables(ctx context.Context) *schema.Diagnostics

DropAllTables Delete all tables of the Provider

func (*ProviderRuntime) PullTables

PullTables Pull the given resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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