コード例 #1
0
 def Args(parser, resource=None, cli=None, command=None):
   BaseDescriber.AddArgs(parser, resource, cli, command)
   utils.AddRegionFlag(
       parser,
       resource_type='resource',
       operation_type='fetch',
       cli=cli)
コード例 #2
0
ファイル: set_backup.py プロジェクト: bopopescu/packmybot
    def Args(parser):
        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)

        utils.AddRegionFlag(parser,
                            resource_type='target pool',
                            operation_type='set a backup pool for')

        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].'))

        parser.add_argument(
            'name',
            completion_resource='targetPools',
            help='The name of the target pool for which to set the backup pool.'
        )
コード例 #3
0
    def Args(parser):
        base_classes.AddFieldsFlag(parser, 'targetPoolInstanceHealth')

        utils.AddRegionFlag(parser,
                            resource_type='target pool',
                            operation_type='get health information for')

        parser.add_argument('name', help='The name of the target pool.')
コード例 #4
0
    def Args(parser):
        """Adds common flags for mutating addresses."""
        scope = parser.add_mutually_exclusive_group()

        utils.AddRegionFlag(scope,
                            resource_type='address',
                            operation_type='operate on')

        scope.add_argument(
            '--global',
            action='store_true',
            help='If provided, it is assumed the addresses are global.')
コード例 #5
0
    def Args(parser):
        """Adds common flags for mutating forwarding rules."""
        scope = parser.add_mutually_exclusive_group()

        utils.AddRegionFlag(scope,
                            resource_type='forwarding rule',
                            operation_type='operate on')

        global_flag = scope.add_argument(
            '--global',
            action='store_true',
            help='If provided, it is assumed the forwarding rules are global.')
        global_flag.detailed_help = """\
コード例 #6
0
    def Args(parser):
        parser.add_argument(
            '--http-health-check',
            help=('Specifies an HTTP health check object to add to the '
                  'target pool.'),
            metavar='HEALTH_CHECK',
            required=True)

        utils.AddRegionFlag(parser,
                            resource_type='target pool',
                            operation_type='add health checks to')

        parser.add_argument(
            'name',
            help='The name of the target pool to which to add the health check.'
        )
コード例 #7
0
  def Args(parser):
    """Adds arguments to the supplied parser."""

    parser.add_argument(
        '--description',
        help='An optional, textual description for the target VPN tunnel.')

    ike_version = parser.add_argument(
        '--ike-version',
        choices=[1, 2],
        type=int,
        help='Internet Key Exchange protocol version number.')
    ike_version.detailed_help = """\
        Internet Key Exchange protocol version number.
        Valid options are 1 and 2.  Default is 2.
        """

    parser.add_argument(
        '--peer-address',
        required=True,
        help='A valid IP-v4 address representing the remote tunnel endpoint')

    # TODO(user) Add other group members
    shared_secret = parser.add_argument(
        '--shared-secret',
        type=ValidateSimpleSharedSecret,
        required=True,
        help='A shared secret consisting of printable characters')
    shared_secret.detailed_help = (
        'A shared secret consisting of printable characters.  Valid '
        'arguments match the regular expression ' +
        _PRINTABLE_CHARS_PATTERN)

    parser.add_argument(
        '--target-vpn-gateway',
        required=True,
        help='A reference to a target vpn gateway')

    utils.AddRegionFlag(
        parser,
        resource_type='VPN Tunnel',
        operation_type='create')

    parser.add_argument(
        'name',
        help='The name of the VPN tunnel.')
コード例 #8
0
    def Args(parser):
        parser.add_argument(
            '--http-health-check',
            help=('Specifies an HTTP health check object to remove from the '
                  'target pool.'),
            metavar='HEALTH_CHECK',
            completion_resource='httpHealthChecks',
            required=True)

        utils.AddRegionFlag(parser,
                            resource_type='target pool',
                            operation_type='remove health checks from')

        parser.add_argument(
            'name',
            completion_resource='targetPools',
            help=('The name of the target pool from which to remove the '
                  'health check.'))
コード例 #9
0
    def Args(parser):
        """Adds arguments to the supplied parser."""

        parser.add_argument(
            '--description',
            help='An optional, textual description for the target VPN Gateway.'
        )

        network = parser.add_argument(
            '--network',
            required=True,
            help='A reference to a network in this project')
        network.detailed_help = """\
       A reference to a network in this project to
       contain the VPN Gateway.
       """

        utils.AddRegionFlag(parser,
                            resource_type='Target VPN Gatway',
                            operation_type='create')

        parser.add_argument('name', help='The name of the target VPN Gateway.')
コード例 #10
0
 def Args(parser):
   BaseDeleter.Args(parser)
   utils.AddRegionFlag(
       parser, resource_type='resources', operation_type='delete')
コード例 #11
0
 def Args(parser):
   BaseDescriber.Args(parser)
   utils.AddRegionFlag(
       parser,
       resource_type='resource',
       operation_type='fetch')
コード例 #12
0
    def Args(parser):
        backup_pool = parser.add_argument(
            '--backup-pool',
            help='Defines the fallback pool for the target pool.')
        backup_pool.detailed_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.')

        failover_ratio = parser.add_argument(
            '--failover-ratio',
            type=float,
            help=('The ratio of healthy instances below which the backup pool '
                  'will be used.'))
        failover_ratio.detailed_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.
        """

        health_check = parser.add_argument(
            '--health-check',
            help=
            ('Specifies HttpHealthCheck to determine the health of instances '
             'in the pool.'),
            metavar='HEALTH_CHECK')
        health_check.detailed_help = """\
        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.
        """

        utils.AddRegionFlag(parser,
                            resource_type='target pool',
                            operation_type='create')

        session_affinity = parser.add_argument(
            '--session-affinity',
            choices=SESSION_AFFINITIES,
            type=lambda x: x.upper(),
            default='NONE',
            help='The session affinity option for the target pool.')
        session_affinity.detailed_help = """\
        Specifies the session affinity option for the connection.
        If ``NONE'' is selected, then connections from the same client
        IP address may go to any instance in the target pool.
        If ``CLIENT_IP'' is selected, then connections
        from the same client IP address will go to the same instance
        in the target pool.
        If ``CLIENT_IP_PROTO'' is selected, then connections from the same
        client IP with the same IP protocol will go to the same client pool.
        If not specified, then ``NONE'' is used as a default.
        """

        parser.add_argument('name', help='The name of the target pool.')
コード例 #13
0
 def Args(parser, resource=None, cli=None, command=None):
   BaseDeleter.AddArgs(parser, resource, cli, command)
   utils.AddRegionFlag(
       parser, resource_type='resources', operation_type='delete', cli=cli)