backendservice

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnectionContract = servicecontract.Contract{
	ID: "provider-connection", Summary: "Save a provider connection",
	Description: "Save a named endpoint and its credentials together. Model discovery is a separate operation whose failure leaves the saved connection available for repair.",
	Operations:  []servicecontract.Operation{{ID: "save", Summary: "Save connection and credentials"}},
}

ConnectionContract describes atomic connection and credential persistence.

View Source
var ErrInvalidBackend = errors.New("invalid backend data")

Functions

func Validate

func Validate(backend *runtimetypes.Backend) error

Validate applies the field rules Create and Update enforce, without the one-backend-per-type-and-URL rule. Callers that deliberately allow several connections to one endpoint (each with its own credential) use it before writing through the store.

Types

type CredentialChange

type CredentialChange string

CredentialChange selects how saving a connection treats its existing credentials.

const (
	// PreserveCredentials leaves the existing credential source unchanged.
	PreserveCredentials CredentialChange = "preserve"
	// ReplaceCredentials saves the explicitly supplied credential source.
	ReplaceCredentials CredentialChange = "replace"
)

type SaveConnectionRequest

type SaveConnectionRequest struct {
	CredentialSource string
	ID               string
	Name             string
	Type             string
	Endpoint         string
	CredentialChange CredentialChange
	APIKey           string
	APIKeyEnv        string
}

SaveConnectionRequest identifies a connection and its credential update. An empty ID creates a new connection with an independent credential record.

type Service

type Service interface {
	SaveConnection(context.Context, SaveConnectionRequest) (*runtimetypes.Backend, error)
	Create(ctx context.Context, backend *runtimetypes.Backend) error
	Get(ctx context.Context, id string) (*runtimetypes.Backend, error)
	Update(ctx context.Context, backend *runtimetypes.Backend) error
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, createdAtCursor *time.Time, limit int) ([]*runtimetypes.Backend, error)
}

func New

func New(db libdb.DBManager) Service

func NewWithRuntimeState

func NewWithRuntimeState(db libdb.DBManager, state *runtimestate.State) Service

func WithActivityTracker

func WithActivityTracker(service Service, tracker libtracker.ActivityTracker) Service

Jump to

Keyboard shortcuts

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