Class: Vultr::SshKeysResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/vultr/resources/ssh_keys.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Vultr::Resource

Instance Method Details

#create(**attributes) ⇒ Object



8
9
10
# File 'lib/vultr/resources/ssh_keys.rb', line 8

def create(**attributes)
  SshKey.new post_request("ssh-keys", body: attributes).body.dig("ssh_key")
end

#delete(ssh_key_id:) ⇒ Object



20
21
22
# File 'lib/vultr/resources/ssh_keys.rb', line 20

def delete(ssh_key_id:)
  delete_request("ssh-keys/#{ssh_key_id}")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/vultr/resources/ssh_keys.rb', line 3

def list(**params)
  response = get_request("ssh-keys", params: params)
  Collection.from_response(response, key: "ssh_keys", type: SshKey)
end

#retrieve(ssh_key_id:) ⇒ Object



12
13
14
# File 'lib/vultr/resources/ssh_keys.rb', line 12

def retrieve(ssh_key_id:)
  SshKey.new get_request("ssh-keys/#{ssh_key_id}").body.dig("ssh_key")
end

#update(ssh_key_id:, **attributes) ⇒ Object



16
17
18
# File 'lib/vultr/resources/ssh_keys.rb', line 16

def update(ssh_key_id:, **attributes)
  patch_request("ssh-keys/#{ssh_key_id}", body: attributes)
end