Skip to content

Secrets API#

Handle#

[source]

get_secrets_api#

hopsworks.get_secrets_api()

Get the secrets api.

Returns

SecretsApi: The Secrets Api handle


Creation#

[source]

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")
Arguments

  • 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#

[source]

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

[source]

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

[source]

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#

[source]

created#

Date when secret was created


[source]

name#

Name of the secret


[source]

owner#

Owner of the secret


[source]

scope#

Scope of the secret


[source]

value#

Value of the secret


[source]

visibility#

Visibility of the secret


Methods#

[source]

delete#

Secret.delete()

Delete the secret

Potentially dangerous operation

This operation deletes the secret and may break applications using it.

Raises

RestAPIError.


[source]

get_url#

Secret.get_url()