Exemple #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)
        project = config_resource.projectsId
        name = config_resource.Name()

        result = config_client.Update(
            messages.RuntimeconfigProjectsConfigsUpdateRequest(
                projectsId=project,
                configsId=name,
                runtimeConfig=messages.RuntimeConfig(
                    name=util.ConfigPath(project, name),
                    description=args.description,
                )))

        log.UpdatedResource(config_resource)
        return util.FormatConfig(result)
Exemple #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(
            projectsId=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)
Exemple #3
0
    def Run(self, args):
        """Run 'runtime-configs describe'.

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

    Returns:
      The requested 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.Get(
            messages.RuntimeconfigProjectsConfigsGetRequest(
                name=config_resource.RelativeName(), ))
        return util.FormatConfig(result)