Skip to main content
CVM lifecycle methods manage the full journey of a Confidential Virtual Machine, from initial provisioning through daily operations to deletion. All methods accept a context.Context as the first parameter and return Go-idiomatic (result, error) pairs.

ProvisionCVM

POST /cvms/provision Provisions a new CVM by reserving resources and generating a compose hash. This is the first step of the two-phase deployment flow. The returned AppID and ComposeHash are needed to commit the provision.
ProvisionCVMRequest fields: Returns: *ProvisionCVMResponse with AppID, ComposeHash, AppEnvEncryptPubkey, and other provisioning details. Example:

CommitCVMProvision

POST /cvms Commits a provisioned CVM, triggering the actual deployment. You must pass the AppID and ComposeHash from the provision step.
CommitCVMProvisionRequest fields: Returns: *CommitCVMProvisionResponse with ID, Name, and Status. Use the CvmID() helper method to get the ID as a string. Example — full two-phase deploy:

StartCVM

POST /cvms/{cvmId}/start Starts a stopped CVM. This method retries automatically on transient errors.
Parameters: Returns: *CVMActionResponse with ID, Name, and Status.

StopCVM

POST /cvms/{cvmId}/stop Force-stops a CVM immediately. Use ShutdownCVM if you need a graceful stop.
Parameters: Returns: *CVMActionResponse

ShutdownCVM

POST /cvms/{cvmId}/shutdown Gracefully shuts down a CVM, allowing containers to stop cleanly before powering off.
Parameters: Returns: *CVMActionResponse

RestartCVM

POST /cvms/{cvmId}/restart Restarts a CVM. By default, the restart is graceful. Set Force: true to skip the graceful shutdown phase.
Parameters: RestartCVMOptions fields:

DeleteCVM

DELETE /cvms/{cvmId} Permanently deletes a CVM and all its data. Returns only an error (no response body).
Parameters:
This action is irreversible. All data associated with the CVM will be permanently deleted.

ReplicateCVM

POST /cvms/{cvmId}/replicas Creates a replica of an existing CVM. You can optionally target a specific node. The new CVM inherits the source’s configuration.
Parameters: ReplicateCVMOptions fields:
You can also replicate a CVM within an app context using ReplicateAppCVM(ctx, appID, vmUUID, opts), which ensures the replica is associated with the correct application.