def Args(parser):
        """Register parser args."""
        metadata_utils.AddMetadataArgs(parser)
        instances_flags.AddDiskArgs(parser, True)
        instances_flags.AddCreateDiskArgs(parser)
        instances_flags.AddLocalSsdArgsWithSize(parser)
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddAddressArgs(parser, instances=True)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddMaintenancePolicyArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddPreemptibleVmArgs(parser)
        instances_flags.AddServiceAccountAndScopeArgs(parser, False)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddExtendedMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDockerArgs(parser)
        instances_flags.AddPublicDnsArgs(parser, instance=True)
        instances_flags.AddNetworkTierArgs(parser, instance=True)
        instances_flags.AddMinCpuPlatformArgs(parser)
        labels_util.AddCreateLabelsFlags(parser)

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

        instances_flags.INSTANCES_ARG.AddArgument(parser)
    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')
Пример #3
0
def _Args(parser, deprecate_maintenance_policy=False):
  """Add flags shared by all release tracks."""
  parser.display_info.AddFormat(instances_flags.DEFAULT_LIST_FORMAT)
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser, True)
  instances_flags.AddCreateDiskArgs(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(parser, instances=True)
  instances_flags.AddMachineTypeArgs(parser)
  instances_flags.AddMaintenancePolicyArgs(
      parser, deprecate=deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddKonletArgs(parser)
  instances_flags.AddPublicDnsArgs(parser, instance=True)
  instances_flags.AddPublicPtrArgs(parser, instance=True)
  instances_flags.AddImageArgs(parser)
  labels_util.AddCreateLabelsFlags(parser)

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

  instances_flags.INSTANCES_ARG.AddArgument(parser, operation_type='create')

  CreateWithContainer.SOURCE_INSTANCE_TEMPLATE = (
      instances_flags.MakeSourceInstanceTemplateArg())
  CreateWithContainer.SOURCE_INSTANCE_TEMPLATE.AddArgument(parser)
  parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
Пример #4
0
  def Args(parser):
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    instances_flags.AddCreateDiskArgs(parser)
    instances_flags.AddLocalSsdArgsWithSize(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(parser, instances=False)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddExtendedMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddDockerArgs(parser)
    instances_flags.AddMinCpuPlatformArgs(parser)

    flags.AddRegionFlag(
        parser,
        resource_type='instance template',
        operation_type='create')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    CreateFromContainer.InstanceTemplateArg = (
        instance_templates_flags.MakeInstanceTemplateArg())
    CreateFromContainer.InstanceTemplateArg.AddArgument(parser)
  def Args(parser):
    parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    instances_flags.AddCreateDiskArgs(parser)
    instances_flags.AddLocalSsdArgsWithSize(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser, multiple_network_interface_cards=False, instances=False)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser, deprecate=True)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddDockerArgs(parser)
    instances_flags.AddMinCpuPlatformArgs(parser, base.ReleaseTrack.ALPHA)
    instances_flags.AddNetworkTierArgs(parser, instance=True)

    flags.AddRegionFlag(
        parser,
        resource_type='instance template',
        operation_type='create')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    CreateFromContainer.InstanceTemplateArg = (
        instance_templates_flags.MakeInstanceTemplateArg())
    CreateFromContainer.InstanceTemplateArg.AddArgument(
        parser, operation_type='create')
Пример #6
0
def _Args(parser, release_track):
  """Add flags shared by all release tracks."""
  parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser)
  instances_flags.AddCreateDiskArgs(parser)
  instances_flags.AddLocalSsdArgsWithSize(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(parser, instances=False)
  instances_flags.AddMachineTypeArgs(parser)
  deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
  instances_flags.AddMaintenancePolicyArgs(parser, deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddKonletArgs(parser)
  instances_flags.AddImageArgs(parser)
  instances_flags.AddMinCpuPlatformArgs(parser, base.ReleaseTrack.ALPHA)

  flags.AddRegionFlag(
      parser,
      resource_type='instance template',
      operation_type='create')

  parser.add_argument(
      '--description',
      help='Specifies a textual description for the instance template.')

  CreateWithContainer.InstanceTemplateArg = (
      instance_templates_flags.MakeInstanceTemplateArg())
  CreateWithContainer.InstanceTemplateArg.AddArgument(
      parser, operation_type='create')
Пример #7
0
    def Args(parser):
        """Register parser args."""
        parser.display_info.AddFormat(instances_flags.DEFAULT_LIST_FORMAT)
        metadata_utils.AddMetadataArgs(parser)
        instances_flags.AddDiskArgs(parser, True)
        instances_flags.AddCreateDiskArgs(parser)
        instances_flags.AddLocalSsdArgsWithSize(parser)
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddAddressArgs(parser, instances=True)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddMaintenancePolicyArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddPreemptibleVmArgs(parser)
        instances_flags.AddServiceAccountAndScopeArgs(parser, False)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDockerArgs(parser)
        instances_flags.AddPublicDnsArgs(parser, instance=True)
        instances_flags.AddNetworkTierArgs(parser, instance=True)
        instances_flags.AddMinCpuPlatformArgs(parser, base.ReleaseTrack.ALPHA)
        labels_util.AddCreateLabelsFlags(parser)

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

        instances_flags.INSTANCES_ARG.AddArgument(parser,
                                                  operation_type='create')

        CreateFromContainer.SOURCE_INSTANCE_TEMPLATE = (
            instances_flags.MakeSourceInstanceTemplateArg())
        CreateFromContainer.SOURCE_INSTANCE_TEMPLATE.AddArgument(parser)
Пример #8
0
def _CommonArgs(parser, multiple_network_interface_cards,
                release_track):
  """Register parser args common to all tracks."""
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser)
  if release_track in [base.ReleaseTrack.ALPHA]:
    instances_flags.AddCreateDiskArgs(parser)
  instances_flags.AddLocalSsdArgs(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(
      parser, instances=True,
      multiple_network_interface_cards=multiple_network_interface_cards)
  instances_flags.AddMachineTypeArgs(parser)
  instances_flags.AddMaintenancePolicyArgs(parser)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddScopeArgs(parser)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddImageArgs(parser)

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

  instances_flags.INSTANCES_ARG.AddArgument(parser)

  csek_utils.AddCsekKeyArgs(parser)
Пример #9
0
    def Args(parser):
        metadata_utils.AddMetadataArgs(parser)
        instances_flags.AddDiskArgs(parser)
        instances_flags.AddCreateDiskArgs(parser)
        instances_flags.AddLocalSsdArgs(parser)
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddAddressArgs(parser, instances=False)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddMaintenancePolicyArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddPreemptibleVmArgs(parser)
        instances_flags.AddScopeArgs(parser)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddDockerArgs(parser)

        flags.AddRegionFlag(parser,
                            resource_type='instance template',
                            operation_type='create')

        parser.add_argument(
            '--description',
            help='Specifies a textual description for the instance template.')

        instance_templates_flags.INSTANCE_TEMPLATE_ARG.AddArgument(parser)
Пример #10
0
def _CommonArgs(parser, multiple_network_interface_cards, release_track):
    """Common arguments used in Alpha, Beta, and GA."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    if release_track in [base.ReleaseTrack.ALPHA]:
        instances_flags.AddCreateDiskArgs(parser)
    instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser,
        instances=False,
        multiple_network_interface_cards=multiple_network_interface_cards)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddScopeArgs(parser)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddNetworkArgs(parser)

    flags.AddRegionFlag(parser,
                        resource_type='instance template',
                        operation_type='create')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    instance_templates_flags.INSTANCE_TEMPLATE_ARG.AddArgument(parser)
def _Args(parser,
          release_track,
          container_mount_enabled=False,
          enable_guest_accelerators=False,
          support_multi_writer=True):
    """Add flags shared by all release tracks."""
    parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(
        parser, container_mount_enabled=container_mount_enabled)
    instances_flags.AddCreateDiskArgs(
        parser,
        container_mount_enabled=container_mount_enabled,
        support_multi_writer=support_multi_writer)
    if release_track == base.ReleaseTrack.ALPHA:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    elif release_track == base.ReleaseTrack.BETA:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddContainerMountDiskFlag(parser)
    instances_flags.AddAddressArgs(parser, instances=False, containers=True)
    instances_flags.AddMachineTypeArgs(parser)
    deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
    instances_flags.AddMaintenancePolicyArgs(parser,
                                             deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddKonletArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddMinCpuPlatformArgs(parser, release_track)
    instances_flags.AddNetworkTierArgs(parser, instance=True)
    instances_flags.AddConfidentialComputeArgs(parser)
    instances_flags.AddShieldedInstanceConfigArgs(parser)
    labels_util.AddCreateLabelsFlags(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)

    if enable_guest_accelerators:
        instances_flags.AddAcceleratorArgs(parser)

    flags.AddRegionFlag(parser,
                        resource_type='instance template',
                        operation_type='create')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    CreateWithContainer.InstanceTemplateArg = (
        instance_templates_flags.MakeInstanceTemplateArg())
    CreateWithContainer.InstanceTemplateArg.AddArgument(
        parser, operation_type='create')

    parser.display_info.AddCacheUpdater(completers.InstanceTemplatesCompleter)
Пример #12
0
def _CommonArgs(parser,
                release_track,
                support_public_dns,
                support_public_ptr,
                support_network_tier,
                enable_regional=False,
                support_local_ssd_size=False,
                enable_kms=False):
  """Register parser args common to all tracks."""
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser, enable_regional, enable_kms=enable_kms)
  if release_track in [base.ReleaseTrack.ALPHA]:
    instances_flags.AddCreateDiskArgs(parser, enable_kms=enable_kms)
  if support_local_ssd_size:
    instances_flags.AddLocalSsdArgsWithSize(parser)
  else:
    instances_flags.AddLocalSsdArgs(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(
      parser, instances=True,
      support_network_tier=support_network_tier)
  instances_flags.AddAcceleratorArgs(parser)
  instances_flags.AddMachineTypeArgs(parser)
  deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
  instances_flags.AddMaintenancePolicyArgs(parser, deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddImageArgs(parser)
  instances_flags.AddDeletionProtectionFlag(parser)
  if support_public_dns:
    instances_flags.AddPublicDnsArgs(parser, instance=True)
  if support_public_ptr:
    instances_flags.AddPublicPtrArgs(parser, instance=True)
  if support_network_tier:
    instances_flags.AddNetworkTierArgs(parser, instance=True)

  labels_util.AddCreateLabelsFlags(parser)
  instances_flags.AddMinCpuPlatformArgs(parser, release_track)

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

  instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
      parser, operation_type='create')

  csek_utils.AddCsekKeyArgs(parser)

  base.ASYNC_FLAG.AddToParser(parser)
  parser.display_info.AddFormat(
      resource_registry.RESOURCE_REGISTRY['compute.instances'].list_format)
Пример #13
0
def _CommonArgs(parser,
                enable_regional=False,
                enable_kms=False,
                enable_snapshots=False,
                deprecate_maintenance_policy=False,
                supports_display_device=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser, enable_regional, enable_kms=enable_kms)
    instances_flags.AddCreateDiskArgs(parser,
                                      enable_kms=enable_kms,
                                      enable_snapshots=enable_snapshots)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(parser, instances=True)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(
        parser, deprecate=deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    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 instance will be created with no '
        'scopes.')
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)
    instances_flags.AddHostnameArg(parser)
    instances_flags.AddImageArgs(parser, enable_snapshots=enable_snapshots)
    instances_flags.AddDeletionProtectionFlag(parser)
    instances_flags.AddPublicPtrArgs(parser, instance=True)
    instances_flags.AddNetworkTierArgs(parser, instance=True)
    if supports_display_device:
        instances_flags.AddDisplayDeviceArg(parser)

    sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

    labels_util.AddCreateLabelsFlags(parser)

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

    instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
        parser, operation_type='create')

    csek_utils.AddCsekKeyArgs(parser)

    base.ASYNC_FLAG.AddToParser(parser)
    parser.display_info.AddFormat(
        resource_registry.RESOURCE_REGISTRY['compute.instances'].list_format)
    parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
def _CommonArgs(parser,
                multiple_network_interface_cards,
                release_track,
                support_alias_ip_ranges,
                support_public_dns,
                support_network_tier,
                enable_regional=False,
                support_local_ssd_size=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser, enable_regional)
    if release_track in [base.ReleaseTrack.ALPHA]:
        instances_flags.AddCreateDiskArgs(parser)
    if release_track in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
        instances_flags.AddExtendedMachineTypeArgs(parser)
    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser,
        instances=True,
        multiple_network_interface_cards=multiple_network_interface_cards,
        support_alias_ip_ranges=support_alias_ip_ranges,
        support_network_tier=support_network_tier)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)
    instances_flags.AddImageArgs(parser)
    if support_public_dns:
        instances_flags.AddPublicDnsArgs(parser, instance=True)
    if support_network_tier:
        instances_flags.AddNetworkTierArgs(parser, instance=True)

    labels_util.AddCreateLabelsFlags(parser)

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

    instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
        parser, operation_type='create')

    csek_utils.AddCsekKeyArgs(parser)

    parser.display_info.AddFormat(
        resource_registry.RESOURCE_REGISTRY['compute.instances'].list_format)
Пример #15
0
def _CommonArgs(parser,
                release_track,
                support_source_instance,
                support_create_disk=False,
                support_network_tier=False,
                support_local_ssd_size=False,
                support_labels=False):
    """Adding arguments applicable for creating instance templates."""
    parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    if support_create_disk:
        instances_flags.AddCreateDiskArgs(parser)
    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(parser,
                                   instances=False,
                                   support_network_tier=support_network_tier)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
    instances_flags.AddMaintenancePolicyArgs(parser,
                                             deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddNetworkArgs(parser)

    if support_network_tier:
        instances_flags.AddNetworkTierArgs(parser, instance=True)

    if support_labels:
        labels_util.AddCreateLabelsFlags(parser)

    flags.AddRegionFlag(parser,
                        resource_type='subnetwork',
                        operation_type='attach')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    Create.InstanceTemplateArg = (
        instance_templates_flags.MakeInstanceTemplateArg())
    Create.InstanceTemplateArg.AddArgument(parser, operation_type='create')
    if support_source_instance:
        instance_templates_flags.MakeSourceInstanceArg().AddArgument(parser)
Пример #16
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.
      """)
Пример #17
0
def _CommonArgs(parser,
                multiple_network_interface_cards,
                release_track,
                support_alias_ip_ranges,
                support_network_tier,
                support_local_ssd_size=False):
  """Common arguments used in Alpha, Beta, and GA."""
  parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser)
  if release_track in [base.ReleaseTrack.ALPHA]:
    instances_flags.AddCreateDiskArgs(parser)
    instances_flags.AddExtendedMachineTypeArgs(parser)
  if release_track in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
    instances_flags.AddAcceleratorArgs(parser)
  if support_local_ssd_size:
    instances_flags.AddLocalSsdArgsWithSize(parser)
  else:
    instances_flags.AddLocalSsdArgs(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(
      parser, instances=False,
      multiple_network_interface_cards=multiple_network_interface_cards,
      support_alias_ip_ranges=support_alias_ip_ranges,
      support_network_tier=support_network_tier)
  instances_flags.AddMachineTypeArgs(parser)
  instances_flags.AddMaintenancePolicyArgs(parser)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddImageArgs(parser)
  instances_flags.AddNetworkArgs(parser)

  if support_network_tier:
    instances_flags.AddNetworkTierArgs(parser, instance=True)

  flags.AddRegionFlag(
      parser,
      resource_type='subnetwork',
      operation_type='attach')

  parser.add_argument(
      '--description',
      help='Specifies a textual description for the instance template.')

  Create.InstanceTemplateArg = (
      instance_templates_flags.MakeInstanceTemplateArg())
  Create.InstanceTemplateArg.AddArgument(parser)
def _Args(parser,
          deprecate_maintenance_policy=False,
          container_mount_enabled=False,
          support_multi_writer=True):
  """Add flags shared by all release tracks."""
  parser.display_info.AddFormat(instances_flags.DEFAULT_LIST_FORMAT)
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(
      parser, True, container_mount_enabled=container_mount_enabled)
  instances_flags.AddCreateDiskArgs(
      parser,
      container_mount_enabled=container_mount_enabled,
      support_multi_writer=support_multi_writer)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddContainerMountDiskFlag(parser)
  instances_flags.AddAddressArgs(parser, instances=True, containers=True)
  instances_flags.AddAcceleratorArgs(parser)
  instances_flags.AddMachineTypeArgs(parser)
  instances_flags.AddMaintenancePolicyArgs(
      parser, deprecate=deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddProvisioningModelVmArgs(parser)
  instances_flags.AddInstanceTerminationActionVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddNetworkPerformanceConfigsArgs(parser)
  instances_flags.AddShieldedInstanceConfigArgs(
      parser=parser, for_container=True)
  instances_flags.AddKonletArgs(parser)
  instances_flags.AddPublicPtrArgs(parser, instance=True)
  instances_flags.AddImageArgs(parser)
  instances_flags.AddConfidentialComputeArgs(parser)
  instances_flags.AddNestedVirtualizationArgs(parser)
  instances_flags.AddThreadsPerCoreArgs(parser)
  labels_util.AddCreateLabelsFlags(parser)

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

  instances_flags.INSTANCES_ARG.AddArgument(parser, operation_type='create')

  CreateWithContainer.SOURCE_INSTANCE_TEMPLATE = (
      instances_flags.MakeSourceInstanceTemplateArg())
  CreateWithContainer.SOURCE_INSTANCE_TEMPLATE.AddArgument(parser)
  parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
Пример #19
0
def _CommonArgs(parser,
                multiple_network_interface_cards,
                release_track,
                support_alias_ip_ranges,
                support_public_dns,
                support_network_tier,
                enable_regional=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser, enable_regional)
    if release_track in [base.ReleaseTrack.ALPHA]:
        instances_flags.AddCreateDiskArgs(parser)
        instances_flags.AddExtendedMachineTypeArgs(parser)
    if release_track in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
        instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser,
        instances=True,
        multiple_network_interface_cards=multiple_network_interface_cards,
        support_alias_ip_ranges=support_alias_ip_ranges,
        support_network_tier=support_network_tier)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)
    instances_flags.AddImageArgs(parser)
    if support_public_dns:
        instances_flags.AddPublicDnsArgs(parser, instance=True)
    if support_network_tier:
        instances_flags.AddNetworkTierArgs(parser, instance=True)

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

    instances_flags.INSTANCES_ARG.AddArgument(parser)

    csek_utils.AddCsekKeyArgs(parser)
Пример #20
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.
      """)
    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)

        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=True,
            choices=sorted(os_choices.OS_CHOICES_INSTANCE_IMPORT_ALPHA),
            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)
Пример #22
0
def _CommonArgs(parser,
                multiple_network_interface_cards,
                release_track,
                support_alias_ip_ranges,
                support_local_ssd_size=False):
    """Common arguments used in Alpha, Beta, and GA."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    if release_track in [base.ReleaseTrack.ALPHA]:
        instances_flags.AddCreateDiskArgs(parser)
        instances_flags.AddExtendedMachineTypeArgs(parser)
    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser,
        instances=False,
        multiple_network_interface_cards=multiple_network_interface_cards,
        support_alias_ip_ranges=support_alias_ip_ranges)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(parser)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddNetworkArgs(parser)

    flags.AddRegionFlag(parser,
                        resource_type='subnetwork',
                        operation_type='attach')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    instance_templates_flags.INSTANCE_TEMPLATE_ARG.AddArgument(parser)
