예제 #1
0
    def Run(self, args):
        """Run 'services operations describe'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The response from the operations.Get API call.
    """
        messages = services_util.GetMessagesModule()
        client = services_util.GetClientInstance()

        operation_id = arg_parsers.GetOperationIdFromArg(args.operation)

        request = messages.ServicemanagementOperationsGetRequest(
            operationsId=operation_id, )

        operation = client.operations.Get(request)

        if (sys.getsizeof(str(operation.response)) > MAX_RESPONSE_BYTES
                and not args.full):
            log.warning('Response portion of operation resource redacted. '
                        'Use --full to see the whole Operation.\n')
            operation.response = None

        # Set async to True because we don't need to wait for the operation
        # to complete to check the status of it.
        return services_util.GetProcessedOperationResult(operation, async=True)
예제 #2
0
    def Run(self, args):
        """Run 'service-management operations wait'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      If successful, the response from the operations.Get API call.
    """
        messages = services_util.GetMessagesModule()
        client = services_util.GetClientInstance()

        operation_id = arg_parsers.GetOperationIdFromArg(args.operation)

        request = messages.ServicemanagementOperationsGetRequest(
            operationsId=operation_id, )

        operation = client.operations.Get(request)

        return services_util.ProcessOperationResult(operation, async=False)
예제 #3
0
 def testGetOperationIdFromArgNonetypeInput(self):
     expected = None
     actual = arg_parsers.GetOperationIdFromArg(None)
     self.assertEqual(expected, actual)
예제 #4
0
 def testGetOperationIdFromArgSimpleInput(self):
     expected = 'myoperation'
     actual = arg_parsers.GetOperationIdFromArg('myoperation')
     self.assertEqual(expected, actual)