Verifica el estado de la operación

En esta página, se describe cómo enumerar todas las operaciones de larga duración y cómo ver el estado de una operación de este tipo.

Para verificar el estado y mostrar cualquier detalle de error adicional de una operación de larga duración, primero deberás obtener el valor de OPERATION_NAME y, luego, podrás solicitar el estado.

ListOperations

Para enumerar todas las operaciones de larga duración, envía la siguiente solicitud:

curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://blockchainnodeengine.googleapis.com/v1/projects/PROJECT_ID/\
locations/LOCATION/operations

Aquí:

  • PROJECT_ID es el Google Cloud ID de tu proyecto. Por ejemplo, my-project-id.
  • LOCATION es la ubicación en la que se alojan tus recursos. Por ejemplo, us-central1.

A continuación, se muestra una respuesta de ejemplo al comando anterior:

{
  "operations": [
    {
      "name": "projects/my-project-id/locations/us-central1/operations/operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828",
      "metadata": {
        "@type": "type.googleapis.com/google.cloud.blockchainnodeengine.v1.OperationMetadata",
        "createTime": "2023-05-05T21:19:33.245698045Z",
        "endTime": "2023-05-05T21:58:44.520319810Z",
        "target": "projects/my-project-id/locations/us-central1/blockchainNodes/my-new-node-2",
        "verb": "create",
        "requestedCancellation": false,
        "apiVersion": "v1"
      },
      "done": true,
      "response": {
        "@type": "type.googleapis.com/google.cloud.blockchainnodeengine.v1.BlockchainNode",
        "name": "projects/my-project-id/locations/us-central1/blockchainNodes/my-new-node-2",
        "createTime": "2023-05-05T21:19:33.308756Z",
        "updateTime": "2023-05-05T21:58:44.513286Z",
        "labels": {
          "label-key": "label-value"
        },
        "blockchainType": "ETHEREUM",
        "connectionInfo": {
          "ipInfo": {
            "rpcIpv4Address": "203.0.113.1"
          },
          "endpointInfo": {
            "jsonRpcApiEndpoint": "json-rpc.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com",
            "websocketsApiEndpoint": "ws.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com"
          }
        },
        "ethereumDetails": {
          "network": "MAINNET",
          "nodeType": "FULL",
          "executionClient": "GETH",
          "consensusClient": "LIGHTHOUSE",
          "apiEnableAdmin": false,
          "apiEnableDebug": false,
          "additionalEndpoints": {
            "beaconApiEndpoint": "beacon.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com",
            "beaconPrometheusMetricsApiEndpoint": "bc-mc.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com"
          }
        },
        "state": "RUNNING"
      }
    }
  ]
}

Anota el OPERATION_ID, que se ve así:

"name": "projects/my-project-id/locations/us-central1/operations/
    operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828",

GetOperation

Cuando envías una solicitud y recibes una respuesta, por ejemplo, de CreateBlockchainNode o DeleteBlockchainNode, la respuesta incluye el OPERATION_ID:

  "name": "projects/my-project-id/locations/us-central1/operations/
    operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828",

En este ejemplo, configurarías OPERATION_NAME como operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828.

También puedes obtener el nombre de la operación de los resultados del comando ListOperations.

Una vez que tengas el valor de OPERATION_NAME, envía la siguiente solicitud:

curl \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
https://blockchainnodeengine.googleapis.com/v1/projects/PROJECT_ID/\
locations/LOCATION/operations/OPERATION_NAME

Aquí:

  • PROJECT_ID es el Google Cloud ID de tu proyecto. Por ejemplo, my-project-id.
  • LOCATION es la ubicación en la que se alojan tus recursos. Por ejemplo, us-central1.
  • OPERATION_NAME es una cadena que especifica la operación. Por ejemplo, operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828

Este es un ejemplo de respuesta al comando anterior:

{
  "name": "projects/my-project-id/locations/us-central1/operations/operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.blockchainnodeengine.v1.OperationMetadata",
    "createTime": "2023-05-05T21:19:33.245698045Z",
    "endTime": "2023-05-05T21:58:44.520319810Z",
    "target": "projects/my-project-id/locations/us-central1/blockchainNodes/my-new-node-2",
    "verb": "create",
    "requestedCancellation": false,
    "apiVersion": "v1"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.blockchainnodeengine.v1.BlockchainNode",
    "name": "projects/my-project-id/locations/us-central1/blockchainNodes/my-new-node-2",
    "createTime": "2023-05-05T21:19:33.308756Z",
    "updateTime": "2023-05-05T21:58:44.513286Z",
    "labels": {
      "label-key": "label-value"
    },
    "blockchainType": "ETHEREUM",
    "connectionInfo": {
      "ipInfo": {
        "rpcIpv4Address": "203.0.113.1"
      },
      "endpointInfo": {
        "jsonRpcApiEndpoint": "json-rpc.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com",
        "websocketsApiEndpoint": "ws.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com"
      }
    },
    "ethereumDetails": {
      "network": "MAINNET",
      "nodeType": "FULL",
      "executionClient": "GETH",
      "consensusClient": "LIGHTHOUSE",
      "apiEnableAdmin": false,
      "apiEnableDebug": false,
      "additionalEndpoints": {
        "beaconApiEndpoint": "beacon.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com",
        "beaconPrometheusMetricsApiEndpoint": "bc-mc.4amkczs2vkh8hjtghcipu7y2t.blockchainnodeengine.com"
      }
    },
    "state": "RUNNING"
  }
}