# 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.
# Secret
Base 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). 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:
name (str)
: The name of the underlying secret**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
ValueError
: if aresult_handler
keyword is passed
methods: |
---|
prefect.tasks.secrets.base.Secret.run ()[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
(env_var, name=None, cast=None, raise_if_missing=False, **kwargs)[source]A Secret
task that retrieves a value from an environment variable.
Args:
env_var (str)
: the environment variable that contains the secret valuename (str, optional)
: a name for the task. If not provided,env_var
is used.cast (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 ()[source] |
Returns the value of an environment variable after applying an optional
|
This documentation was auto-generated from commit n/a
on November 26, 2019 at 16:53 UTC
← RSS Tasks Shell Tasks →