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

        config_client.Delete(
            messages.RuntimeconfigProjectsConfigsDeleteRequest(
                projectsId=project,
                configsId=name,
            ))

        log.DeletedResource(config_resource)
예제 #4
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)
예제 #5
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))
        project = config_resource.projectsId
        config = config_resource.Name()

        request = messages.RuntimeconfigProjectsConfigsVariablesListRequest(
            projectsId=project,
            configsId=config,
        )

        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)