Secrets API#
Handle#
get_secrets_api#
hopsworks.get_secrets_api()
Get the secrets api.
Returns
SecretsApi
: The Secrets Api handle
Creation#
create_secret#
SecretsApi.create_secret(name, value, project=None)
Create a new secret.
import hopsworks
connection = hopsworks.connection()
secrets_api = connection.get_secrets_api()
secret = secrets_api.create_secret("my_secret", "Fk3MoPlQXCQvPo")
- name
str
: Name of the secret. - value
str
: The secret value. - project
str | None
: Name of the project to share the secret with.
Returns
Secret
: The Secret object
Raises
RestAPIError
: If unable to create the secret
Retrieval#
get#
SecretsApi.get(name, owner=None)
Get the secret's value. If the secret does not exist, it prompts the user to create the secret if the application is running interactively
Arguments
- name
str
: Name of the secret. - owner
str | None
: email of the owner for a secret shared with the current project.
Returns
str
: The secret value
Raises
RestAPIError
: If unable to get the secret
get_secret#
SecretsApi.get_secret(name, owner=None)
Get a secret.
Arguments
- name
str
: Name of the secret. - owner
str | None
: username of the owner for a secret shared with the current project. Users can find their username in the Account Settings > Profile section.
Returns
Secret
: The Secret object
Raises
RestAPIError
: If unable to get the secret
get_secrets#
SecretsApi.get_secrets()
Get all secrets
Returns
List[Secret]
: List of all accessible secrets
Raises
RestAPIError
: If unable to get the secrets
Properties#
created#
Date when secret was created
name#
Name of the secret
owner#
Owner of the secret
scope#
Scope of the secret
value#
Value of the secret
visibility#
Visibility of the secret
Methods#
delete#
Secret.delete()
Delete the secret
Potentially dangerous operation
This operation deletes the secret and may break applications using it.
Raises
RestAPIError
.
get_url#
Secret.get_url()