Пример #1
0
  def Run(self, args):
    """Run 'services enable'.

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

    Returns:
      Nothing.
    """
    project = properties.VALUES.core.project.Get(required=True)
    if len(args.service) == 1:
      op = serviceusage.EnableApiCall(project, args.service[0])
    else:
      op = serviceusage.BatchEnableApiCall(project, args.service)
    if op.done:
      return
    if args.async:
      cmd = _OP_WAIT_CMD.format(op.name)
      log.status.Print('Asynchronous operation is in progress... '
                       'Use the following command to wait for its '
                       'completion:\n {0}'.format(cmd))
      return
    op = serviceusage.WaitOperation(op.name)
    services_util.PrintOperation(op)
Пример #2
0
  def Run(self, args):
    """Run 'services 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.
    """
    op = serviceusage.WaitOperation(args.operation)
    services_util.PrintOperation(op)
Пример #3
0
    def Run(self, args):
        """Run 'services disable'.

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

    Returns:
      Nothing.
    """
        project = properties.VALUES.core.project.Get(required=True)
        for service_name in args.service:
            service_name = arg_parsers.GetServiceNameFromArg(service_name)
            op = serviceusage.DisableApiCall(project, service_name, args.force)
            if op.done:
                return
            if args. async:
                cmd = OP_WAIT_CMD.format(op.name)
                log.status.Print('Asynchronous operation is in progress... '
                                 'Use the following command to wait for its '
                                 'completion:\n {0}'.format(cmd))
                return
            op = serviceusage.WaitOperation(op.name)
            services_util.PrintOperation(op)