Пример #23
0
    def Args(parser):
        """Register parser args."""
        metadata_utils.AddMetadataArgs(parser)
        instances_flags.AddDiskArgs(parser)
        instances_flags.AddLocalSsdArgs(parser)
        instances_flags.AddCanIpForwardArgs(parser)
        instances_flags.AddAddressArgs(parser, instances=True)
        instances_flags.AddMachineTypeArgs(parser)
        instances_flags.AddMaintenancePolicyArgs(parser)
        instances_flags.AddNoRestartOnFailureArgs(parser)
        instances_flags.AddPreemptibleVmArgs(parser)
        instances_flags.AddScopeArgs(parser)
        instances_flags.AddTagsArgs(parser)
        instances_flags.AddCustomMachineTypeArgs(parser)
        instances_flags.AddNetworkArgs(parser)
        instances_flags.AddPrivateNetworkIpArgs(parser)
        instances_flags.AddDockerArgs(parser)
        parser.add_argument(
            '--description',
            help='Specifies a textual description of the instances.')

        instances_flags.INSTANCES_ARG.AddArgument(parser)
def _CommonArgs(parser,
                release_track,
                support_source_instance,
                support_local_ssd_size=False,
                support_kms=False,
                support_multi_writer=False,
                support_mesh=False,
                support_host_error_timeout_seconds=False,
                support_numa_node_count=False,
                support_visible_core_count=False,
                support_disk_architecture=False,
                support_max_run_duration=False):
  """Adding arguments applicable for creating instance templates."""
  parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser, enable_kms=support_kms)
  instances_flags.AddCreateDiskArgs(
      parser,
      enable_kms=support_kms,
      support_boot=True,
      support_multi_writer=support_multi_writer,
      support_disk_architecture=support_disk_architecture)
  if support_local_ssd_size:
    instances_flags.AddLocalSsdArgsWithSize(parser)
  else:
    instances_flags.AddLocalSsdArgs(parser)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(parser, instances=False)
  instances_flags.AddAcceleratorArgs(parser)
  instances_flags.AddMachineTypeArgs(parser)
  deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
  instances_flags.AddMaintenancePolicyArgs(parser, deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  instances_flags.AddServiceAccountAndScopeArgs(parser, False)
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddImageArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddShieldedInstanceConfigArgs(parser)
  labels_util.AddCreateLabelsFlags(parser)
  instances_flags.AddNetworkTierArgs(parser, instance=True)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddMinNodeCpuArg(parser)
  instances_flags.AddNestedVirtualizationArgs(parser)
  instances_flags.AddThreadsPerCoreArgs(parser)
  instances_flags.AddEnableUefiNetworkingArgs(parser)
  instances_flags.AddResourceManagerTagsArgs(parser)
  if support_numa_node_count:
    instances_flags.AddNumaNodeCountArgs(parser)
  instances_flags.AddStackTypeArgs(parser)
  instances_flags.AddIpv6NetworkTierArgs(parser)
  maintenance_flags.AddResourcePoliciesArgs(parser, 'added to',
                                            'instance-template')
  instances_flags.AddProvisioningModelVmArgs(parser)
  instances_flags.AddInstanceTerminationActionVmArgs(parser)

  if support_max_run_duration:
    instances_flags.AddMaxRunDurationVmArgs(parser)

  instance_templates_flags.AddServiceProxyConfigArgs(
      parser, release_track=release_track)
  if support_mesh:
    instance_templates_flags.AddMeshArgs(parser)

  sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

  instances_flags.AddLocationHintArg(parser)

  if support_visible_core_count:
    instances_flags.AddVisibleCoreCountArgs(parser)

  instances_flags.AddNetworkPerformanceConfigsArgs(parser)

  flags.AddRegionFlag(
      parser, resource_type='subnetwork', operation_type='attach')

  parser.add_argument(
      '--description',
      help='Specifies a textual description for the instance template.')

  Create.InstanceTemplateArg = (
      instance_templates_flags.MakeInstanceTemplateArg())
  Create.InstanceTemplateArg.AddArgument(parser, operation_type='create')
  if support_source_instance:
    instance_templates_flags.MakeSourceInstanceArg().AddArgument(parser)
    parser.add_argument(
        '--configure-disk',
        type=arg_parsers.ArgDict(
            spec={
                'auto-delete': arg_parsers.ArgBoolean(),
                'device-name': str,
                'instantiate-from': str,
                'custom-image': str,
            },),
        metavar='PROPERTY=VALUE',
        action='append',
        help="""\
        This option has effect only when used with `--source-instance`. It
        allows you to override how the source-instance's disks are defined in
        the template.

        *auto-delete*::: If `true`, this persistent disk will be automatically
        deleted when the instance is deleted. However, if the disk is later
        detached from the instance, this option won't apply. If not provided,
        the setting is copied from the source instance. Allowed values of the
        flag are: `false`, `no`, `true`, and `yes`.

        *device-name*::: Name of the device.

        *instantiate-from*::: Specifies whether to include the disk and which
        image to use. Valid values are: {}

        *custom-image*::: The custom image to use if custom-image is specified
        for instantiate-from.
        """.format(', '.join(_INSTANTIATE_FROM_VALUES)),
    )

  instances_flags.AddReservationAffinityGroup(
      parser,
      group_text="""\
Specifies the reservation for instances created from this template.
""",
      affinity_text="""\
The type of reservation for instances created from this template.
""")

  parser.display_info.AddCacheUpdater(completers.InstanceTemplatesCompleter)
  if support_host_error_timeout_seconds:
    instances_flags.AddHostErrorTimeoutSecondsArgs(parser)
Пример #25
0
def _CommonArgs(parser,
                enable_regional=False,
                enable_kms=False,
                deprecate_maintenance_policy=False,
                supports_erase_vss=False,
                snapshot_csek=False,
                image_csek=False,
                support_multi_writer=False,
                support_replica_zones=False,
                support_subinterface=False,
                support_node_project=False,
                support_host_error_timeout_seconds=False,
                support_numa_node_count=False,
                support_disk_architecture=False,
                support_network_queue_count=False,
                support_instance_kms=False,
                support_max_run_duration=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser, enable_regional, enable_kms=enable_kms)
    instances_flags.AddCreateDiskArgs(
        parser,
        enable_kms=enable_kms,
        enable_snapshots=True,
        source_snapshot_csek=snapshot_csek,
        image_csek=image_csek,
        support_boot=True,
        support_multi_writer=support_multi_writer,
        support_replica_zones=support_replica_zones,
        support_disk_architecture=support_disk_architecture)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(
        parser,
        instances=True,
        support_subinterface=support_subinterface,
        instance_create=True,
        support_network_queue_count=support_network_queue_count)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(
        parser, deprecate=deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    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 instance will be created 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.')
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)
    instances_flags.AddHostnameArg(parser)
    instances_flags.AddImageArgs(parser,
                                 enable_snapshots=True,
                                 support_image_family_scope=True)
    instances_flags.AddDeletionProtectionFlag(parser)
    instances_flags.AddPublicPtrArgs(parser, instance=True)
    instances_flags.AddIpv6PublicPtrDomainArg(parser)
    instances_flags.AddNetworkTierArgs(parser, instance=True)
    instances_flags.AddShieldedInstanceConfigArgs(parser)
    instances_flags.AddDisplayDeviceArg(parser)
    instances_flags.AddMinNodeCpuArg(parser)
    instances_flags.AddNestedVirtualizationArgs(parser)
    instances_flags.AddThreadsPerCoreArgs(parser)
    instances_flags.AddEnableUefiNetworkingArgs(parser)
    instances_flags.AddResourceManagerTagsArgs(parser)
    if support_numa_node_count:
        instances_flags.AddNumaNodeCountArgs(parser)
    instances_flags.AddStackTypeArgs(parser)
    instances_flags.AddIpv6NetworkTierArgs(parser)
    instances_flags.AddNetworkPerformanceConfigsArgs(parser)
    instances_flags.AddProvisioningModelVmArgs(parser)
    instances_flags.AddInstanceTerminationActionVmArgs(parser)

    instances_flags.AddReservationAffinityGroup(
        parser,
        group_text='Specifies the reservation for the instance.',
        affinity_text='The type of reservation for the instance.')

    maintenance_flags.AddResourcePoliciesArgs(parser, 'added to', 'instance')

    sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

    instances_flags.AddLocationHintArg(parser)

    if supports_erase_vss:
        flags.AddEraseVssSignature(
            parser, 'source snapshots or source machine'
            ' image')

    labels_util.AddCreateLabelsFlags(parser)

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

    instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
        parser, operation_type='create')

    csek_utils.AddCsekKeyArgs(parser)

    base.ASYNC_FLAG.AddToParser(parser)
    parser.display_info.AddFormat(instances_flags.DEFAULT_LIST_FORMAT)
    parser.display_info.AddCacheUpdater(completers.InstancesCompleter)

    if support_node_project:
        instances_flags.AddNodeProjectArgs(parser)

    if support_host_error_timeout_seconds:
        instances_flags.AddHostErrorTimeoutSecondsArgs(parser)

    if support_instance_kms:
        instances_flags.AddInstanceKmsArgs(parser)

    if support_max_run_duration:
        instances_flags.AddMaxRunDurationVmArgs(parser)
