# Secret Tasks
Secret Tasks are a special kind of Prefect Task used to represent the retrieval of sensitive data.
The base implementation uses Prefect Cloud secrets, but users are encouraged to subclass the Secret
task
class for interacting with other secret providers. Secrets always use a special kind of result handler that
prevents the persistence of sensitive information.
# SecretBase
Base Secrets Task. This task does not perform any action but rather serves as the base task class which should be inherited from when writing new Secret Tasks.
Users should subclass this Task and override its run
method for plugging into other Secret stores, as it is handled differently during execution to ensure the underlying secret value is not accidentally persisted in a non-safe location.
Args:
**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
ValueError
: if aresult
keyword is passed
# PrefectSecret
Prefect Secrets Task. This task retrieves the underlying secret through the Prefect Secrets API (which has the ability to toggle between local vs. Cloud secrets).
Args:
name (str, optional)
: The name of the underlying secret**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
ValueError
: if aresult
keyword is passed
methods: |
---|
prefect.tasks.secrets.base.PrefectSecret.run (name=None)[source] |
The run method for Secret Tasks. This method actually retrieves and returns the underlying secret value using the
|
# EnvVarSecret
class
prefect.tasks.secrets.env_var.EnvVarSecret
(name=None, cast=None, raise_if_missing=False, **kwargs)[source]A Secret
task that retrieves a value from an environment variable.
Args:
name (str, optional)
: the environment variable that contains the secret valuecast (Callable[[Any], Any])
: A function that will be called on the Parameter value to coerce it to a type.raise_if_missing (bool)
: if True, an error will be raised if the env var is not found.**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.secrets.env_var.EnvVarSecret.run (name=None)[source] |
Returns the value of an environment variable after applying an optional
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC