All URIs are relative to https://api.vultr.com/v2
Method | HTTP request | Description |
---|---|---|
create_ssh_key | POST /ssh-keys | Create SSH key |
delete_ssh_key | DELETE /ssh-keys/{ssh-key-id} | Delete SSH Key |
get_ssh_key | GET /ssh-keys/{ssh-key-id} | Get SSH Key |
list_ssh_keys | GET /ssh-keys | List SSH Keys |
update_ssh_key | PATCH /ssh-keys/{ssh-key-id} | Update SSH Key |
create_ssh_key(opts)
Create SSH key
Create a new SSH Key for use with future instances. This does not update any running instances.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::SshApi.new
opts = {
create_ssh_key_request: VultrRuby::CreateSshKeyRequest.new({name: 'name_example', ssh_key: 'ssh_key_example'}) # CreateSshKeyRequest | Include a JSON object in the request body with a content type of **application/json**.
}
begin
# Create SSH key
result = api_instance.create_ssh_key(opts)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->create_ssh_key: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_ssh_key_with_http_info(opts)
begin
# Create SSH key
data, status_code, headers = api_instance.create_ssh_key_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <GetSshKey200Response>
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->create_ssh_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
create_ssh_key_request | CreateSshKeyRequest | Include a JSON object in the request body with a content type of application/json. | [optional] |
[API Key](../README.md#API Key)
- Content-Type: application/json
- Accept: application/json
delete_ssh_key(ssh_key_id)
Delete SSH Key
Delete an SSH Key.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::SshApi.new
ssh_key_id = 'ssh_key_id_example' # String | The [SSH Key id](#operation/list-ssh-keys).
begin
# Delete SSH Key
api_instance.delete_ssh_key(ssh_key_id)
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->delete_ssh_key: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> delete_ssh_key_with_http_info(ssh_key_id)
begin
# Delete SSH Key
data, status_code, headers = api_instance.delete_ssh_key_with_http_info(ssh_key_id)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->delete_ssh_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
ssh_key_id | String | The SSH Key id. |
nil (empty response body)
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: Not defined
get_ssh_key(ssh_key_id)
Get SSH Key
Get information about an SSH Key.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::SshApi.new
ssh_key_id = 'ssh_key_id_example' # String | The [SSH Key id](#operation/list-ssh-keys).
begin
# Get SSH Key
result = api_instance.get_ssh_key(ssh_key_id)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->get_ssh_key: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_ssh_key_with_http_info(ssh_key_id)
begin
# Get SSH Key
data, status_code, headers = api_instance.get_ssh_key_with_http_info(ssh_key_id)
p status_code # => 2xx
p headers # => { ... }
p data # => <GetSshKey200Response>
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->get_ssh_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
ssh_key_id | String | The SSH Key id. |
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: application/json
list_ssh_keys(opts)
List SSH Keys
List all SSH Keys in your account.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::SshApi.new
opts = {
per_page: 56, # Integer | Number of items requested per page. Default is 100 and Max is 500.
cursor: 'cursor_example' # String | Cursor for paging. See [Meta and Pagination](#section/Introduction/Meta-and-Pagination).
}
begin
# List SSH Keys
result = api_instance.list_ssh_keys(opts)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->list_ssh_keys: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_ssh_keys_with_http_info(opts)
begin
# List SSH Keys
data, status_code, headers = api_instance.list_ssh_keys_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <ListSshKeys200Response>
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->list_ssh_keys_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
per_page | Integer | Number of items requested per page. Default is 100 and Max is 500. | [optional] |
cursor | String | Cursor for paging. See Meta and Pagination. | [optional] |
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: application/json
update_ssh_key(ssh_key_id, opts)
Update SSH Key
Update an SSH Key. The attributes name
and ssh_key
are optional. If not set, the attributes will retain their original values. New deployments will use the updated key, but this action does not update previously deployed instances.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::SshApi.new
ssh_key_id = 'ssh_key_id_example' # String | The [SSH Key id](#operation/list-ssh-keys).
opts = {
update_ssh_key_request: VultrRuby::UpdateSshKeyRequest.new # UpdateSshKeyRequest | Include a JSON object in the request body with a content type of **application/json**.
}
begin
# Update SSH Key
api_instance.update_ssh_key(ssh_key_id, opts)
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->update_ssh_key: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> update_ssh_key_with_http_info(ssh_key_id, opts)
begin
# Update SSH Key
data, status_code, headers = api_instance.update_ssh_key_with_http_info(ssh_key_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue VultrRuby::ApiError => e
puts "Error when calling SshApi->update_ssh_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
ssh_key_id | String | The SSH Key id. | |
update_ssh_key_request | UpdateSshKeyRequest | Include a JSON object in the request body with a content type of application/json. | [optional] |
nil (empty response body)
[API Key](../README.md#API Key)
- Content-Type: application/json
- Accept: Not defined