예제 #1
0
    def testConfigName(self):
        self.assertEqual(
            'foo', util.ConfigName(argparse.Namespace(config_name='foo')))
        self.assertEqual(None,
                         util.ConfigName(argparse.Namespace(), required=False))

        with self.assertRaises(exceptions.RequiredArgumentException):
            util.ConfigName(argparse.Namespace())
예제 #2
0
    def Run(self, args):
        """Run 'runtime-configs waiters list'.

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

    Yields:
      The list of waiters.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        waiter_client = util.WaiterClient()
        messages = util.Messages()

        config_resource = util.ParseConfigName(util.ConfigName(args))

        request = messages.RuntimeconfigProjectsConfigsWaitersListRequest(
            parent=config_resource.RelativeName(), )

        page_size = args.page_size or self.DEFAULT_PAGE_SIZE

        results = list_pager.YieldFromList(waiter_client,
                                           request,
                                           field='waiters',
                                           batch_size_attribute='pageSize',
                                           limit=args.limit,
                                           batch_size=page_size)

        for result in results:
            yield util.FormatWaiter(result)
예제 #3
0
  def Run(self, args):
    """Run 'runtime-configs variables list'.

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

    Yields:
      The list of variables.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
    variable_client = util.VariableClient()
    messages = util.Messages()

    config_resource = util.ParseConfigName(util.ConfigName(args))

    self._display_values = args.values

    request = messages.RuntimeconfigProjectsConfigsVariablesListRequest(
        parent=config_resource.RelativeName(),
        returnValues=self._display_values)

    page_size = args.page_size or self.DEFAULT_PAGE_SIZE

    results = list_pager.YieldFromList(
        variable_client, request, field='variables',
        batch_size_attribute='pageSize', limit=args.limit,
        batch_size=page_size
    )

    for result in results:
      yield util.FormatVariable(result, self._display_values)