def Args(cls, parser):
        compute_holder = cls._GetComputeApiHolder(no_http=True)
        messages = compute_holder.client.messages

        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDeletionProtectionFlag(parser)
        instances_flags.AddNetworkTierArgs(parser, instance=True)
        instances_flags.AddNoAddressArg(parser)
        labels_util.AddCreateLabelsFlags(parser)
        daisy_utils.AddCommonDaisyArgs(parser, operation='an import')
        daisy_utils.AddExtraCommonDaisyArgs(parser)
        instances_flags.INSTANCES_ARG_FOR_IMPORT.AddArgument(
            parser, operation_type='import')
        daisy_utils.AddOVFSourceUriArg(parser)
        parser.add_argument(
            '--os',
            required=False,
            choices=sorted(cls._OS_CHOICES),
            help='Specifies the OS of the image being imported.')
        daisy_utils.AddByolArg(parser)

        if cls.ReleaseTrack() != base.ReleaseTrack.GA:
            image_utils.AddGuestOsFeaturesArgForImport(parser, messages)

        parser.add_argument(
            '--description',
            help='Specifies a textual description of the VM instances.')
        daisy_utils.AddGuestEnvironmentArg(parser)
        parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
        sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)
        parser.add_argument('--hostname',
                            help="""\
      Specify the hostname of the VM instance to be imported. The specified
      hostname must be RFC1035 compliant. If hostname is not specified, the
      default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using
      the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal
      when using zonal DNS.
      """)
        daisy_utils.AddComputeServiceAccountArg(
            parser, 'instance import',
            daisy_utils.IMPORT_ROLES_FOR_COMPUTE_SERVICE_ACCOUNT)
        instances_flags.AddServiceAccountAndScopeArgs(
            parser,
            False,
            extra_scopes_help=(
                'However, if neither `--scopes` nor `--no-scopes` are '
                'specified and the project has no default service '
                'account, then the VM instance is imported with no '
                'scopes. Note that the level of access that a service '
                'account has is determined by a combination of access '
                'scopes and IAM roles so you must configure both '
                'access scopes and IAM roles for the service account '
                'to work properly.'),
            operation='Import')
Ejemplo n.º 2
0
 def Args(cls, parser):
     super(ImportBeta, cls).Args(parser)
     daisy_utils.AddExtraCommonDaisyArgs(parser)
     parser.add_argument(
         '--sysprep-windows',
         action='store_true',
         hidden=True,
         help='Whether to generalize the image using Windows Sysprep.')
Ejemplo n.º 3
0
    def Args(cls, parser):
        super(ImportBeta, cls).Args(parser)
        daisy_utils.AddExtraCommonDaisyArgs(parser)

        parser.add_argument('--storage-location',
                            help="""\
      Cloud Storage location, either regional or multi-regional, where
      image content is to be stored. If absent, the multi-region location
      closest to the source is chosen automatically.
      """)
Ejemplo n.º 4
0
    def Args(cls, parser):
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDeletionProtectionFlag(parser)
        instances_flags.AddNetworkTierArgs(parser, instance=True)
        labels_util.AddCreateLabelsFlags(parser)
        daisy_utils.AddCommonDaisyArgs(parser, add_log_location=False)
        daisy_utils.AddExtraCommonDaisyArgs(parser)

        instances_flags.INSTANCES_ARG_FOR_IMPORT.AddArgument(
            parser, operation_type='import')

        parser.add_argument(
            '--source-uri',
            required=True,
            help=('Google Cloud Storage path to one of:\n  OVF descriptor\n  '
                  'OVA file\n  Directory with OVF package'))

        parser.add_argument(
            '--os',
            required=False,
            choices=sorted(os_choices.OS_CHOICES_INSTANCE_IMPORT_BETA),
            help='Specifies the OS of the image being imported.')

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

        parser.add_argument(
            '--guest-environment',
            action='store_true',
            default=True,
            help='Google Guest Environment will be installed on the instance.')

        parser.display_info.AddCacheUpdater(completers.InstancesCompleter)

        sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

        parser.add_argument('--hostname',
                            help="""\
      Specify the hostname of the instance to be imported. The specified
      hostname must be RFC1035 compliant. If hostname is not specified, the
      default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using
      the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal
      when using zonal DNS.
      """)
