Example #1
0
 def Args(parser):
     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',
         required=True,
         help=
         ('The base name to use for the Compute Engine instances that will '
          'be created with the managed instance group.'))
     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.'))
     utils.AddZoneFlag(parser,
                       resource_type='instance group manager',
                       operation_type='create')
Example #2
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',
            metavar='SNAPSHOT_NAME',
            nargs='+',
            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-name 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='+',
                            help='The names of the disks to snapshot.')

        utils.AddZoneFlag(parser,
                          resource_type='disks',
                          operation_type='snapshot')
Example #3
0
    def Args(parser):
        utils.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',
            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 = """\
Example #4
0
  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):
        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',
            help='The name of the instance to detach the disk from.')

        utils.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='detach a disk from')
Example #6
0
    def Args(parser):
        metadata_utils.AddMetadataArgs(parser)

        instance_utils.AddDiskArgs(parser)
        instance_utils.AddImageArgs(parser)
        instance_utils.AddCanIpForwardArgs(parser)
        instance_utils.AddAddressArgs(parser)
        instance_utils.AddMachineTypeArgs(parser)
        instance_utils.AddMaintenancePolicyArgs(parser)
        instance_utils.AddNetworkArgs(parser)
        instance_utils.AddNoRestartOnFailureArgs(parser)
        instance_utils.AddScopeArgs(parser)
        instance_utils.AddTagsArgs(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.')

        utils.AddZoneFlag(parser,
                          resource_type='instances',
                          operation_type='create')
Example #7
0
  def Args(parser):
    parser.add_argument(
        'disk_names',
        metavar='DISK_NAME',
        nargs='+',
        completion_resource='compute.disks',
        help='The names of the disks to resize.')

    size = parser.add_argument(
        '--size',
        required=True,
        type=arg_parsers.BinarySize(lower_bound='1GB'),
        help='Indicates the new size of the disks.')
    size.detailed_help = """\
        Indicates the new 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.
        """

    utils.AddZoneFlag(
        parser,
        resource_type='disks',
        operation_type='be resized')
Example #8
0
 def Args(parser, resource=None, cli=None, command=None):
   BaseDescriber.AddArgs(parser, resource, cli, command)
   utils.AddZoneFlag(
       parser,
       resource_type='resource',
       operation_type='fetch',
       cli=cli)
Example #9
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-name 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.
        """

        disk = parser.add_argument('disk_names',
                                   metavar='DISK_NAME',
                                   nargs='+',
                                   help='The names of the disks to snapshot.')
        cli = SnapshotDisks.GetCLIGenerator()
        disk.completer = utils.GetCompleterForResource('compute.disks', cli)

        utils.AddZoneFlag(parser,
                          resource_type='disks',
                          operation_type='snapshot',
                          cli=cli)
Example #10
0
def _CommonArgs(parser, cli):
  """Register parser args common to all tracks."""
  metadata_utils.AddMetadataArgs(parser)
  instance_utils.AddDiskArgs(parser)
  instance_utils.AddLocalSsdArgs(parser)
  instance_utils.AddImageArgs(parser)
  instance_utils.AddCanIpForwardArgs(parser)
  instance_utils.AddAddressArgs(parser, instances=True)
  instance_utils.AddMachineTypeArgs(parser)
  instance_utils.AddMaintenancePolicyArgs(parser)
  instance_utils.AddNetworkArgs(parser)
  instance_utils.AddNoRestartOnFailureArgs(parser)
  instance_utils.AddPreemptibleVmArgs(parser)
  instance_utils.AddScopeArgs(parser)
  instance_utils.AddTagsArgs(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.')

  utils.AddZoneFlag(
      parser,
      resource_type='instances',
      operation_type='create',
      cli=cli)
Example #11
0
    def Args(parser):
        parser.add_argument(
            'name',
            metavar='INSTANCE',
            help='The name of the instance to attach the disk to.')

        parser.add_argument(
            '--device-name',
            help=('An optional name that indicates the disk name the guest '
                  'operating system will see.'))

        parser.add_argument(
            '--disk',
            help='The name of the disk to attach to the instance.',
            required=True)

        mode = parser.add_argument('--mode',
                                   choices=MODE_OPTIONS,
                                   default='rw',
                                   help='Specifies the mode of the disk.')
        mode.detailed_help = """\
        Specifies the mode of the disk. Supported options are ``ro'' for
        read-only and ``rw'' for read-write. If omitted, ``rw'' is used as
        a default. It is an error to attach a disk in read-write mode to
        more than one instance.
        """

        utils.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='attach a disk to')
Example #12
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.')

        utils.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='set scheduling settings for')
Example #13
0
  def Args(parser):
    parser.add_argument(
        'name',
        help='The name of the instance group.')

    parser.add_argument(
        '--names',
        required=True,
        type=arg_parsers.ArgList(min_length=1),
        action=arg_parsers.FloatingListValuesCatcher(),
        metavar='NAME',
        help='The names of the ports. The number of names must match '
        'the number of provided ports.')

    parser.add_argument(
        '--ports',
        required=True,
        type=arg_parsers.ArgList(element_type=int, min_length=1),
        action=arg_parsers.FloatingListValuesCatcher(),
        metavar='PORT',
        help='The port numbers. The number of ports must match '
        'the number of provided names.')

    utils.AddZoneFlag(
        parser,
        resource_type='instance group',
        operation_type='set named ports for')
