Stephen Lloyd
03/13/2024, 5:47 AMfrom prefect.blocks.core import Block
from prefect.blocks.fields import SecretDict
class JSONSecret(Block):
"""
A block that represents a secret json value. The value stored in this block will be obfuscated when
this block is logged or shown in the UI.
Attributes:
value: A JSON key value pair that should be kept secret.
Example:
```python
from utilities.json_secret import JSONSecret
secret_block = JSONSecret.load("BLOCK_NAME")
# Access the stored secret
secret_block.get()
"""
secret: SecretDict
def get(self):
return self.secret.get_secret_value()```
How can I create this custom block type on a local prefect server?Marvin
03/13/2024, 5:47 AMBlock
base class.
2. Optionally, use the Prefect CLI to interact with your local server and register your block type. This might involve commands to create a new block type or add it to the server's configuration.
Since my initial search did not provide a direct answer, I recommend consulting the Prefect documentation or their community pages for more precise guidance on registering custom block types. The Prefect Discourse community might also be a valuable resource where similar questions have been asked and answered.
If you need more precise assistance, feel free to ask, and I'll continue to sulk... I mean, search through the available resources to find the information you need.