Sondea operaciones de larga duración

En esta página, se describe cómo sondear de manera programática los recursos de la operación de larga duración que muestran los métodos en las API de Infraestructura de servicios y que requieren una cantidad de tiempo considerable para completarse, como service.rollouts.create Después de que se realiza una operación, el campo done se establecerá como verdadero.

Para sondear una operación, invoca repetidamente el método operations.get con una retirada recomendada de 10 segundos hasta que se complete la operación:

# This is an example of getting a pending `Operation` resource.
gcurl https://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2
{
  "name": "operations/rollouts.endpointsapis.appspot.com:2016-07-16r2",
  "metadata": {
    "@type": "type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata",
    "resourceNames": [
      "services/endpointsapis.appspot.com/rollouts/2016-07-16r2"
    ],
    "steps": [
      {
        "description": "update Service Controller",
        "status": "In_PROGRESS"
      }
    ],
    "progressPercentage": 0,
    "startTime": "2016-07-16T00:56:55.737Z",
  }
  "response": {
  "@type": "type.googleapis.com/google.api.servicemanagement.v1.Rollout",
  "rolloutId": "2016-07-16r2",
  "createTime": "2016-07-16T00:56:55.724Z",
  "serviceSelectionStrategy": {
    "serviceConfigIds": [
      "2016-07-16r1"
    ]
  },
  "serviceName": "endpointsapis.appspot.com"
}

# This is an example of getting a done `Operation` resource.
gcurl https://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2
{
  "name": "operations/rollouts.endpointsapis.appspot.com:2016-07-16r2",
  "metadata": {
    "@type": "type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata",
    "resourceNames": [
      "services/endpointsapis.appspot.com/rollouts/2016-07-16r2"
    ],
    "steps": [
      {
        "description": "update Service Controller",
        "status": "Done"
      }
    ],
    "progressPercentage": 100,
    "startTime": "2016-07-16T00:56:55.737Z",
  }
  "done": true,
  "response": {
  "@type": "type.googleapis.com/google.api.servicemanagement.v1.Rollout",
  "rolloutId": "2016-07-16r2",
  "createTime": "2016-07-16T00:56:55.724Z",
  "serviceSelectionStrategy": {
    "serviceConfigIds": [
      "2016-07-16r1"
    ]
  },
  "serviceName": "endpointsapis.appspot.com"
}