Example #1
0
    def Run(self, args):
        """Run 'runtime-configs update'.

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

    Returns:
      The updated runtime-config resource.

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

        config_resource = util.ParseConfigName(args.name)

        result = config_client.Update(
            messages.RuntimeConfig(
                name=config_resource.RelativeName(),
                description=args.description,
            ))

        log.UpdatedResource(config_resource)
        return util.FormatConfig(result)
Example #2
0
    def Run(self, args):
        """Run 'runtime-configs list'.

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

    Yields:
      The list of runtime-config resources.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        config_client = util.ConfigClient()
        messages = util.Messages()
        project = util.Project()

        request = messages.RuntimeconfigProjectsConfigsListRequest(
            parent=util.ProjectPath(project), )

        page_size = args.page_size or self.DEFAULT_PAGE_SIZE

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

        for result in results:
            yield util.FormatConfig(result)
Example #3
0
    def Run(self, args):
        """Run 'runtime-configs delete'.

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

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

        config_resource = util.ParseConfigName(args.name)

        config_client.Delete(
            messages.RuntimeconfigProjectsConfigsDeleteRequest(
                name=config_resource.RelativeName(), ))

        log.DeletedResource(config_resource)