Ejemplo n.º 5
0
  def Args(cls, parser):
    parser.display_info.AddFormat(machine_image_flags.DEFAULT_LIST_FORMAT)
    Import.MACHINE_IMAGE_ARG = machine_image_flags.MakeMachineImageArg()
    Import.MACHINE_IMAGE_ARG.AddArgument(parser, operation_type='import')
    parser.add_argument(
        '--description',
        help='Specifies a text description of the machine image.')
    flags.AddStorageLocationFlag(parser, "machine image's")
    flags.AddGuestFlushFlag(parser, 'machine image')

    machine_image_flags.AddNoRestartOnFailureArgs(parser)
    machine_image_flags.AddTagsArgs(parser)
    machine_image_flags.AddCanIpForwardArgs(parser)
    machine_image_flags.AddNetworkArgs(parser)
    machine_image_flags.AddNetworkTierArgs(parser)

    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    labels_util.AddCreateLabelsFlags(parser)
    daisy_utils.AddCommonDaisyArgs(
        parser, operation='an import')
    daisy_utils.AddExtraCommonDaisyArgs(parser)
    daisy_utils.AddOVFSourceUriArg(parser)
    parser.add_argument(
        '--os',
        required=False,
        choices=sorted(os_choices.OS_CHOICES_INSTANCE_IMPORT_BETA),
        help='Specifies the OS of the machine image being imported.')
    flags.AddZoneFlag(
        parser,
        'machine image',
        'import',
        explanation='The zone in which to perform the import of the machine image. '
        + flags.ZONE_PROPERTY_EXPLANATION)
    daisy_utils.AddGuestEnvironmentArg(parser, 'machine image')
    parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
    daisy_utils.AddNoAddressArg(
        parser,
        'machine image import',
        docs_url='https://cloud.google.com/nat/docs/gce-example#create-nat '
        + 'and https://cloud.google.com/vpc/docs/private-access-options#pga'
    )
Ejemplo n.º 6
0
    def Args(cls, parser):
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDeletionProtectionFlag(parser)
        instances_flags.AddNetworkTierArgs(parser, instance=True)
        instances_flags.AddNoAddressArg(parser)
        labels_util.AddCreateLabelsFlags(parser)
        daisy_utils.AddCommonDaisyArgs(parser)
        daisy_utils.AddExtraCommonDaisyArgs(parser)

        instances_flags.INSTANCES_ARG_FOR_IMPORT.AddArgument(
            parser, operation_type='import')

        daisy_utils.AddOVFSourceUriArg(parser)

        parser.add_argument(
            '--os',
            required=False,
            choices=sorted(cls._OS_CHOICES),
            help='Specifies the OS of the image being imported.')

        parser.add_argument(
            '--description',
            help='Specifies a textual description of the instances.')
        daisy_utils.AddGuestEnvironmentArg(parser)
        parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
        sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

        parser.add_argument('--hostname',
                            help="""\
      Specify the hostname of the instance to be imported. The specified
      hostname must be RFC1035 compliant. If hostname is not specified, the
      default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using
      the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal
      when using zonal DNS.
      """)
Ejemplo n.º 7
0
  def Args(cls, parser):
    parser.add_argument(
        '--source-os',
        required=True,
        choices=sorted(_OS_CHOICES_SOURCE),
        help='OS version of the source instance to upgrade.')
    parser.add_argument(
        '--target-os',
        required=True,
        choices=sorted(_OS_CHOICES_TARGET),
        help='Version of the OS after upgrade.')

    parser.add_argument(
        '--create-machine-backup',
        required=False,
        action='store_true',
        default=True,
        help='When enabled, a machine image is created that backs up the '
             'original state of your instance.')
    parser.add_argument(
        '--auto-rollback',
        required=False,
        action='store_true',
        help='When auto rollback is enabled, the instance and its resources '
             'are restored to their original state. Otherwise, the instance '
             'and any temporary resources are left in the intermediate state '
             'of the time of failure. This is useful for debugging.')
    parser.add_argument(
        '--use-staging-install-media',
        required=False,
        action='store_true',
        help='Use staging install media. This flag is for testing only. Set to '
             'true to upgrade with staging windows install media.',
        hidden=True)

    daisy_utils.AddCommonDaisyArgs(parser)
    daisy_utils.AddExtraCommonDaisyArgs(parser)

    flags.INSTANCES_ARG_FOR_OS_UPGRADE.AddArgument(
        parser, operation_type=_OS_UPGRADE_OPERATION_TYPE)
Ejemplo n.º 8
0
 def Args(cls, parser):
     super(ExportBeta, cls).Args(parser)
     daisy_utils.AddExtraCommonDaisyArgs(parser)
 def Args(cls, parser):
     super(ImportAlpha, cls).Args(parser)
     daisy_utils.AddExtraCommonDaisyArgs(parser)