# Cloud KMS V1 Client - Class ImportJob (2.9.0)

2.9.0 (latest) 2.8.0 2.7.0 2.6.0 2.5.2 2.4.0 2.3.1 2.2.0 2.1.6 2.0.0 1.23.0 1.22.1 1.21.4 1.20.3 1.19.0 1.18.1 1.17.0 1.16.4 1.15.3 Reference documentation and code samples for the Cloud KMS V1 Client class ImportJob.

An [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) can be used to create
[CryptoKeys](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) and
[CryptoKeyVersions](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) using pre-existing
key material, generated outside of Cloud KMS.

When an [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) is created, Cloud KMS will
generate a "wrapping key", which is a public/private key pair. You use the
wrapping key to encrypt (also known as wrap) the pre-existing key material to
protect it during the import process. The nature of the wrapping key depends
on the choice of
[import_method](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getImportMethod__). When the
wrapping key generation is complete, the
[state](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) will be set to
[ACTIVE](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE) and the
[public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) can be fetched. The
fetched public key can then be used to wrap your pre-existing key material.
Once the key material is wrapped, it can be imported into a new
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) in an existing
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) by calling
[ImportCryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__).
Multiple [CryptoKeyVersions](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) can be
imported with a single [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob). Cloud KMS
uses the private key portion of the wrapping key to unwrap the key material.
Only Cloud KMS has access to the private key.
An [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) expires 3 days after it is
created. Once expired, Cloud KMS will no longer be able to import or unwrap
any key material that was wrapped with the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s public key.
For more information, see
[Importing a key](https://cloud.google.com/kms/docs/importing-a-key).

Generated from protobuf message `google.cloud.kms.v1.ImportJob`

## Namespace

Google \\ Cloud \\ Kms \\ V1

## Methods

### __construct

Constructor.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `data` | `mixed` |

### getName

Output only. The resource name for this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) in the format
`projects/*/locations/*/keyRings/*/importJobs/*`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. The resource name for this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) in the format
`projects/*/locations/*/keyRings/*/importJobs/*`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImportMethod

Required. Immutable. The wrapping method to be used for incoming key
material.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ImportMethod](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod). |

### setImportMethod

Required. Immutable. The wrapping method to be used for incoming key
material.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ImportMethod](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProtectionLevel

Required. Immutable. The protection level of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob). This must match the
[protection_level](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersionTemplate#_Google_Cloud_Kms_V1_CryptoKeyVersionTemplate__getProtectionLevel__)
of the [version_template](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__)
on the [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) you attempt to import
into.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ProtectionLevel](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel). |

### setProtectionLevel

Required. Immutable. The protection level of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob). This must match the
[protection_level](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersionTemplate#_Google_Cloud_Kms_V1_CryptoKeyVersionTemplate__getProtectionLevel__)
of the [version_template](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__)
on the [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) you attempt to import
into.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ProtectionLevel](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. The time at which this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) was created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The time at which this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) was created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGenerateTime

Output only. The time this [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s key
material was generated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasGenerateTime

### clearGenerateTime

### setGenerateTime

Output only. The time this [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s key
material was generated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExpireTime

Output only. The time at which this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) is scheduled for expiration and
can no longer be used to import key material.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasExpireTime

### clearExpireTime

### setExpireTime

Output only. The time at which this
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) is scheduled for expiration and
can no longer be used to import key material.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExpireEventTime

Output only. The time this [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob)
expired. Only present if [state](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is
[EXPIRED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__EXPIRED).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasExpireEventTime

### clearExpireEventTime

### setExpireEventTime

Output only. The time this [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob)
expired. Only present if [state](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is
[EXPIRED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__EXPIRED).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getState

Output only. The current state of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob), indicating if it can be used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ImportJobState](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState). |

### setState

Output only. The current state of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob), indicating if it can be used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ImportJobState](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPublicKey

Output only. The public key with which to wrap key material prior to
import. Only returned if [state](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is
[ACTIVE](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.WrappingPublicKey|null` |   |

### hasPublicKey

### clearPublicKey

### setPublicKey

Output only. The public key with which to wrap key material prior to
import. Only returned if [state](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is
[ACTIVE](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.WrappingPublicKey` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAttestation

Output only. Statement that was generated and signed by the key creator
(for example, an HSM) at key creation time. Use this statement to verify
attributes of the key as stored on the HSM, independently of Google.

Only present if the chosen
[ImportMethod](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod) is one with a
protection level of [HSM](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel#_Google_Cloud_Kms_V1_ProtectionLevel__HSM).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyOperationAttestation|null` |   |

### hasAttestation

### clearAttestation

### setAttestation

Output only. Statement that was generated and signed by the key creator
(for example, an HSM) at key creation time. Use this statement to verify
attributes of the key as stored on the HSM, independently of Google.

Only present if the chosen
[ImportMethod](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod) is one with a
protection level of [HSM](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel#_Google_Cloud_Kms_V1_ProtectionLevel__HSM).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyOperationAttestation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCryptoKeyBackend

Immutable. The resource name of the backend environment where the key
material for the wrapping key resides and where all related cryptographic
operations are performed. Currently, this field is only populated for keys
stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
apply to additional [ProtectionLevels](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel)
in the future. Supported resources:

- `"projects/*/locations/*/singleTenantHsmInstances/*"`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCryptoKeyBackend

Immutable. The resource name of the backend environment where the key
material for the wrapping key resides and where all related cryptographic
operations are performed. Currently, this field is only populated for keys
stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
apply to additional [ProtectionLevels](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel)
in the future. Supported resources:

- `"projects/*/locations/*/singleTenantHsmInstances/*"`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |