Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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 NewWithRuntimeState ¶
func NewWithRuntimeState(db libdb.DBManager, state *runtimestate.State) Service
func WithActivityTracker ¶
func WithActivityTracker(service Service, tracker libtracker.ActivityTracker) Service