def Run(self, args):
        operations_service = labelmanager.OperationsService()
        labelmanager_messages = labelmanager.LabelManagerMessages()
        operation_name = args.OPERATION_NAME

        get_request = labelmanager_messages.LabelmanagerOperationsGetRequest(
            name=operation_name)
        return operations_service.Get(get_request)
Example #2
0
def WaitForOperation(operation, message):
  """Waits for the given google.longrunning.Operation to complete.

  Args:
    operation: The operation to poll.
    message: String to display for default progress_tracker.

  Raises:
    apitools.base.py.HttpError: if the request returns an HTTP error

  Returns:
    The created Label Keyresource.
  """
  operation_ref = resources.REGISTRY.Parse(
      operation.name, collection='labelmanager.operations')
  poller = waiter.CloudOperationPoller(labelmanager.LabelKeysService(),
                                       labelmanager.OperationsService())
  return waiter.WaitFor(poller, operation_ref, message)