Sha256: 24d1a03ee68f29dcf5b5cdc01c7c6c89bf3a57eddbf29f11da63c71b91f5f880

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

module Vultr
  class SshKeysResource < Resource
    def list(**params)
      response = get_request("ssh-keys", params: params)
      Collection.from_response(response, key: "ssh_keys", type: SshKey)
    end

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vultr-2.0.0 lib/vultr/resources/ssh_keys.rb
vultr-1.0.0 lib/vultr/resources/ssh_keys.rb