Skip to content

SSH Keys

OnCloud edited this page Jan 3, 2025 · 5 revisions

Important

Before making API calls, client must be initialized.

Add

Official documentation

const userId = 1;  // Replace with your user ID
const name = "My SSH Key";  // Replace with your SSH key name
const publicKey = "ssh-** ********";  // Replace with your SSH key public key

const addSshKey = await virtfusion.sshKeys.add({
  userId,
  name,
  publicKey,
});

Delete

Official documentation

const sshKeyId = 1;  // Replace with your SSH key ID

const deleteSshKey = await virtfusion.sshKeys.delete(sshKeyId);

Retrieve a users SSH keys

Official documentation

const userId = 1;  // Replace with your user ID

const retrieveSshKeysByUser = await virtfusion.sshKeys.retrieveUser(userId);
Clone this wiki locally