Skip to main content

Secret

This class provides an interface for managing secrets, including creation, retrieval, listing, and deletion. It supports two types of secrets: "regular" and "image_pull". The class allows users to interact with secrets by name and provides properties to access secret details like name and type.

Attributes

AttributeTypeDescription
pb2definition_pb2.Secretdefinition_pb2.Secret

Methods


create()

@classmethod
def create(
name: str,
value: Union[str, bytes],
type: SecretTypes = "regular"
)

Create a new secret.

Parameters

NameTypeDescription
namestrThe name of the secret.
valueUnion[str, bytes]The secret value as a string or bytes.
typeSecretTypes = "regular"Type of secret - either "regular" or "image_pull".

get()

@classmethod
def get(
name: str
) - > [Secret](secret.md?sid=flyte_remote__secret_secret)

Retrieve a secret by name.

Parameters

NameTypeDescription
namestrThe name of the secret to retrieve.

Returns

TypeDescription
[Secret](secret.md?sid=flyte_remote__secret_secret)A Secret object.

listall()

@classmethod
def listall(
limit: int = 10
) - > AsyncIterator[[Secret](secret.md?sid=flyte_remote__secret_secret)]

List all secrets in the current project and domain.

Parameters

NameTypeDescription
limitint = 10Maximum number of secrets to return per page.

Returns

TypeDescription
AsyncIterator[[Secret](secret.md?sid=flyte_remote__secret_secret)]An async iterator of Secret objects.

delete()

@classmethod
def delete(
name: Any
)

Delete a secret by name.

Parameters

NameTypeDescription
nameAnyThe name of the secret to delete.

name()

@classmethod
def name() - > str

Get the name of the secret.

Returns

TypeDescription
str

type()

@classmethod
def type() - > str

Get the type of the secret as a string ("regular" or "image_pull").

Returns

TypeDescription
str