Documentation ¶
Index ¶
- Constants
- Variables
- type ConfigMeta
- type ConfigMetaRuntime
- type EventCallback
- type Provider
- func (x *Provider) CreateAllTables(ctx context.Context, request *shard.ProviderCreateAllTablesRequest) (response *shard.ProviderCreateAllTablesResponse, err error)
- func (x *Provider) DropTableAll(ctx context.Context, request *shard.ProviderDropTableAllRequest) (response *shard.ProviderDropTableAllResponse, err error)
- func (x *Provider) GetProviderConfig(ctx context.Context, in *shard.GetProviderConfigRequest) (response *shard.GetProviderConfigResponse, err error)
- func (x *Provider) GetProviderInformation(ctx context.Context, in *shard.GetProviderInformationRequest) (response *shard.GetProviderInformationResponse, err error)
- func (x *Provider) Init(ctx context.Context, request *shard.ProviderInitRequest) (response *shard.ProviderInitResponse, err error)
- func (x *Provider) PullTables(ctx context.Context, request *shard.PullTablesRequest, ...) (err error)
- func (x *Provider) Runtime() *ProviderRuntime
- func (x *Provider) SetProviderConfig(ctx context.Context, request *shard.SetProviderConfigRequest) (response *shard.SetProviderConfigResponse, err error)
- type ProviderRuntime
- func (x *ProviderRuntime) CreateAllTables(ctx context.Context) *schema.Diagnostics
- func (x *ProviderRuntime) DropAllTables(ctx context.Context) *schema.Diagnostics
- func (x *ProviderRuntime) MakeToParentTableMap() map[string]*schema.Table
- func (x *ProviderRuntime) PullTables(ctx context.Context, request *shard.PullTablesRequest, ...) error
Constants ¶
const AllTableNameWildcard = "*"
AllTableNameWildcard Table name Wildcard, which matches all tables
const (
ErrMsgNotInitRuntime = "provider runtime not init"
)
Variables ¶
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) CreateAllTables ¶
func (x *Provider) CreateAllTables(ctx context.Context, request *shard.ProviderCreateAllTablesRequest) (response *shard.ProviderCreateAllTablesResponse, err error)
func (*Provider) DropTableAll ¶
func (x *Provider) DropTableAll(ctx context.Context, request *shard.ProviderDropTableAllRequest) (response *shard.ProviderDropTableAllResponse, err error)
func (*Provider) GetProviderConfig ¶
func (x *Provider) GetProviderConfig(ctx context.Context, in *shard.GetProviderConfigRequest) (response *shard.GetProviderConfigResponse, err error)
GetProviderConfig Obtain the configuration information of the Provider, must after Init
func (*Provider) GetProviderInformation ¶
func (x *Provider) GetProviderInformation(ctx context.Context, in *shard.GetProviderInformationRequest) (response *shard.GetProviderInformationResponse, err error)
GetProviderInformation Obtain the information about the Provider, must after Init
func (*Provider) Init ¶
func (x *Provider) Init(ctx context.Context, request *shard.ProviderInitRequest) (response *shard.ProviderInitResponse, err error)
func (*Provider) PullTables ¶
func (x *Provider) PullTables(ctx context.Context, request *shard.PullTablesRequest, sender shard.ProviderServerSender) (err error)
PullTables Pull the given resource
func (*Provider) Runtime ¶
func (x *Provider) Runtime() *ProviderRuntime
func (*Provider) SetProviderConfig ¶
func (x *Provider) SetProviderConfig(ctx context.Context, request *shard.SetProviderConfigRequest) (response *shard.SetProviderConfigResponse, err error)
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) MakeToParentTableMap ¶ added in v0.0.20
func (x *ProviderRuntime) MakeToParentTableMap() map[string]*schema.Table
func (*ProviderRuntime) PullTables ¶
func (x *ProviderRuntime) PullTables(ctx context.Context, request *shard.PullTablesRequest, sender shard.ProviderServerSender) error
PullTables Pull the given resource