interface Secrets {
    create(
        namespace: NamespaceName,
        name: string,
        secretType: SecretType,
        data: Record<string, string>,
        labels: Record<string>,
    ): Promise<boolean>;
    createOrReplace(
        namespace: NamespaceName,
        name: string,
        secretType: SecretType,
        data: Record<string, string>,
        labels: Record<string>,
    ): Promise<boolean>;
    delete(namespace: NamespaceName, name: string): Promise<boolean>;
    exists(namespace: NamespaceName, name: string): Promise<boolean>;
    list(
        namespace: NamespaceName,
        labels?: string[],
    ): Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        }[],
    >;
    read(
        namespace: NamespaceName,
        name: string,
    ): Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        },
    >;
    replace(
        namespace: NamespaceName,
        name: string,
        secretType: SecretType,
        data: Record<string, string>,
        labels: Record<string>,
    ): Promise<boolean>;
}

Implemented by

Methods

  • creates a new Kubernetes secret with the provided attributes

    Parameters

    • namespace: NamespaceName

      the namespace to store the secret

    • name: string

      the name of the new secret

    • secretType: SecretType

      the secret type

    • data: Record<string, string>

      the secret, any values of a key:value pair must be base64 encoded

    • labels: Record<string>

      the label to use for future label selector queries

    Returns Promise<boolean>

    whether the secret was created successfully

  • Get secrets by labels

    Parameters

    • namespace: NamespaceName

      the namespace of the secret

    • Optionallabels: string[]

      list of labels

    Returns Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        }[],
    >

    the list of secrets that match the labels

  • Parameters

    Returns Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        },
    >