def Args(parser):
    parser.add_argument(
        'name',
        help='The name of the instance group.')

    parser.add_argument(
        '--limit',
        type=arg_parsers.BoundedInt(1, sys.maxint),
        help='The maximum number of results.')

    sort_by = parser.add_argument(
        '--sort-by',
        help='A field to sort by.')
    sort_by.detailed_help = """\
        A field to sort by. To perform a descending-order sort, prefix
        the value of this flag with a tilde (``~'').
        """

    uri = parser.add_argument(
        '--uri',
        action='store_true',
        help='If provided, a list of URIs is printed instead of a table.')
    uri.detailed_help = """\
        If provided, the list command will only print URIs for the
        resources returned.  If this flag is not provided, the list
        command will print a human-readable table of useful resource
        data.
        """

    utils.AddZoneFlag(
        parser,
        resource_type='instance group',
        operation_type='list instances in')
  def Args(parser):
    parser.add_argument(
        'group',
        help='The name of the instance group.')

    parser.add_argument(
        '--named-ports',
        required=True,
        type=arg_parsers.ArgList(),
        action=arg_parsers.FloatingListValuesCatcher(),
        metavar='NAME:PORT',
        help="""\
            The comma-separated list of key:value pairs representing
            the service name and the port that it is running on.

            To clear the list of named ports pass empty list as flag value.
            For example:

              $ {command} example-instance-group --named-ports ""
            """)

    utils.AddZoneFlag(
        parser,
        resource_type='instance group',
        operation_type='set named ports for')
Esempio n. 3
0
 def Args(parser):
   utils.AddZoneFlag(
       parser,
       resource_type='instance',
       operation_type='set tags on')
   parser.add_argument(
       'name',
       metavar='NAME',
       completion_resource='compute.instances',
       help='The name of the instance whose tags should be modified.')
  def Args(parser):
    parser.add_argument(
        'name',
        help='The name of the instance group.')

    parser.add_argument(
        '--limit',
        type=arg_parsers.BoundedInt(1, sys.maxint),
        help='The maximum number of results.')

    sort_by = parser.add_argument(
        '--sort-by',
        help='A field to sort by.')
    sort_by.detailed_help = """\
        A field to sort by. To perform a descending-order sort, prefix
        the value of this flag with a tilde (``~'').
        """

    utils.AddZoneFlag(
        parser,
        resource_type='instance or instance group',
        operation_type='get named ports for')
Esempio n. 5
0
 def Args(parser, resource=None, command=None):
   BaseDescriber.AddArgs(parser, resource, command)
   utils.AddZoneFlag(
       parser,
       resource_type='resource',
       operation_type='fetch')
Esempio n. 6
0
 def Args(parser, resource=None, command=None):
   BaseDeleter.AddArgs(parser, resource, command)
   utils.AddZoneFlag(
       parser, resource_type='resources', operation_type='delete')
def AddUpdatableBackendArgs(parser, compute_messages):
    """Adds arguments for manipulating backends in a backend service."""
    parser.add_argument(
        '--description',
        help='An optional, textual description for the backend.')

    g = parser.add_mutually_exclusive_group(required=True)

    g.add_argument(
        '--group',
        help=('The name of the legacy instance group '
              '(deprecated resourceViews API) that will receive the traffic. '
              'Use --instance-group flag instead.'))

    g.add_argument(
        '--instance-group',
        help=(
            'The name or URI of a Google Cloud Instance Group that can receive'
            ' traffic.'))

    utils.AddZoneFlag(parser,
                      resource_type='instance group',
                      operation_type='add to the backend service')

    balancing_mode = parser.add_argument(
        '--balancing-mode',
        choices=BalancingModes(compute_messages.Backend),
        type=lambda x: x.upper(),
        help='Defines the strategy for balancing load.')
    balancing_mode.detailed_help = """\
      Defines the strategy for balancing load. ``UTILIZATION'' will
      rely on the CPU utilization of the instances in the group when
      balancing load. When using ``UTILIZATION'',
      ``--max-utilization'' can be used to set a maximum target CPU
      utilization for each instance. ``RATE'' will spread load based on
      how many requests per second (RPS) the group can handle. There
      are two ways to specify max RPS: ``--max-rate'' which defines
      the max RPS for the whole group or ``--max-rate-per-instance'',
      which defines the max RPS on a per-instance basis.

      In ``UTILIZATION'', you can optionally limit based on RPS in
      addition to CPU by setting either ``--max-rate-per-instance'' or
      ``--max-rate''.
      """

    max_utilization = parser.add_argument(
        '--max-utilization',
        type=float,
        help=('The target CPU utilization of the group as a '
              'float in the range [0.0, 1.0].'))
    max_utilization.detailed_help = """\
      The target CPU utilization for the group as a float in the range
      [0.0, 1.0]. This flag can only be provided when the balancing
      mode is ``UTILIZATION''.
      """

    rate_group = parser.add_mutually_exclusive_group()

    rate_group.add_argument(
        '--max-rate',
        type=int,
        help='Maximum requests per second (RPS) that the group can handle.')

    rate_group.add_argument(
        '--max-rate-per-instance',
        type=float,
        help='The maximum per-instance requests per second (RPS).')

    capacity_scaler = parser.add_argument(
        '--capacity-scaler',
        type=float,
        help=('A float in the range [0, 1.0] that scales the maximum '
              'parameters for the group (e.g., max rate).'))
    capacity_scaler.detailed_help = """\
Esempio n. 8
0
 def Args(parser, resource=None, command=None):
     BaseGetIamPolicy.AddArgs(parser, resource, command)
     utils.AddZoneFlag(parser,
                       resource_type='resource',
                       operation_type='fetch')