Пример #1
0
  def Args(cls, parser):
    cls.BACKUP_POOL_ARG = flags.BackupPoolArgument()
    cls.TARGET_POOL_ARG = flags.TargetPoolArgument(
        help_suffix=' for which to set the backup pool.')
    cls.TARGET_POOL_ARG.AddArgument(
        parser, operation_type='set a backup pool for')

    # TODO(b/33690890): add required=True to group after deprecation.
    backup_pool_group = parser.add_mutually_exclusive_group()
    backup_pool_group.add_argument(
        '--no-backup-pool', action='store_true',
        help='Unsets the backup pool. This disables failover.')
    backup_pool_group.add_argument(
        '--backup-pool',
        nargs='?',
        action=arg_parsers.HandleNoArgAction(
            'no_backup_pool',
            'Use of --backup-pool without an argument is deprecated and will '
            'stop working in the future. Please use --no-backup-pool to disable'
            ' the backup pool.'),
        completion_resource='targetPools',
        help='Name of the target pool that will serve as backup.')

    parser.add_argument(
        '--failover-ratio',
        type=float,
        help=('The new failover ratio value for the target pool. '
              'This must be a float in the range of [0, 1].'))
Пример #2
0
  def Args(cls, parser):
    parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
    cls.BACKUP_POOL_ARG = flags.BackupPoolArgument(required=False)
    cls.HTTP_HEALTH_CHECK_ARG = (
        http_health_check_flags.HttpHealthCheckArgumentForTargetPoolCreate(
            required=False))
    cls.HTTP_HEALTH_CHECK_ARG.AddArgument(parser)
    cls.TARGET_POOL_ARG = flags.TargetPoolArgument()
    cls.TARGET_POOL_ARG.AddArgument(parser, operation_type='create')
    parser.display_info.AddCacheUpdater(flags.TargetPoolsCompleter)

    parser.add_argument(
        '--backup-pool',
        help="""\
        Together with ``--failover-ratio'', this flag defines the fallback
        behavior of the target pool (primary pool) to be created by this
        command. If the ratio of the healthy instances in the primary pool
        is at or below the specified ``--failover-ratio value'', then traffic
        arriving at the load-balanced IP address will be directed to the
        backup pool. If this flag is provided, then ``--failover-ratio'' is
        required.
        """)

    parser.add_argument(
        '--description',
        help='An optional description of this target pool.')

    parser.add_argument(
        '--failover-ratio',
        type=float,
        help="""\
        Together with ``--backup-pool'', defines the fallback behavior of the
        target pool (primary pool) to be created by this command. If the
        ratio of the healthy instances in the primary pool is at or below this
        number, traffic arriving at the load-balanced IP address will be
        directed to the backup pool. For example, if 0.4 is chosen as the
        failover ratio, then traffic will fail over to the backup pool if
        more than 40% of the instances become unhealthy.
        If not set, the traffic will be directed the
        instances in this pool in the ``force'' mode, where traffic will be
        spread to the healthy instances with the best effort, or to all
        instances when no instance is healthy.
        If this flag is provided, then ``--backup-pool'' is required.
        """)

    parser.add_argument(
        '--health-check',
        metavar='HEALTH_CHECK',
        help="""\
        DEPRECATED, use --http-health-check.
        Specifies an HTTP health check resource to use to determine the health
        of instances in this pool. If no health check is specified, traffic will
        be sent to all instances in this target pool as if the instances
        were healthy, but the health status of this pool will appear as
        unhealthy as a warning that this target pool does not have a health
        check.
        """)

    backend_services_flags.AddSessionAffinity(parser, target_pools=True)
 def Args(cls, parser):
     cls.HEALTH_CHECK_ARG = (http_health_check_flags.
                             HttpHealthCheckArgumentForTargetPool('add to'))
     cls.HEALTH_CHECK_ARG.AddArgument(parser)
     cls.TARGET_POOL_ARG = flags.TargetPoolArgument(
         help_suffix=' to which to add the health check.')
     cls.TARGET_POOL_ARG.AddArgument(parser,
                                     operation_type='add health checks to')
 def Args(cls, parser):
   cls.HEALTH_CHECK_ARG = (
       http_health_check_flags.HttpHealthCheckArgumentForTargetPool(
           'remove from'))
   cls.HEALTH_CHECK_ARG.AddArgument(parser)
   cls.TARGET_POOL_ARG = flags.TargetPoolArgument(
       help_suffix=' from which to remove the health check.')
   cls.TARGET_POOL_ARG.AddArgument(
       parser, operation_type='remove health checks from')
Пример #5
0
  def Args(cls, parser):
    cls.BACKUP_POOL_ARG = flags.BackupPoolArgument()
    cls.TARGET_POOL_ARG = flags.TargetPoolArgument(
        help_suffix=' for which to set the backup pool.')
    cls.TARGET_POOL_ARG.AddArgument(
        parser, operation_type='set a backup pool for')

    backup_pool_group = parser.add_mutually_exclusive_group(required=True)
    backup_pool_group.add_argument(
        '--no-backup-pool', action='store_true',
        help='Unsets the backup pool. This disables failover.')
    backup_pool_group.add_argument(
        '--backup-pool',
        completer=flags.TargetPoolsCompleter,
        help='Name of the target pool that will serve as backup.')

    parser.add_argument(
        '--failover-ratio',
        type=float,
        help=('The new failover ratio value for the target pool. '
              'This must be a float in the range of [0, 1].'))
Пример #6
0
    def Args(cls, parser):
        cls.BACKUP_POOL_ARG = flags.BackupPoolArgument()
        cls.TARGET_POOL_ARG = flags.TargetPoolArgument(
            help_suffix=' for which to set the backup pool.')
        cls.TARGET_POOL_ARG.AddArgument(parser,
                                        operation_type='set a backup pool for')

        parser.add_argument(
            '--backup-pool',
            nargs='?',
            completion_resource='targetPools',
            help=('Name of the target pool that will serve as backup. '
                  'If this flag is provided without a value, the existing '
                  'backup pool is removed.'),
            required=True)

        parser.add_argument(
            '--failover-ratio',
            type=float,
            help=('The new failover ratio value for the target pool. '
                  'This must be a float in the range of [0, 1].'))
Пример #7
0
 def Args(parser):
     Describe.TARGET_POOL_ARG = flags.TargetPoolArgument()
     Describe.TARGET_POOL_ARG.AddArgument(parser, operation_type='describe')
Пример #8
0
 def Args(cls, parser):
     cls.TARGET_POOL_ARG = flags.TargetPoolArgument()
     cls.TARGET_POOL_ARG.AddArgument(
         parser, operation_type='get health information for')
Пример #9
0
 def Args(parser):
     Delete.TARGET_POOL_ARG = flags.TargetPoolArgument(help_suffix=None,
                                                       plural=True)
     Delete.TARGET_POOL_ARG.AddArgument(parser, operation_type='delete')
     parser.display_info.AddCacheUpdater(flags.TargetPoolsCompleter)
Пример #10
0
 def Args(parser):
     Delete.TARGET_POOL_ARG = flags.TargetPoolArgument(help_suffix=None,
                                                       plural=True)
     Delete.TARGET_POOL_ARG.AddArgument(parser, operation_type='delete')