Skip to main content

Secret

This class provides a management interface for creating, retrieving, listing, and deleting secrets within a specific project and domain. It supports both generic secrets and image pull secrets, handling both string and binary values. The class integrates with a backend secrets service and provides metadata such as creation time and cluster-specific status.

Attributes​

AttributeTypeDescription
pb2definition_pb2.SecretThe underlying Protocol Buffer message containing the secret's metadata and identification details.

Methods​


create()​

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

Create a new secret.

Parameters​

NameTypeDescription
namestrThe unique identifier for the secret within the project and domain
valueUnion[str, bytes]The sensitive data to be stored, provided as either a string or raw bytes
typeSecretTypes = "regular"The classification of the secret, determining if it is a standard secret or an image pull secret

Returns​

TypeDescription
nullNothing is returned upon successful creation

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 from the current project and domain

Returns​

TypeDescription
[Secret](secret.md?sid=flyte_remote__secret_secret)A Secret object containing the metadata and identifier for the requested secret

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 = 10The maximum number of secret records to fetch per underlying API request page

Returns​

TypeDescription
AsyncIterator[[Secret](secret.md?sid=flyte_remote__secret_secret)]An asynchronous iterator yielding Secret objects found in the current scope

delete()​

@classmethod
def delete(
name: str
) - > null

Delete a secret by name.

Parameters​

NameTypeDescription
namestrThe name of the secret to be permanently removed from the system

Returns​

TypeDescription
nullNothing is returned upon successful deletion

name()​

@classmethod
def name() - > str

Get the name of the secret.

Returns​

TypeDescription
strThe string identifier of the secret instance

type()​

@classmethod
def type() - > str

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

Returns​

TypeDescription
strThe category of the secret, either "regular" for generic data or "image_pull" for registry credentials