Exemple #1
0
    def Filter(self, context, args):
        """Modify the context that will be given to this group's commands when run.

    Args:
      context: {str:object}, A set of key-value pairs that can be used for
          common initialization among commands.
      args: argparse.Namespace: The same namespace given to the corresponding
          .Run() invocation.

    Returns:
      The refined command context.
    """
        if container_command_util.GetUseV1APIProperty():
            warning = messages.GetAPIMismatchingWarning(self.ReleaseTrack())
            if warning:
                log.warning(warning)

        context['location_get'] = container_command_util.GetZoneOrRegion
        return context
Exemple #2
0
    def Filter(self, context, args):
        """Modify the context that will be given to this group's commands when run.

    Args:
      context: {str:object}, A set of key-value pairs that can be used for
          common initialization among commands.
      args: argparse.Namespace: The same namespace given to the corresponding
          .Run() invocation.

    Returns:
      The refined command context.
    """
        base.DisableUserProjectQuota()
        if container_command_util.GetUseV1APIProperty():
            api_version = 'v1'
        else:
            api_version = 'v1beta1'
        context['api_adapter'] = api_adapter.NewAPIAdapter(api_version)
        return context