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')
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' )
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. """)
def Args(cls, parser): compute_holder = cls._GetComputeApiHolder(no_http=True) messages = compute_holder.client.messages 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.AddOVFSourceUriArg(parser) if cls.ReleaseTrack() != base.ReleaseTrack.GA: image_utils.AddGuestOsFeaturesArgForImport(parser, messages) 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.') daisy_utils.AddByolArg(parser) 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' )) daisy_utils.AddComputeServiceAccountArg( parser, 'machine image 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 machine image 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', resource='machine image')