machine_image#

State module for managing Machine Images.

async idem_gcp.states.gcp.compute.machine_image.present(hub, ctx, name: str, project: str = None, resource_id: str = None, source_instance: str = None, storage_locations: List[str] = None, source_disk_encryption_keys: List[SourceDiskEncryptionKey] = None, description: str = None, saved_disks: List[SavedDisk] = None, guest_flush: bool = None, machine_image_encryption_key: CustomerEncryptionKey = None) Dict[str, Any][source]#

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters:
  • name (str) – An Idem name of the resource.

  • project (str, Optional) – Project ID for this request.

  • resource_id (str, Optional) – An identifier of the resource in the provider. Defaults to None.

  • source_instance (str, Optional) –

    The source instance used to create the machine image. You can provide this as a partial or full URL to the resource. For example, the following are valid values:

    Defaults to None.

  • storage_locations (list[str], Optional) – The regional or multi-regional Cloud Storage bucket location where the machine image is stored. Defaults to None.

  • source_disk_encryption_keys (list[Dict[str, Any]], Optional) –

    [Input Only] The customer-supplied encryption key of the disks attached to the source instance. Required if the source disk is protected by a customer-supplied encryption key. Defaults to None.

    • source_disk(str, Optional):

      URL of the disk attached to the source instance. This can be a full or valid partial URL. For example, the following are valid values:

    • disk_encryption_key(Dict[str, Any], Optional):

      The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key.

      • kms_key_service_account(str, Optional):

        The service account being used for the encryption request for the given KMS key. If absent, the Compute Engine default service account is used. For example: “kmsKeyServiceAccount”: “name@project_id.iam.gserviceaccount.com/

      • rsa_encrypted_key(str, Optional):

        Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: “rsaEncryptedKey”: “ieCx/NcW06PcT7Ep1X6LUTc/hLvUDYyzSZPPVCVPTVEohpeHASqC8uw5TzyO9U+Fka9JFH z0mBibXUInrC/jEk014kCK/NPjYgEMOyssZ4ZINPKxlUh2zn1bV+MCaTICrdmuSBTWlUUiFoD D6PYznLwh8ZNdaheCeZ8ewEXgFQ8V+sDroLaN3Xs3MDTXQEMMoNUXMCZEIpg9Vtp9x2oe==” The key must meet the following requirements before you can provide it to Compute Engine: 1. The key is wrapped using a RSA public key certificate provided by Google. 2. After being wrapped, the key must be encoded in RFC 4648 base64 encoding. Gets the RSA public key certificate provided by Google at: https://cloud-certs.storage.googleapis.com/google-cloud-csek-ingress.pem

      • kms_key_name(str, Optional):

        The name of the encryption key that is stored in Google Cloud KMS. For example: “kmsKeyName”: “projects/kms_project_id/locations/region/keyRings/ key_region/cryptoKeys/key

      • raw_key(str, Optional):

        Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: “rawKey”: “SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=”

  • description (str, Optional) – An optional description of this resource. Provide this property when you create the resource. Defaults to None.

  • saved_disks (list[Dict[str, Any]], Optional) –

    An array of Machine Image specific properties for disks attached to the source instance. Defaults to None.

    • kind(str, Optional):

      [Output Only] Type of the resource. Always compute#savedDisk for attached disks.

    • storage_bytes_status (str, Optional):

      [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date.

    • architecture(str, Optional):

      [Output Only] The architecture of the attached disk.

    • storage_bytes(str, Optional):

      [Output Only] Size of the individual disk snapshot used by this machine image.

    • source_disk(str, Optional):

      Specifies a URL of the disk attached to the source instance.

  • guest_flush (bool, Optional) – [Input Only] Whether to attempt an application consistent machine image by informing the OS to prepare for the snapshot process. Defaults to None.

  • machine_image_encryption_key (Dict[str, Any], Optional) –

    Encrypts the machine image using a customer-supplied encryption key. After you encrypt a machine image using a customer-supplied key, you must provide the same key if you use the machine image later. For example, you must provide the encryption key when you create an instance from the encrypted machine image in a future request. Customer-supplied encryption keys do not protect access to metadata of the machine image. If you do not provide an encryption key when creating the machine image, then the machine image will be encrypted using an automatically generated key and you do not need to provide a key to use the machine image later. Defaults to None.

    • kms_key_service_account(str, Optional):

      The service account being used for the encryption request for the given KMS key. If absent, the Compute Engine default service account is used. For example: “kmsKeyServiceAccount”: “name@project_id.iam.gserviceaccount.com/

    • rsa_encrypted_key(str, Optional):

      Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: “rsaEncryptedKey”: “ieCx/NcW06PcT7Ep1X6LUTc/hLvUDYyzSZPPVCVPTVEohpeHASqC8uw5TzyO9U+Fka9JFH z0mBibXUInrC/jEk014kCK/NPjYgEMOyssZ4ZINPKxlUh2zn1bV+MCaTICrdmuSBTWlUUiFoD D6PYznLwh8ZNdaheCeZ8ewEXgFQ8V+sDroLaN3Xs3MDTXQEMMoNUXMCZEIpg9Vtp9x2oe==” The key must meet the following requirements before you can provide it to Compute Engine: 1. The key is wrapped using a RSA public key certificate provided by Google. 2. After being wrapped, the key must be encoded in RFC 4648 base64 encoding. Gets the RSA public key certificate provided by Google at: https://cloud-certs.storage.googleapis.com/google-cloud-csek-ingress.pem

    • kms_key_name(str, Optional):

      The name of the encryption key that is stored in Google Cloud KMS. For example: “kmsKeyName”: “projects/kms_project_id/locations/region/keyRings/ key_region/cryptoKeys/key

    • raw_key(str, Optional):

      Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: “rawKey”: “SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=”

Returns:

Dict[str, Any]

Examples

example_resource_name:
  gcp.compute.machine_image.present:
    - project: project-name
    - source_instance: https://www.googleapis.com/compute/v1/projects/project-name/zones/zone-name/instances/instance-name
async idem_gcp.states.gcp.compute.machine_image.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Retrieves a list of machine images that are contained within the specified project.

Returns:

Dict[str, Any]

Examples

$ idem describe gcp.compute.machine_image
idem_gcp.states.gcp.compute.machine_image.is_pending(hub, ret: dict, state: str = None, **pending_kwargs) bool[source]#

Default implemented for each module.