Returns a collection of SSH Keys you’ve added to your Profile.
LinodeClient linodeClient = new LinodeClient("apikey");
// Get All
List<SshKey> list = await linodeClient.SshKey.Get();
Get One
Returns a single SSH Key object identified by id that you have access to view.
LinodeClient linodeClient = new LinodeClient("apikey");
long sshKeyId = 314986;
// Get One
SshKey sshKey = await linodeClient.SshKey.Get(sshKeyId);
Create
Adds an SSH Key to your Account profile.
LinodeClient linodeClient = new LinodeClient("apikey");
// We rely on the 'SshKeyGenerator' library to generate SSH credentials.
SshKeyGenerator.SshKeyGenerator sshKeyGenerator = new SshKeyGenerator.SshKeyGenerator(2048);
string label = "name";
string pubKey = sshKeyGenerator.ToRfcPublicKey($"{Guid.NewGuid()}");
// Create
SshKey sshKey = await linodeClient.SshKey.Create(label, pubKey);
Update
Updates an SSH Key that you have permission to read_write.
LinodeClient linodeClient = new LinodeClient("apikey");
// Get one
SshKey sshKey = await linodeClient.SshKey.Get(314986);
// Change name
sshKey.Label = "new-name";
// Update
sshKey = await linodeClient.SshKey.Update(sshKey);
Delete
Deletes an SSH Key you have access to.
Note: deleting an SSH Key will not remove it from any Linode or Disk that was deployed with authorized_keys. In those cases, the keys must be manually deleted on the Linode or Disk. This endpoint will only delete the key’s association from your Profile.
LinodeClient linodeClient = new LinodeClient("apikey");
// Get one
SshKey sshKey = await linodeClient.SshKey.Get(314986);
// You can delete it by passing the object as a parameter
await linodeClient.SshKey.Delete(sshKey);
// You can also delete it by passing the ID as a parameter.
await linodeClient.SshKey.Delete(314986);