예제 #1
0
def _AddArgs(parser, multizonal):
  """Adds args."""
  parser.add_argument('name', help='Managed instance group name.')
  parser.add_argument(
      '--size',
      required=True,
      type=int,
      help=('Target number of instances in managed instance group.'))
  if multizonal:
    scope_parser = parser.add_mutually_exclusive_group()
    flags.AddRegionFlag(
        scope_parser,
        resource_type='instance group manager',
        operation_type='resize',
        explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
    flags.AddZoneFlag(
        scope_parser,
        resource_type='instance group manager',
        operation_type='resize',
        explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
  else:
    flags.AddZoneFlag(
        parser,
        resource_type='instance group manager',
        operation_type='resize')
예제 #2
0
def _AddArgs(parser, multizonal):
    """Add args."""
    parser.add_argument('name', help='Managed instance group name.')
    parser.add_argument(
        '--target-pools',
        required=True,
        type=arg_parsers.ArgList(min_length=0),
        metavar='TARGET_POOL',
        help=('Compute Engine Target Pools to add the instances to. '
              'Target Pools must be specified by name or by URL. Example: '
              '--target-pool target-pool-1,target-pool-2.'))
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='set target pools',
            explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='set target pools',
            explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
        flags.AddZoneFlag(parser,
                          resource_type='instance group manager',
                          operation_type='set target pools')
예제 #3
0
  def AddArgs(parser, multizonal):
    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 (``~'').
        """

    if multizonal:
      scope_parser = parser.add_mutually_exclusive_group()
      flags.AddRegionFlag(
          scope_parser,
          resource_type='instance or instance group',
          operation_type='get named ports for',
          explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
      flags.AddZoneFlag(
          scope_parser,
          resource_type='instance or instance group',
          operation_type='get named ports for',
          explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
      flags.AddZoneFlag(
          parser,
          resource_type='instance or instance group',
          operation_type='get named ports for')
예제 #4
0
def AddInstanceGroup(parser, operation_type, with_deprecated_zone=False):
    """Add arguments to define instance group."""
    parser.add_argument(
        '--instance-group',
        required=True,
        help='The name or URI of a Google Cloud Instance Group.')

    scope_parser = parser.add_mutually_exclusive_group()
    flags.AddRegionFlag(
        scope_parser,
        resource_type='instance group',
        operation_type='{0} the backend service'.format(operation_type),
        flag_prefix='instance-group',
        explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
    if with_deprecated_zone:
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group',
            operation_type='{0} the backend service'.format(operation_type),
            explanation='DEPRECATED, use --instance-group-zone flag instead.')
    flags.AddZoneFlag(
        scope_parser,
        resource_type='instance group',
        operation_type='{0} the backend service'.format(operation_type),
        flag_prefix='instance-group',
        explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
예제 #5
0
    def AddArgs(parser, multizonal):
        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 ""
            """)

        if multizonal:
            scope_parser = parser.add_mutually_exclusive_group()
            flags.AddRegionFlag(
                scope_parser,
                resource_type='instance group',
                operation_type='set named ports for',
                explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
            flags.AddZoneFlag(
                scope_parser,
                resource_type='instance group',
                operation_type='set named ports for',
                explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
        else:
            flags.AddZoneFlag(parser,
                              resource_type='instance group',
                              operation_type='set named ports for')
예제 #6
0
def _AddArgs(parser, multizonal):
    """Adds args."""
    parser.add_argument('name', help='Managed instance group name.')
    parser.add_argument('--instances',
                        type=arg_parsers.ArgList(min_length=1),
                        action=arg_parsers.FloatingListValuesCatcher(),
                        metavar='INSTANCE',
                        required=True,
                        help='Names of instances to recreate.')
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(
            scope_parser,
            resource_type='instance group',
            operation_type='recreate instances',
            explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='recreate instances',
            explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
        flags.AddZoneFlag(parser,
                          resource_type='instance group manager',
                          operation_type='recreate instances')
def _AddArgs(parser, multizonal):
  """Adds args."""
  parser.add_argument('name',
                      help='Name of the managed instance group.')
  parser.add_argument('--timeout',
                      type=int,
                      help='Timeout in seconds for waiting '
                      'for group becoming stable.')
  if multizonal:
    scope_parser = parser.add_mutually_exclusive_group()
    flags.AddRegionFlag(
        scope_parser,
        resource_type='managed instance group',
        operation_type='wait until stable',
        explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
    flags.AddZoneFlag(
        scope_parser,
        resource_type='managed instance group',
        operation_type='wait until stable',
        explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
  else:
    flags.AddZoneFlag(
        parser,
        resource_type='managed instance group',
        operation_type='wait until stable')
예제 #8
0
    def Args(parser):
        restart_on_failure = parser.add_argument(
            '--restart-on-failure',
            action='store_true',
            default=None,  # Tri-valued: None => don't change the setting.
            help='Restart instances if they are terminated by Compute Engine.')
        restart_on_failure.detailed_help = """\
        The instances will be restarted if they are terminated by Compute '
        Engine.  This does not affect terminations performed by the user.'
        """

        maintenance_policy = parser.add_argument(
            '--maintenance-policy',
            choices=MIGRATION_OPTIONS,
            type=lambda x: x.upper(),
            help=('Specifies the behavior of the instances when their host '
                  'machines undergo maintenance.'))
        maintenance_policy.detailed_help = """\
        Specifies the behavior of the instances when their host machines undergo
        maintenance. TERMINATE indicates that the instances should be
        terminated. MIGRATE indicates that the instances should be migrated to a
        new host. Choosing MIGRATE will temporarily impact the performance of
        instances during a migration event.
        """

        parser.add_argument(
            'name',
            metavar='INSTANCE',
            completion_resource='compute.instances',
            help=
            'The name of the instance for which to change scheduling options.')

        flags.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='set scheduling settings for')
예제 #9
0
    def Args(parser):
        # Use BaseSSHCommand args here, since we don't want --plain or
        # --strict-host-key-checking.
        ssh_utils.BaseSSHCommand.Args(parser)

        parser.add_argument(
            '--dry-run',
            action='store_true',
            help=('If provided, the ssh command is printed to standard out '
                  'rather than being executed.'))

        # This flag should be hidden for this command, but needs to exist.
        parser.add_argument('--plain',
                            action='store_true',
                            help=argparse.SUPPRESS)

        user_host = parser.add_argument(
            'user_host',
            completion_resource='compute.instances',
            help='Specifies the user/instance for the serial port connection',
            metavar='[USER@]INSTANCE')
        user_host.detailed_help = """\
        Specifies the user/instance for the serial port connection.

        ``USER'' specifies the username to authenticate as. If omitted,
        the current OS user is selected.
        """

        port = parser.add_argument(
            '--port',
            help=('The number of the requested serial port. '
                  'Can be 1-4, default is 1.'),
            type=arg_parsers.BoundedInt(1, 4))
        port.detailed_help = """\
        The number of the requested serial port. Can be 1-4, default is 1.

        Instances can support up to four serial ports. By default, this
        command will connect to the first serial port. Setting this flag
        will connect to the requested serial port.
        """

        extra_args = parser.add_argument(
            '--extra-args',
            help=('Extra key-value pairs to pass to the connection.'),
            type=arg_parsers.ArgDict(min_length=1),
            default={},
            metavar='KEY=VALUE')
        extra_args.detailed_help = """\
        Optional arguments can be passed to the serial port connection by
        passing key-value pairs to this flag, such as max-connections=N or
        replay-lines=N. See {0} for additional options.
        """.format(SERIAL_PORT_HELP)

        parser.add_argument('--serial-port-gateway',
                            help=argparse.SUPPRESS,
                            default=SERIAL_PORT_GATEWAY)

        flags.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='connect to')
예제 #10
0
def _CommonArgs(parser):
    """Add arguments used for parsing in all command tracks."""
    parser.add_argument(
        '--description',
        help=('An optional, textual description for the disks being created.'))

    size = parser.add_argument('--size',
                               type=arg_parsers.BinarySize(lower_bound='1GB'),
                               help='Indicates the size of the disks.')
    size.detailed_help = """\
      Indicates the size of the disks. The value must be a whole
      number followed by a size unit of ``KB'' for kilobyte, ``MB''
      for megabyte, ``GB'' for gigabyte, or ``TB'' for terabyte. For
      example, ``10GB'' will produce 10 gigabyte disks.  Disk size
      must be a multiple of 10 GB.
      """

    parser.add_argument('names',
                        metavar='NAME',
                        nargs='+',
                        help='The names of the disks to create.')

    disk_type = parser.add_argument(
        '--type', help='Specifies the type of disk to create.')
    disk_type.detailed_help = """\
      Specifies the type of disk to create. To get a
      list of available disk types, run 'gcloud compute
      disk-types list'. The default disk type is pd-standard.
      """

    flags.AddZoneFlag(parser, resource_type='disks', operation_type='create')
    def Args(parser):
        flags.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='configure disk auto-delete for')

        parser.add_argument(
            'name',
            metavar='INSTANCE',
            completion_resource='compute.instances',
            help=('The name of the instance for which to configure disk '
                  'auto-deletion.'))

        parser.add_argument('--auto-delete',
                            action='store_true',
                            help='Enables auto-delete for the given disk.')

        disk_group = parser.add_mutually_exclusive_group(required=True)

        disk = disk_group.add_argument(
            '--disk',
            help=('Specify a disk to set auto-delete for by persistent disk '
                  'name.'))
        disk.detailed_help = """\
        Specifies a disk to set auto-delete for by its resource name. If
        you specify a disk to set auto-delete for by persistent disk name,
        then you must not specify its device name using the
        ``--device-name'' flag.
        """

        device_name = disk_group.add_argument(
            '--device-name',
            help=('Specify a disk to set auto-delete for by the name the '
                  'guest operating system sees.'))
        device_name.detailed_help = """\
  def Args(parser):
    flags.AddZoneFlag(
        parser,
        resource_type='instance',
        operation_type='delete an access config from')

    access_config_name = parser.add_argument(
        '--access-config-name',
        default=constants.DEFAULT_ACCESS_CONFIG_NAME,
        help='Specifies the name of the access configuration to delete.')
    access_config_name.detailed_help = """\
        Specifies the name of the access configuration to delete.
        ``{0}'' is used as the default if this flag is not provided.
        """.format(constants.DEFAULT_ACCESS_CONFIG_NAME)

    parser.add_argument(
        'name',
        completion_resource='compute.instances',
        help=('The name of the instance from which to delete the access '
              'configuration.'))

    network_interface = parser.add_argument(
        '--network-interface',
        default='nic0',
        help=('Specifies the name of the network interface from which to '
              'delete the access configuration.'))
    network_interface.detailed_help = """\
예제 #13
0
def _CommonArgs(parser):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instance_utils.AddDiskArgs(parser)
    instance_utils.AddLocalSsdArgs(parser)
    instance_utils.AddCanIpForwardArgs(parser)
    instance_utils.AddAddressArgs(parser, instances=True)
    instance_utils.AddMachineTypeArgs(parser)
    instance_utils.AddMaintenancePolicyArgs(parser)
    instance_utils.AddNoRestartOnFailureArgs(parser)
    instance_utils.AddPreemptibleVmArgs(parser)
    instance_utils.AddScopeArgs(parser)
    instance_utils.AddTagsArgs(parser)
    instance_utils.AddCustomMachineTypeArgs(parser)
    instance_utils.AddNetworkArgs(parser)
    instance_utils.AddPrivateNetworkIpArgs(parser)
    instance_utils.AddImageArgs(parser)

    parser.add_argument(
        '--description',
        help='Specifies a textual description of the instances.')

    parser.add_argument('names',
                        metavar='NAME',
                        nargs='+',
                        help='The names of the instances to create.')

    flags.AddZoneFlag(parser,
                      resource_type='instances',
                      operation_type='create')
예제 #14
0
    def Args(parser):
        parser.add_argument(
            '--description',
            help=('An optional, textual description for the snapshots being '
                  'created.'))

        snapshot_names = parser.add_argument(
            '--snapshot-names',
            type=arg_parsers.ArgList(min_length=1),
            action=arg_parsers.FloatingListValuesCatcher(),
            metavar='SNAPSHOT_NAME',
            help='Names to assign to the snapshots.')
        snapshot_names.detailed_help = """\
        Names to assign to the snapshots. Without this option, the
        name of each snapshot will be a random, 16-character
        hexadecimal number that starts with a letter. The values of
        this option run parallel to the disks specified. For example,

          $ {command} my-disk-1 my-disk-2 my-disk-3 --snapshot-names snapshot-1,snapshot-2,snapshot-3

        will result in ``my-disk-1'' being snapshotted as
        ``snapshot-1'', ``my-disk-2'' as ``snapshot-2'', and so on.
        """

        parser.add_argument('disk_names',
                            metavar='DISK_NAME',
                            nargs='+',
                            completion_resource='compute.disks',
                            help='The names of the disks to snapshot.')

        flags.AddZoneFlag(parser,
                          resource_type='disks',
                          operation_type='snapshot')
예제 #15
0
    def Args(parser):
        disk_group = parser.add_mutually_exclusive_group(required=True)

        disk_name = disk_group.add_argument(
            '--disk', help='Specify a disk to remove by persistent disk name.')
        disk_name.detailed_help = """\
        Specifies a disk to detach by its resource name. If you specify a
        disk to remove by persistent disk name, then you must not specify its
        device name using the ``--device-name'' flag.
        """

        device_name = disk_group.add_argument(
            '--device-name',
            help=('Specify a disk to remove by the name the guest operating '
                  'system sees.'))
        device_name.detailed_help = """\
        Specifies a disk to detach by its device name, which is the name
        that the guest operating system sees. The device name is set
        at the time that the disk is attached to the instance, and needs not be
        the same as the persistent disk name. If the disk's device name is
        specified, then its persistent disk name must not be specified
        using the ``--disk'' flag.
        """

        parser.add_argument(
            'name',
            metavar='NAME',
            completion_resource='compute.instances',
            help='The name of the instance to detach the disk from.')

        flags.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='detach a disk from')
예제 #16
0
def AddInstanceGroup(parser, multizonal=False):
    """Add arguments to define instance group."""
    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.'))

    scope_parser = parser
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(scope_parser,
                            resource_type='instance group',
                            operation_type='add to the backend service')
    flags.AddZoneFlag(scope_parser,
                      resource_type='instance group',
                      operation_type='add to the backend service')
예제 #17
0
def _Args(parser):
    """Argument parsing for ssh, including hook for remote completion."""
    ssh_utils.BaseSSHCLIHelper.Args(parser)

    parser.add_argument('--command',
                        help="""\
      A command to run on the virtual machine.

      Runs the command on the target instance and then exits.
      """)

    parser.add_argument('--ssh-flag',
                        action='append',
                        help="""\
      Additional flags to be passed to *ssh(1)*. It is recommended that flags
      be passed using an assignment operator and quotes. This flag will
      replace occurences of ``%USER%'' and ``%INSTANCE%'' with their
      dereferenced values. Example:

        $ {command} example-instance --zone us-central1-a --ssh-flag="-vvv" --ssh-flag="-L 80:%INSTANCE%:80"

      is equivalent to passing the flags ``--vvv'' and ``-L
      80:162.222.181.197:80'' to *ssh(1)* if the external IP address of
      'example-instance' is 162.222.181.197.
      """)

    parser.add_argument('--container',
                        help="""\
          The name or ID of a container inside of the virtual machine instance
          to connect to. This only applies to virtual machines that are using
          a Google Container-Optimized virtual machine image. For more
          information, see [](https://cloud.google.com/compute/docs/containers)
          """)

    parser.add_argument('user_host',
                        completer=completers.InstancesCompleter,
                        metavar='[USER@]INSTANCE',
                        help="""\
      Specifies the instance to SSH into.

      ``USER'' specifies the username with which to SSH. If omitted,
      $USER from the environment is selected.

      ``INSTANCE'' specifies the name of the virtual machine instance to SSH
      into.
      """)

    parser.add_argument('ssh_args',
                        nargs=argparse.REMAINDER,
                        help="""\
          Flags and positionals passed to the underlying ssh implementation.
          """,
                        example="""\
        $ {command} example-instance --zone us-central1-a -- -vvv -L 80:%INSTANCE%:80
      """)

    flags.AddZoneFlag(parser,
                      resource_type='instance',
                      operation_type='connect to')
예제 #18
0
  def Args(parser):
    """Set up arguments for this command.

    Args:
      parser: An argparse.ArgumentParser.
    """
    ssh_utils.BaseSSHHelper.Args(parser)

    parser.add_argument(
        '--dry-run',
        action='store_true',
        help=('If provided, the ssh command is printed to standard out '
              'rather than being executed.'))

    parser.add_argument(
        'user_host',
        completer=completers.InstancesCompleter,
        metavar='[USER@]INSTANCE',
        help="""\
        Specifies the user/instance for the serial port connection.

        ``USER'' specifies the username to authenticate as. If omitted,
        the current OS user is selected.
        """)

    parser.add_argument(
        '--port',
        default=1,
        help="""\
        The number of the requested serial port. Can be 1-4, default is 1.

        Instances can support up to four serial ports. By default, this
        command will connect to the first serial port. Setting this flag
        will connect to the requested serial port.
        """)

    parser.add_argument(
        '--extra-args',
        type=arg_parsers.ArgDict(min_length=1),
        default={},
        metavar='KEY=VALUE',
        help="""\
        Optional arguments can be passed to the serial port connection by
        passing key-value pairs to this flag, such as max-connections=N or
        replay-lines=N. See {0} for additional options.
        """.format(SERIAL_PORT_HELP))

    parser.add_argument(
        '--serial-port-gateway',
        hidden=True,
        help='THIS ARGUMENT NEEDS HELP TEXT.',
        default=SERIAL_PORT_GATEWAY)

    flags.AddZoneFlag(
        parser,
        resource_type='instance',
        operation_type='connect to')

    ssh_utils.AddSSHKeyExpirationArgs(parser)
예제 #19
0
  def ListInstancesArgs(parser, multizonal=False):
    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.
        """

    if multizonal:
      scope_parser = parser.add_mutually_exclusive_group()
      flags.AddRegionFlag(
          scope_parser,
          resource_type='instance group',
          operation_type='list instances in',
          explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
      flags.AddZoneFlag(
          scope_parser,
          resource_type='instance group',
          operation_type='list instances in',
          explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
      flags.AddZoneFlag(
          parser,
          resource_type='instance group',
          operation_type='list instances in')
예제 #20
0
 def Args(parser):
     flags.GetTPUNameArg().AddToParser(parser)
     compute_flags.AddZoneFlag(
         parser,
         resource_type='tpu',
         operation_type='describe',
         explanation=('Zone in which TPU lives. '
                      'If not specified, will use `default` compute/zone.'))
예제 #21
0
 def Args(cls, parser):
     flags.AddZoneFlag(parser, resource_type='tpu', operation_type='resume')
     tpus_flags.AddTpuNameArg(parser)
     tpus_flags.GetAcceleratorTypeFlag().AddToParser(parser)
     tpus_flags.AddTfVersionFlagForResume(parser)
     tpus_flags.AddPreemptibleFlag(parser)
     tpus_flags.AddVmOnlyFlag(parser)
     tpus_flags.AddNetworkArgsForResume(parser)
예제 #22
0
 def Args(parser):
     parser.display_info.AddFormat(cli_util.LIST_FORMAT)
     compute_flags.AddZoneFlag(
         parser,
         resource_type='tpu',
         operation_type='list',
         explanation=(
             'List TPUs from this Region. '
             'If not specified, will list TPUs in `default` compute/zone.'))
예제 #23
0
 def Args(parser):
     flags.GetTPUNameArg().AddToParser(parser)
     compute_flags.AddZoneFlag(
         parser,
         resource_type='tpu',
         operation_type='delete',
         explanation=('Zone in which TPU lives. '
                      'If not specified, will use `default` compute/zone.'))
     parser.display_info.AddCacheUpdater(None)
예제 #24
0
def AddScopeArgs(parser, multizonal):
    """Adds flags for group scope."""
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(
            scope_parser,
            resource_type='instance group',
            operation_type='set named ports for',
            explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group',
            operation_type='set named ports for',
            explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
        flags.AddZoneFlag(parser,
                          resource_type='instance group',
                          operation_type='set named ports for')
예제 #25
0
    def Args(parser):
        flags.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='stop')

        parser.add_argument('name',
                            nargs='+',
                            completion_resource='compute.instances',
                            help='The names of the instances to stop.')
예제 #26
0
def _AddArgs(parser, multizonal):
  """Adds args."""
  parser.add_argument('name', help='Managed instance group name.')
  parser.add_argument(
      '--template',
      required=True,
      help=('Specifies the instance template to use when creating new '
            'instances.'))
  parser.add_argument(
      '--base-instance-name',
      help=('The base name to use for the Compute Engine instances that will '
            'be created with the managed instance group. If not provided '
            'base instance name will be the prefix of instance group name.'))
  parser.add_argument(
      '--size',
      required=True,
      help=('The initial number of instances you want in this group.'))
  parser.add_argument(
      '--description',
      help='An optional description for this group.')
  parser.add_argument(
      '--target-pool',
      type=arg_parsers.ArgList(),
      action=arg_parsers.FloatingListValuesCatcher(),
      metavar='TARGET_POOL',
      help=('Specifies any target pools you want the instances of this '
            'managed instance group to be part of.'))
  if multizonal:
    scope_parser = parser.add_mutually_exclusive_group()
    flags.AddRegionFlag(
        scope_parser,
        resource_type='instance group manager',
        operation_type='create',
        explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
    flags.AddZoneFlag(
        scope_parser,
        resource_type='instance group manager',
        operation_type='create',
        explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
  else:
    flags.AddZoneFlag(
        parser,
        resource_type='instance group manager',
        operation_type='create')
예제 #27
0
    def Args(cls, parser):
        """Set up arguments for this command.

    Args:
      parser: An argparse.ArgumentParser.
    """
        ssh_utils.BaseSSHCLIHelper.Args(parser)
        tpu_ssh_utils.AddTPUSSHArgs(parser, cls.enable_iap)
        AddSCPArgs(parser)
        flags.AddZoneFlag(parser, resource_type='tpu', operation_type='scp')
def _AddArgs(parser, multizonal):
    """Adds args."""
    parser.add_argument('name', help='Managed instance group name.')
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='stop proactive update instances',
            explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='stop proactive update instances',
            explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
        flags.AddZoneFlag(parser,
                          resource_type='instance group manager',
                          operation_type='stop proactive update instances')
예제 #29
0
    def ListInstancesArgs(parser, multizonal=False):
        parser.add_argument('name', help='The name of the instance group.')

        if multizonal:
            scope_parser = parser.add_mutually_exclusive_group()
            flags.AddRegionFlag(
                scope_parser,
                resource_type='instance group',
                operation_type='list instances in',
                explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
            flags.AddZoneFlag(
                scope_parser,
                resource_type='instance group',
                operation_type='list instances in',
                explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
        else:
            flags.AddZoneFlag(parser,
                              resource_type='instance group',
                              operation_type='list instances in')
예제 #30
0
def _AddArgs(parser, multizonal):
    """Adds args."""
    parser.add_argument('name', help='Managed instance group name.')
    managed_instance_groups_utils.AddAutohealingArgs(parser)
    if multizonal:
        scope_parser = parser.add_mutually_exclusive_group()
        flags.AddRegionFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='set autohealing policy',
            explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)
        flags.AddZoneFlag(
            scope_parser,
            resource_type='instance group manager',
            operation_type='set autohealing policy',
            explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT)
    else:
        flags.AddZoneFlag(parser,
                          resource_type='instance group manager',
                          operation_type='set autohealing policy')