Пример #26
0
def _CommonArgs(parser,
                release_track,
                support_source_instance,
                support_network_tier=False,
                support_local_ssd_size=False,
                support_shielded_vms=False,
                support_sole_tenancy=False):
    """Adding arguments applicable for creating instance templates."""
    parser.display_info.AddFormat(instance_templates_flags.DEFAULT_LIST_FORMAT)
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser)
    instances_flags.AddCreateDiskArgs(parser)
    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(parser,
                                   instances=False,
                                   support_network_tier=support_network_tier)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
    instances_flags.AddMaintenancePolicyArgs(parser,
                                             deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddServiceAccountAndScopeArgs(parser, False)
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    if support_shielded_vms:
        instances_flags.AddShieldedVMConfigArgs(parser)
    labels_util.AddCreateLabelsFlags(parser)
    if support_network_tier:
        instances_flags.AddNetworkTierArgs(parser, instance=True)
    if support_sole_tenancy:
        sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

    flags.AddRegionFlag(parser,
                        resource_type='subnetwork',
                        operation_type='attach')

    parser.add_argument(
        '--description',
        help='Specifies a textual description for the instance template.')

    Create.InstanceTemplateArg = (
        instance_templates_flags.MakeInstanceTemplateArg())
    Create.InstanceTemplateArg.AddArgument(parser, operation_type='create')
    if support_source_instance:
        instance_templates_flags.MakeSourceInstanceArg().AddArgument(parser)
        parser.add_argument(
            '--configure-disk',
            type=arg_parsers.ArgDict(spec={
                'auto-delete': arg_parsers.ArgBoolean(),
                'device-name': str,
                'instantiate-from': str,
                'custom-image': str,
            }, ),
            metavar='PROPERTY=VALUE',
            action='append',
            help="""\
        This option has effect only when used with `--source-instance`. It
        allows you to override how the source-instance's disks are defined in
        the template.

        *auto-delete*::: If `true`, this persistent disk will be automatically
        deleted when the instance is deleted. However, if the disk is later
        detached from the instance, this option won't apply. If not provided,
        the setting is copied from the source instance. Allowed values of the
        flag are: `false`, `no`, `true`, and `yes`.

        *device-name*::: Name of the device.

        *instantiate-from*::: Specifies whether to include the disk and which
        image to use. Valid values are: {}

        *custom-image*::: The custom image to use if custom-image is specified
        for instantiate-from.
        """.format(', '.join(_INSTANTIATE_FROM_VALUES)),
        )

    parser.display_info.AddCacheUpdater(completers.InstanceTemplatesCompleter)
Пример #27
0
def _CommonArgs(parser,
                deprecate_maintenance_policy=False,
                enable_resource_policy=False,
                supports_min_node_cpu=False,
                supports_location_hint=False,
                supports_erase_vss=False,
                snapshot_csek=False,
                image_csek=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddCreateDiskArgs(parser,
                                      enable_snapshots=True,
                                      resource_policy=enable_resource_policy,
                                      source_snapshot_csek=snapshot_csek,
                                      image_csek=image_csek,
                                      include_name=False)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(
        parser, deprecate=deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    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 instance will be created 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.')
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNoAddressArg(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddNetworkTierArgs(parser, instance=True)
    instances_flags.AddBulkCreateNetworkingArgs(parser)

    instances_flags.AddImageArgs(parser, enable_snapshots=True)
    instances_flags.AddShieldedInstanceConfigArgs(parser)
    instances_flags.AddDisplayDeviceArg(parser)

    instances_flags.AddReservationAffinityGroup(
        parser,
        group_text='Specifies the reservation for the instance.',
        affinity_text='The type of reservation for the instance.')

    maintenance_flags.AddResourcePoliciesArgs(parser, 'added to', 'instance')

    if supports_min_node_cpu:
        instances_flags.AddMinNodeCpuArg(parser)

    if supports_location_hint:
        instances_flags.AddLocationHintArg(parser)

    if supports_erase_vss:
        flags.AddEraseVssSignature(
            parser, 'source snapshots or source machine'
            ' image')

    labels_util.AddCreateLabelsFlags(parser)

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

    base.ASYNC_FLAG.AddToParser(parser)
def _CommonArgs(parser,
                deprecate_maintenance_policy=False,
                support_min_node_cpu=False,
                support_erase_vss=False,
                snapshot_csek=False,
                image_csek=False,
                support_display_device=False,
                support_local_ssd_size=False,
                support_numa_node_count=False,
                support_visible_core_count=False,
                support_max_run_duration=False,
                support_enable_target_shape=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgsForBulk(parser)
    instances_flags.AddCreateDiskArgs(parser,
                                      enable_kms=True,
                                      enable_snapshots=True,
                                      source_snapshot_csek=snapshot_csek,
                                      image_csek=image_csek,
                                      include_name=False,
                                      support_boot=True)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    instances_flags.AddMaintenancePolicyArgs(
        parser, deprecate=deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    instances_flags.AddProvisioningModelVmArgs(parser)
    instances_flags.AddNetworkPerformanceConfigsArgs(parser)
    instances_flags.AddInstanceTerminationActionVmArgs(parser)
    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 instance will be created 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.')
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNoAddressArg(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddNetworkTierArgs(parser, instance=True)
    instances_flags.AddBulkCreateNetworkingArgs(parser)

    instances_flags.AddImageArgs(parser, enable_snapshots=True)
    instances_flags.AddShieldedInstanceConfigArgs(parser)
    instances_flags.AddNestedVirtualizationArgs(parser)
    instances_flags.AddThreadsPerCoreArgs(parser)
    instances_flags.AddEnableUefiNetworkingArgs(parser)
    instances_flags.AddResourceManagerTagsArgs(parser)
    if support_numa_node_count:
        instances_flags.AddNumaNodeCountArgs(parser)

    if support_display_device:
        instances_flags.AddDisplayDeviceArg(parser)

    instances_flags.AddReservationAffinityGroup(
        parser,
        group_text='Specifies the reservation for the instance.',
        affinity_text='The type of reservation for the instance.')

    maintenance_flags.AddResourcePoliciesArgs(parser, 'added to', 'instance')

    if support_min_node_cpu:
        instances_flags.AddMinNodeCpuArg(parser)

    instances_flags.AddLocationHintArg(parser)

    if support_erase_vss:
        flags.AddEraseVssSignature(
            parser, 'source snapshots or source machine'
            ' image')

    labels_util.AddCreateLabelsFlags(parser)

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

    base.ASYNC_FLAG.AddToParser(parser)
    parser.display_info.AddFormat(
        'multi(instances:format="table(name,zone.basename())")')

    if support_visible_core_count:
        instances_flags.AddVisibleCoreCountArgs(parser)

    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)

    if support_max_run_duration:
        instances_flags.AddMaxRunDurationVmArgs(parser)

    if support_enable_target_shape:
        instances_flags.AddDistributionTargetShapeArgs(parser)
Пример #29
0
def _CommonArgs(
        parser,
        # TODO(b/80138906): Release track should not be passed around.
        release_track,
        support_public_dns,
        support_network_tier,
        enable_regional=False,
        support_local_ssd_size=False,
        enable_kms=False,
        support_sole_tenancy=False,
        supports_resource_policies=False):
    """Register parser args common to all tracks."""
    metadata_utils.AddMetadataArgs(parser)
    instances_flags.AddDiskArgs(parser, enable_regional, enable_kms=enable_kms)
    instances_flags.AddCreateDiskArgs(parser, enable_kms=enable_kms)
    if support_local_ssd_size:
        instances_flags.AddLocalSsdArgsWithSize(parser)
    else:
        instances_flags.AddLocalSsdArgs(parser)
    instances_flags.AddCanIpForwardArgs(parser)
    instances_flags.AddAddressArgs(parser,
                                   instances=True,
                                   support_network_tier=support_network_tier)
    instances_flags.AddAcceleratorArgs(parser)
    instances_flags.AddMachineTypeArgs(parser)
    deprecate_maintenance_policy = release_track in [base.ReleaseTrack.ALPHA]
    instances_flags.AddMaintenancePolicyArgs(parser,
                                             deprecate_maintenance_policy)
    instances_flags.AddNoRestartOnFailureArgs(parser)
    instances_flags.AddPreemptibleVmArgs(parser)
    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 instance will be created with no '
        'scopes.')
    instances_flags.AddTagsArgs(parser)
    instances_flags.AddCustomMachineTypeArgs(parser)
    instances_flags.AddNetworkArgs(parser)
    instances_flags.AddPrivateNetworkIpArgs(parser)
    instances_flags.AddImageArgs(parser)
    instances_flags.AddDeletionProtectionFlag(parser)
    instances_flags.AddPublicPtrArgs(parser, instance=True)
    if support_public_dns:
        instances_flags.AddPublicDnsArgs(parser, instance=True)
    if support_network_tier:
        instances_flags.AddNetworkTierArgs(parser, instance=True)
    if support_sole_tenancy:
        sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)
    if supports_resource_policies:
        maintenance_flags.AddResourcePoliciesArgs(parser, 'added to',
                                                  'instance')

    labels_util.AddCreateLabelsFlags(parser)
    instances_flags.AddMinCpuPlatformArgs(parser, release_track)

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

    instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
        parser, operation_type='create')

    csek_utils.AddCsekKeyArgs(parser)

    base.ASYNC_FLAG.AddToParser(parser)
    parser.display_info.AddFormat(
        resource_registry.RESOURCE_REGISTRY['compute.instances'].list_format)
    parser.display_info.AddCacheUpdater(completers.InstancesCompleter)
Пример #30
0
def _CommonArgs(parser,
                enable_regional=False,
                enable_kms=False,
                deprecate_maintenance_policy=False,
                enable_resource_policy=False,
                supports_min_node_cpus=False,
                supports_location_hint=False,
                snapshot_csek=False,
                image_csek=False):
  """Register parser args common to all tracks."""
  metadata_utils.AddMetadataArgs(parser)
  instances_flags.AddDiskArgs(parser, enable_regional, enable_kms=enable_kms)
  instances_flags.AddCreateDiskArgs(parser, enable_kms=enable_kms,
                                    enable_snapshots=True,
                                    resource_policy=enable_resource_policy,
                                    source_snapshot_csek=snapshot_csek,
                                    image_csek=image_csek)
  instances_flags.AddCanIpForwardArgs(parser)
  instances_flags.AddAddressArgs(parser, instances=True)
  instances_flags.AddAcceleratorArgs(parser)
  instances_flags.AddMachineTypeArgs(parser)
  instances_flags.AddMaintenancePolicyArgs(
      parser, deprecate=deprecate_maintenance_policy)
  instances_flags.AddNoRestartOnFailureArgs(parser)
  instances_flags.AddPreemptibleVmArgs(parser)
  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 instance will be created 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.')
  instances_flags.AddTagsArgs(parser)
  instances_flags.AddCustomMachineTypeArgs(parser)
  instances_flags.AddNetworkArgs(parser)
  instances_flags.AddPrivateNetworkIpArgs(parser)
  instances_flags.AddHostnameArg(parser)
  instances_flags.AddImageArgs(parser, enable_snapshots=True)
  instances_flags.AddDeletionProtectionFlag(parser)
  instances_flags.AddPublicPtrArgs(parser, instance=True)
  instances_flags.AddNetworkTierArgs(parser, instance=True)
  instances_flags.AddShieldedInstanceConfigArgs(parser)
  instances_flags.AddDisplayDeviceArg(parser)

  instances_flags.AddReservationAffinityGroup(
      parser,
      group_text='Specifies the reservation for the instance.',
      affinity_text='The type of reservation for the instance.')

  sole_tenancy_flags.AddNodeAffinityFlagToParser(parser)

  if supports_min_node_cpus:
    sole_tenancy_flags.AddMinNodeCpusArg(parser)

  if supports_location_hint:
    instances_flags.AddLocationHintArg(parser)

  labels_util.AddCreateLabelsFlags(parser)

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

  instances_flags.INSTANCES_ARG_FOR_CREATE.AddArgument(
      parser, operation_type='create')

  csek_utils.AddCsekKeyArgs(parser)

  base.ASYNC_FLAG.AddToParser(parser)
  parser.display_info.AddFormat(
      resource_registry.RESOURCE_REGISTRY['compute.instances'].list_format)
  parser.display_info.AddCacheUpdater(completers.InstancesCompleter)