Verifique o estado da operação

Esta página descreve como listar todas as operações de longa duração e como ver o estado de uma operação de longa duração.

Para verificar o estado e apresentar detalhes de erros adicionais de uma operação de longa duração, tem de obter o valor de OPERATION_NAME primeiro e, em seguida, pode pedir o estado.

ListOperations

Para apresentar uma lista de todas as operações de longa duração, envie o seguinte pedido:

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

Onde:

  • PROJECT_ID é o ID do seu Google Cloud projeto. Por exemplo, my-project-id.
  • LOCATION é a localização na qual os seus recursos estão alojados. Por exemplo, us-central1.

Segue-se um exemplo de resposta a este comando:

{
  "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"
      }
    }
  ]
}

Anote o OPERATION_ID, que se assemelha ao seguinte:

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

GetOperation

Quando envia um pedido e recebe uma resposta, por exemplo, de CreateBlockchainNode ou DeleteBlockchainNode, a resposta inclui o OPERATION_ID:

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

Para este exemplo, definiria OPERATION_NAME como operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828.

Também pode obter o nome da operação a partir dos resultados do comando ListOperations.

Assim que tiver o valor de OPERATION_NAME, envie o seguinte pedido:

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

Onde:

  • PROJECT_ID é o ID do seu Google Cloud projeto. Por exemplo my-project-id.
  • A LOCATION é a localização na qual os seus recursos estão alojados. Por exemplo, us-central1.
  • OPERATION_NAME é uma string que especifica a operação. Por exemplo, operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828.

Segue-se um exemplo de resposta ao comando acima:

{
  "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"
  }
}