logic.generic_provider is a provider: a component that holds a credential and is wired to the component that uses
it, rather than placed in the flow. It names one credential of the organization by its alias and serves no interface,
so it is for a logic.code that needs a secret, such as an API key
for a service the platform has no component for.
A
logic.generic_provider has no flow ports and no outputs. The wire that connects it to a component is its provider
reference, a socket with no route of its own.
The diagram draws what is served. In the definition the connection is written from the step: its source is the
logic.code with source_port provider_input, and its target is the provider with target_port
provider_reference.
Wiring it to a logic.code
The route of the connection from the logic.code to the provider names the provider inside the program, so a program
can read several providers by route. A program reads the credential with get_provider_credential, giving the
connection’s route and the provider’s port route, which is always credential
(Credentials). The call returns the credential row, whose
body holds the secret.
- A provider serves no interface. Its
interfaceslist is empty, so it is not the model or store that another component asks its provider for. It exists for alogic.codeto read. - The connection needs a route. A connection without one fails the node with an error event,
Provider "<name>" is connected without a route, so its credentials cannot be resolved. - A route the program does not know returns
None. So does a provider wired with a different route, and so does alogic.codewith no provider at all.
When the credential is missing
Thecredential port is required. A definition whose logic.generic_provider has no alias fails its
check with Port `credential` (category: `data_input`) is required. An alias that names no credential of the organization fails the node that uses it before its program runs,
with an error event "<alias>" credential alias not found.
Example
Halden Systems calls its carrier-rates service from alogic.code, with the key stored as the credential
carrier_rates_key. The provider holds the alias, and the connection from the code component carries the route keys.
get_provider_credential("keys", "credential")["body"]. The first argument is the
route of connection c1, the second is the provider’s port.
