Skip to content

Secrets API#

get_secrets_api #

get_secrets_api() -> secret_api.SecretsApi

Get the secrets api.

RETURNS DESCRIPTION
secret_api.SecretsApi

The Secrets API handle.

SecretsApi #

create_secret #

create_secret(
    name: str, value: str, project: str = None
) -> secret.Secret

Create a new secret.

import hopsworks

project = hopsworks.login()

secrets_api = hopsworks.get_secrets_api()

secret = secrets_api.create_secret("my_secret", "Fk3MoPlQXCQvPo")
PARAMETER DESCRIPTION
name

Name of the secret.

TYPE: str

value

The secret value.

TYPE: str

project

Name of the project to share the secret with.

TYPE: str DEFAULT: None

RETURNS DESCRIPTION
secret.Secret

The Secret object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get #

get(name: str, owner: str = None) -> str

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.

PARAMETER DESCRIPTION
name

Name of the secret.

TYPE: str

owner

Email of the owner for a secret shared with the current project.

TYPE: str DEFAULT: None

RETURNS DESCRIPTION
str

The secret value.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_secret #

get_secret(
    name: str, owner: str = None
) -> secret.Secret | None

Get a secret.

PARAMETER DESCRIPTION
name

Name of the secret.

TYPE: str

owner

Username of the owner for a secret shared with the current project. Users can find their username in the Account Settings > Profile section.

TYPE: str DEFAULT: None

RETURNS DESCRIPTION
secret.Secret | None

The Secret object or None if it does not exist.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_secrets #

get_secrets() -> list[secret.Secret]

Get all secrets.

RETURNS DESCRIPTION
list[secret.Secret]

List[Secret]: List of all accessible secrets

Raises: hopsworks.client.exceptions.RestAPIError: If the backend encounters an error when handling the request

Secret #

created property #

created

Date when secret was created.

name property #

name

Name of the secret.

owner property #

owner

Owner of the secret.

scope property #

scope

Scope of the secret.

value property #

value

Value of the secret.

visibility property #

visibility

Visibility of the secret.

delete #

delete()

Delete the secret.

Potentially dangerous operation

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

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

get_url #

get_url()

Get url to the secret in Hopsworks.