コード例 #1
0
ファイル: create.py プロジェクト: adambengis/TraderGrows
def _Args(parser,
          release_track,
          supports_force_create=False,
          supports_storage_location=False,
          supports_shielded_instance_initial_state=False):
    """Set Args based on Release Track."""
    # GA Args
    parser.display_info.AddFormat(flags.LIST_FORMAT)

    sources_group = parser.add_mutually_exclusive_group(required=True)
    flags.AddCommonArgs(parser)
    flags.AddCommonSourcesArgs(parser, sources_group)

    Create.DISK_IMAGE_ARG = flags.MakeDiskImageArg()
    Create.DISK_IMAGE_ARG.AddArgument(parser, operation_type='create')
    csek_utils.AddCsekKeyArgs(parser, resource_type='image')

    labels_util.AddCreateLabelsFlags(parser)
    flags.MakeForceArg().AddToParser(parser)
    flags.AddCloningImagesArgs(parser, sources_group)
    flags.AddCreatingImageFromSnapshotArgs(parser, sources_group)

    image_utils.AddGuestOsFeaturesArg(parser, release_track)
    kms_resource_args.AddKmsKeyResourceArg(parser, 'image')

    # Alpha and Beta Args
    if supports_force_create:
        # Deprecated as of Aug 2017.
        flags.MakeForceCreateArg().AddToParser(parser)

    if supports_storage_location:
        compute_flags.AddStorageLocationFlag(parser, 'image')

    if supports_shielded_instance_initial_state:
        compute_flags.AddShieldedInstanceInitialStateKeyArg(parser)
コード例 #2
0
def _Args(parser, messages, supports_force_create=False):
    """Set Args based on Release Track."""
    # GA Args
    parser.display_info.AddFormat(flags.LIST_FORMAT)

    sources_group = parser.add_mutually_exclusive_group(required=True)
    flags.AddCommonArgs(parser)
    flags.AddCommonSourcesArgs(parser, sources_group)

    Create.DISK_IMAGE_ARG = flags.MakeDiskImageArg()
    Create.DISK_IMAGE_ARG.AddArgument(parser, operation_type='create')
    csek_utils.AddCsekKeyArgs(parser, resource_type='image')

    labels_util.AddCreateLabelsFlags(parser)
    flags.MakeForceArg().AddToParser(parser)
    flags.AddCloningImagesArgs(parser, sources_group)
    flags.AddCreatingImageFromSnapshotArgs(parser, sources_group)

    image_utils.AddGuestOsFeaturesArg(parser, messages)
    kms_resource_args.AddKmsKeyResourceArg(parser, 'image')

    # Alpha and Beta Args
    if supports_force_create:
        # Deprecated as of Aug 2017.
        flags.MakeForceCreateArg().AddToParser(parser)

    parser.add_argument('--storage-location',
                        metavar='LOCATION',
                        help="""\
    Specifies a Cloud Storage location, either regional or multi-regional,
    where image content is to be stored. If not specified, the multi-region
    location closest to the source is chosen automatically.
    """)

    compute_flags.AddShieldedInstanceInitialStateKeyArg(parser)
コード例 #3
0
def _Args(parser,
          messages,
          supports_force_create=False,
          support_user_licenses=False,
          support_disk_architecture=False):
    """Set Args based on Release Track."""
    # GA Args
    parser.display_info.AddFormat(flags.LIST_FORMAT)

    sources_group = parser.add_mutually_exclusive_group(required=True)

    flags.AddCommonArgs(parser, support_user_licenses=support_user_licenses)
    flags.AddCommonSourcesArgs(parser, sources_group)

    Create.DISK_IMAGE_ARG = flags.MakeDiskImageArg()
    Create.DISK_IMAGE_ARG.AddArgument(parser, operation_type='create')
    csek_utils.AddCsekKeyArgs(parser, resource_type='image')

    labels_util.AddCreateLabelsFlags(parser)
    flags.MakeForceArg().AddToParser(parser)
    flags.AddCloningImagesArgs(parser, sources_group)
    flags.AddCreatingImageFromSnapshotArgs(parser, sources_group)

    image_utils.AddGuestOsFeaturesArg(parser, messages)
    kms_resource_args.AddKmsKeyResourceArg(parser, 'image')
    flags.AddSourceDiskProjectFlag(parser)

    # Alpha and Beta Args
    if support_disk_architecture:
        image_utils.AddArchitectureArg(parser)

    if supports_force_create:
        # Deprecated as of Aug 2017.
        flags.MakeForceCreateArg().AddToParser(parser)

    parser.add_argument('--storage-location',
                        metavar='LOCATION',
                        help="""\
    Specifies a Cloud Storage location, either regional or multi-regional,
    where image content is to be stored. If not specified, the multi-region
    location closest to the source is chosen automatically.
    """)
    parser.add_argument('--locked',
                        action='store_true',
                        default=None,
                        hidden=True,
                        help="""\
    Specifies that any boot disk created from this image can't be used
    for data backup operations such as snapshot creation, image creation,
    instance snapshot creation, and disk cloning.

    If a VM instance is created using this image, the boot disk is fixed
    to this VM. The disk can't be attached to any other VMs, whether in
    `read-write` mode or in `read-only` mode. Also, any VM created from this
    disk, has the following characteristics:

    * The VM can't be used for creating machine images or instance templates
    * After the VM is created, you can't attach any secondary disk
    * After the VM is deleted, the attached boot disk can't be retained
    """)
    compute_flags.AddShieldedInstanceInitialStateKeyArg(parser)