feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The command group for Image Imports."""
from googlecloudsdk.calliope import base
# We could have multiple tracks here, e.g.
@base.DefaultUniverseOnly
@base.ReleaseTracks(base.ReleaseTrack.GA, base.ReleaseTrack.ALPHA)
class ImageImports(base.Group):
r"""Imports images to Google Compute Engine from Google Cloud Storage.
gcloud alpha migration vms image-imports provides a more robust and better
supported method for importing images to Google Compute Engine.
Other image-related operations (for example, list) can be done using
gcloud compute images, as usual.
The commands use VM Migartion API which supports importing of an image from
a Google Cloud Storage file (gs://...) to a target project.
VM Migration API must be enabled in your project.
gcloud alpha migration vms image-imports create creates an Image Import resource
with a nested Image Import Job resource. The Image Import Job resource tracks
the image import progress. After the Image Import Job completes, successfully
or otherwise, there's no further use for the Image Import resource.
The image is imported to a Google Cloud Project, desginated by the
Target Project resource. To get a list of Target Projects, run the
gcloud alpha migration vms target-projects list command.
Use the Google Cloud console to add target project resources.
For information on adding target projects, see
https://cloud.google.com/migrate/virtual-machines/docs/5.0/how-to/target-project.
A project can support a maximum of 1000 Image Import resources per project.
Hence it's recommended to delete an Image Import resource after the Image
Import Job is complete to avoid reaching the Image Import resources limit.
Deletion of Image Import resource does not affect the imported image.
## Import Image
$ gcloud alpha migration vms image-imports create IMAGE_IMPORT_NAME \
--source-file=GCS_FILE_NAME \
--image-name=IMPORTED_IMAGE_NAME \
--location=REGION \
--target-project=TARGET_PROJECT_RESOURCE_PATH
## Delete Image Import resource
$ gcloud alpha migration vms image-imports delete IMAGE_IMPORT_NAME \
--location=REGION
"""

View File

@@ -0,0 +1,59 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: import Virtual Disk images to Google Compute Engine.
description: |
{command} imports images such as VMWare VMDK files and VHD files, from a Google Cloud Storage
file (gs://...) to Google Compute Engine, using the Migrate to Virtual Machines service API.
This command creates an Image Import resource with a nested Image Import Job
resource. The Image Import Job resource tracks the image import progress.
To use this command, you must enable VM Migration API in your project.
examples: |
To import my-ubuntu22.04.vmdk from my-images-bucket to my-target-project in us-central1,
create my-image-import resource in my-project in us-central1.
Run:
$ {command} my-image-import \
--source-file=gs://my-images-bucket/my-ubuntu22.04.vmdk \
--image-name=my-ubuntu-image \
--location=us-central1 \
--target-project=projects/my-project/locations/global/targetProjects/my-target-project
--project=my-project
request:
collection: vmmigration.projects.locations.imageImports
modify_request_hooks:
- googlecloudsdk.command_lib.migration.vms.image_import.hooks:FixCreateDiskImageImportRequest
arguments:
resource:
help_text: The Image Import resource you want to create. This would be the image name if --image-name is not given.
spec: !REF googlecloudsdk.command_lib.migration.vms.resources:imageImport
params:
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.flags:source_file
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:image_name
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:target_project
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:description
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:family_name
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:labels
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:additional_licenses
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:single_region_storage
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.flags:kms_key
- group:
help_text: OS adaptation parameters
required: false
mutex: true
params:
- group:
params:
- group:
required: true
params:
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:skip_os_adaptation
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:guest_os_features
- group:
params:
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:generalize
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:license_type
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:boot_conversion
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:adaptation_modifiers
- _REF_: googlecloudsdk.command_lib.migration.vms.image_import.disk_image_import.flags:rootfs_uuid

View File

@@ -0,0 +1,19 @@
- help_text:
brief: delete an Image Import resource.
description: |
{command} deletes an Image Import resource.
To use this command, you must enable VM Migration API in your project.
This command does not delete any images imported to Google Compute Engine.
examples: |
To delete my-image-import resource in us-central1 in the default project, run:
$ {command} my-image-import --location=us-central1
request:
collection: vmmigration.projects.locations.imageImports
arguments:
resource:
help_text: The Image Import resource you want to delete.
spec: !REF googlecloudsdk.command_lib.migration.vms.resources:imageImport

View File

@@ -0,0 +1,18 @@
- help_text:
brief: describe an Image Import.
description: |
{command} describes an Image Import resource with a nested Image Import Job.
The Image Import Job resource tracks the image import progress.
To use this command, you must enable VM Migration API in your project.
examples: |
To describe my-image-import resource in us-central1 in the default project, run:
$ {command} my-image-import --location=us-central1
request:
collection: vmmigration.projects.locations.imageImports
arguments:
resource:
help_text: The Image Import you want to describe.
spec: !REF googlecloudsdk.command_lib.migration.vms.resources:imageImport

View File

@@ -0,0 +1,27 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: list Image Imports.
description: |
{command} prints a detailed list of Image Import resources.
To use this command, you must enable VM Migration API in your project.
examples: |
To list the Image Import resources in us-central1 in the default project, run:
$ {command} --location=us-central1
request:
collection: vmmigration.projects.locations.imageImports
response:
id_field: name
arguments:
resource:
help_text: |
The compute/region of the Image Import.
To get a list of the available regions, run gcloud compute regions list command.
If not specified, the value of the [compute/zone] property in the current gcloud configuration is used.
spec: !REF googlecloudsdk.command_lib.migration.vms.resources:location
output:
format: table(name.basename(), recentImageImportJobs[0].state, cloudStorageUri, diskImageTargetDefaults.imageName, diskImageTargetDefaults.targetProject.basename(), createTime)