Documentation
¶
Index ¶
- Variables
- func RegisterServiceBinding(name string, serviceBindingBuilder ServiceBindingBuilder)
- type PostgresContextKey
- type PostgresServiceBinding
- func (b *PostgresServiceBinding) ApplyGrants(ctx context.Context, account map[string]string, ...) ([]types.BindingGrant, error)
- func (b *PostgresServiceBinding) BeginTransaction(ctx context.Context) (context.Context, error)
- func (b *PostgresServiceBinding) CommitTransaction(ctx context.Context) error
- func (b *PostgresServiceBinding) GenerateAccount(ctx context.Context, bindingId, bindingPath string, ...) (map[string]string, error)
- func (b *PostgresServiceBinding) InitializeService(ctx context.Context, logger *types.Logger, serviceConfig map[string]string) error
- func (b *PostgresServiceBinding) RollbackTransaction(ctx context.Context) error
- type ServiceBinding
- type ServiceBindingBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ServiceBindings = map[string]ServiceBindingBuilder{}
)
Functions ¶
func RegisterServiceBinding ¶
func RegisterServiceBinding(name string, serviceBindingBuilder ServiceBindingBuilder)
RegisterServiceBinding registers a service binding
Types ¶
type PostgresContextKey ¶ added in v0.17.3
type PostgresContextKey string
const POSTGRES_TRANSACTION_KEY PostgresContextKey = "postgres_sb_transaction"
type PostgresServiceBinding ¶
func (*PostgresServiceBinding) ApplyGrants ¶ added in v0.17.3
func (b *PostgresServiceBinding) ApplyGrants(ctx context.Context, account map[string]string, bindingMetadata types.BindingMetadata, derivedFromMetadata types.BindingMetadata, reapplyAll bool) ([]types.BindingGrant, error)
func (*PostgresServiceBinding) BeginTransaction ¶ added in v0.17.3
func (*PostgresServiceBinding) CommitTransaction ¶ added in v0.17.3
func (b *PostgresServiceBinding) CommitTransaction(ctx context.Context) error
func (*PostgresServiceBinding) GenerateAccount ¶
func (b *PostgresServiceBinding) GenerateAccount(ctx context.Context, bindingId, bindingPath string, bindingMetadata types.BindingMetadata, derivedFromMetadata *types.BindingMetadata, isStaging bool) (map[string]string, error)
func (*PostgresServiceBinding) InitializeService ¶ added in v0.17.3
func (*PostgresServiceBinding) RollbackTransaction ¶ added in v0.17.3
func (b *PostgresServiceBinding) RollbackTransaction(ctx context.Context) error
type ServiceBinding ¶
type ServiceBinding interface {
// Initialize the service with the given config. This is called when the service binding is created.
InitializeService(ctx context.Context, logger *types.Logger, serviceConfig map[string]string) error
// Begin a new transaction. This is called when the binding is created, before the account is generated.
// The transaction is used to generate the account and apply the grants. The transaction is expected to be saved in the context.
BeginTransaction(ctx context.Context) (context.Context, error)
// Commit the transaction.
CommitTransaction(ctx context.Context) error
// Rollback the transaction.
RollbackTransaction(ctx context.Context) error
// Generate the account based on the binding config. This is called once when the binding is created, after the service is initialized.
// The account is created on the endpoint specified in the service config.
GenerateAccount(ctx context.Context, bindingId, bindingPath string, bindingMetadata types.BindingMetadata,
derivedFromMetadata *types.BindingMetadata, isStaging bool) (map[string]string, error)
// Apply the grants to the account. This is called when the binding is created, after the account is generated.
// The grants are applied to the account on the endpoint specified in the service config. It can be called again if the grants are changed.
ApplyGrants(ctx context.Context, account map[string]string,
bindingMetadata, derivedFromMetadata types.BindingMetadata, reapplyAll bool) ([]types.BindingGrant, error)
}
func NewPostgresServiceBinding ¶
func NewPostgresServiceBinding() ServiceBinding
type ServiceBindingBuilder ¶
type ServiceBindingBuilder func() ServiceBinding
Click to show internal directories.
Click to hide internal directories.