# Viewing operations with a secret

The system logs all actions with Yandex Lockbox resources as a list of operations. Each operation gets an ID.

## Getting a list of operations {#get-operations}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder the secret belongs to.
    1. Navigate to **Lockbox**.
    1. In the left-hand menu, select **Secrets**.
    1. Click the name of the secret you need.
    1. In the left-hand panel, select ![image](../../_assets/operations.svg) **Operations**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To get a list of operations for a secret, run this command:

  ```bash
  yc lockbox secret list-operations <secret_name_or_ID>
  ```

  Result:

  ```text
  +----------------------+---------------------+----------------------+---------------------+--------+---------------+
  |          ID          |     CREATED AT      |      CREATED BY      |     MODIFIED AT     | STATUS |  DESCRIPTION  |
  +----------------------+---------------------+----------------------+---------------------+--------+---------------+
  | e6qj8hr2mfoj******** | 2024-03-27 02:47:03 | aje9k8luj4qf******** | 2024-03-27 02:47:03 | DONE   | Update secret |
  | e6q4145hccpl******** | 2024-03-27 02:46:40 | aje9k8luj4qf******** | 2024-03-27 02:46:40 | DONE   | Update secret |
  +----------------------+---------------------+----------------------+---------------------+--------+---------------+
  ```

  By default, information about operations is output as text. To get more details, specify the `yaml` or `json` output data format using `--format`:

  ```bash
  yc lockbox secret list-operations <secret_name_or_ID> --format yaml
  ```

  Result:

  ```text
  - id: e6qj8hr2mfoj********
    description: Update secret
    created_at: "2024-03-27T02:47:03.482004186Z"
    created_by: aje9k8luj4qf********
    modified_at: "2024-03-27T02:47:03.482036369Z"
    done: true
    metadata:
      '@type': type.googleapis.com/yandex.cloud.lockbox.v1.UpdateSecretMetadata
      secret_id: e6qnva6ntl66********
    response:
      '@type': type.googleapis.com/google.protobuf.Empty
      value: {}
  - id: e6q4145hccpl********
    description: Update secret
    created_at: "2024-03-27T02:46:40.035110019Z"
    created_by: aje9k8luj4qf********
    modified_at: "2024-03-27T02:46:40.035138179Z"
    done: true
    metadata:
      '@type': type.googleapis.com/yandex.cloud.lockbox.v1.UpdateSecretMetadata
      secret_id: e6qnva6ntl66********
    response:
      '@type': type.googleapis.com/google.protobuf.Empty
      value: {}
  ```

- API {#api}

  Use either the [listOperations](../api-ref/Secret/listOperations.md) REST API method for the [Secret](../api-ref/Secret/index.md) resource or the [SecretService/ListOperations](../api-ref/grpc/Secret/listOperations.md) gRPC API call.

{% endlist %}

## Getting operation details {#get-operations-info}

1. [Get the list of operations](#get-operations) for the resource.
1. Copy the operation ID.
1. Get the operation details:

    {% list tabs group=instructions %}

    - CLI {#cli}

      If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

      The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

      Run this command:

      ```bash
      yc operation get <operation_ID>
      ```

      Result:

      ```text
      id: e6qj8hr2mfoj********
      description: Update secret
      created_at: "2024-03-27T02:47:03.482Z"
      created_by: aje9k8luj4qf********
      modified_at: "2024-03-27T02:47:03.482Z"
      done: true
      metadata:
        '@type': type.googleapis.com/yandex.cloud.lockbox.v1.UpdateSecretMetadata
        secret_id: e6qnva6ntl66********
      response:
        '@type': type.googleapis.com/yandex.cloud.lockbox.v1.Secret
        id: e6qnva6ntl66********
        folder_id: b1g681qpemb4********
        created_at: "2024-03-27T02:45:05.184Z"
        name: top-secret
        labels:
          key2: value2
        status: ACTIVE
        current_version:
          id: e6qo5a6imnm0********
          secret_id: e6qnva6ntl66********
          created_at: "2024-03-27T02:45:05.184Z"
          status: ACTIVE
          payload_entry_keys:
            - key
        deletion_protection: true
      ```

    - API {#api}

      Use the [OperationService/Get](../api-ref/grpc/Operation/get.md) gRPC API call.

    {% endlist %}

#### See also {#see-also}

* [Working with operations](../../api-design-guide/concepts/about-async.md)