Example #14
0
    def Args(parser):
        utils.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='start')

        parser.add_argument('name',
                            nargs='+',
                            help='The names of the instances to start.')
Example #15
0
 def Args(parser):
   parser.add_argument(
       'name',
       metavar='NAME',
       completion_resource='compute.instanceGroupManagers',
       help='Managed instance group which will no longer be autoscaled.')
   utils.AddZoneFlag(
       parser, resource_type='resources', operation_type='delete')
Example #16
0
 def Args(parser):
     parser.add_argument('name',
                         metavar='DISK',
                         help='The name of the disk to move.')
     parser.add_argument('--destination-zone',
                         help='The zone to move the disk to.',
                         required=True)
     utils.AddZoneFlag(parser, resource_type='disk', operation_type='move')
Example #17
0
    def Args(parser):
        utils.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.')
Example #18
0
 def Args(parser):
   utils.AddZoneFlag(
       parser,
       resource_type='instance',
       operation_type='set tags on')
   parser.add_argument(
       'name',
       metavar='NAME',
       help='The name of the instance whose tags should be modified.')
Example #19
0
 def Args(parser):
     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.')
     utils.AddZoneFlag(parser,
                       resource_type='managed instance group',
                       operation_type='wait until stable')
Example #20
0
 def Args(parser):
     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.'))
     utils.AddZoneFlag(parser,
                       resource_type='instance group manager',
                       operation_type='resize')
Example #21
0
 def Args(parser):
   parser.add_argument('name', help='Managed instance group name.')
   parser.add_argument(
       '--http-health-check',
       help=('Specifies the HTTP health check object used for autohealing '
             'instances in this group.'))
   utils.AddZoneFlag(
       parser,
       resource_type='instance group manager',
       operation_type='set autohealing policy')
Example #22
0
 def Args(parser):
     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 delete.')
     utils.AddZoneFlag(parser,
                       resource_type='instance group manager',
                       operation_type='delete instances')
Example #23
0
 def Args(parser):
     managed_instance_groups_utils.AddAutoscalerArgs(parser)
     parser.add_argument(
         'name',
         metavar='NAME',
         completion_resource='compute.instanceGroupManagers',
         help=
         'Managed instance group which autoscaling parameters will be set.')
     utils.AddZoneFlag(parser,
                       resource_type='resources',
                       operation_type='update')
Example #24
0
 def Args(parser, resource=None, cli=None, command=None):
     name = parser.add_argument(
         'name',
         metavar='NAME',
         help='Managed instance group which will no longer be autoscaled.')
     if cli:
         name.completer = utils.GetCompleterForResource(
             resource, cli, command)
     utils.AddZoneFlag(parser,
                       resource_type='resources',
                       operation_type='delete',
                       cli=cli)
Example #25
0
    def Args(parser):

        parser.add_argument(
            'name',
            metavar='NAME',
            help='The name of the instance for which to change machine type.')

        instance_utils.AddMachineTypeArgs(parser, required=True)

        utils.AddZoneFlag(parser,
                          resource_type='instance',
                          operation_type='set machine type for')
Example #26
0
 def Args(parser):
     parser.add_argument('name',
                         metavar='INSTANCE',
                         completion_resource='compute.instances',
                         help='The name of the instance to move.')
     parser.add_argument('--destination-zone',
                         completion_resource='compute.zones',
                         help='The zone to move the instance to.',
                         required=True)
     utils.AddZoneFlag(parser,
                       resource_type='instance',
                       operation_type='move')
Example #27
0
    def Args(parser):
        parser.add_argument(
            '--group',
            required=True,
            help=
            ('The name of a Compute Engine instance group used by the backend '
             'to be removed.'))

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

        parser.add_argument('name', help='The name of the backend service.')
Example #28
0
    def Args(parser):
        parser.add_argument(
            '--group',
            required=True,
            help=(
                'The name of a Google Cloud Resource View used by the backend '
                'to be removed.'))

        utils.AddZoneFlag(parser,
                          resource_type='resource view',
                          operation_type='remove from the backend service')

        parser.add_argument('name', help='The name of the backend service.')
Example #29
0
    def Args(parser):
        g = parser.add_mutually_exclusive_group(required=True)
        g.add_argument('--group',
                       help=('The name of the legacy instance group '
                             '(deprecated resourceViews API) to remove. '
                             'Use --instance-group flag instead.'))
        g.add_argument('--instance-group',
                       help='The name or URI of the instance group to remove.')

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

        parser.add_argument('name', help='The name of the backend service.')
Example #30
0
 def Args(parser, resource=None, cli=None, command=None):
     autoscaler_util.AddAutoscalerArgs(parser)
     name = parser.add_argument(
         'name',
         metavar='NAME',
         help=
         'Managed instance group which autoscaling parameters will be set.')
     if cli:
         name.completer = utils.GetCompleterForResource(
             resource, cli, command)
     utils.AddZoneFlag(parser,
                       resource_type='resources',
                       operation_type='update',
                       cli=cli)