Esta página descreve como listar todas as operações de longa duração e como ver o status de uma operação de longa duração.
Para verificar o status e mostrar outros detalhes de erro de uma operação de longa duração, primeiro é necessário extrair o valor de OPERATION_NAME e, em seguida, solicitar o status.
ListOperations
Para listar todas as operações de longa duração, envie a seguinte solicitação:
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
Em que:
- PROJECT_ID é o ID do Google Cloud projeto. Por exemplo,
my-project-id
. - LOCATION é o
local em que
seus recursos são hospedados. Por exemplo,
us-central1
.
Confira um exemplo de resposta para o comando acima:
{
"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 tem esta aparência:
"name": "projects/my-project-id/locations/us-central1/operations/
operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828",
GetOperation
Quando você envia uma solicitação 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, defina OPERATION_NAME como
operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828
.
Também é possível conferir o nome da operação nos resultados do comando ListOperations.
Depois de ter o valor de OPERATION_NAME, envie a solicitação abaixo:
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
Em que:
- PROJECT_ID é o ID do Google Cloud projeto. Por
exemplo,
my-project-id
. - LOCATION é o
local em que
seus recursos são hospedados. Por exemplo,
us-central1
. - OPERATION_NAME é uma string que especifica a operação.
Por exemplo,
operation-1683321573175-5faf8d8696fe0-5f1906e4-eb1b6828
.
Confira um exemplo de resposta para o 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"
}
}