Class: SolusVM::Reseller

Inherits:
Base
  • Object
show all
Defined in:
lib/solusvm/reseller.rb

Overview

SolusVM::Server is the class for working with reseller accounts.

Constant Summary

Constants inherited from Base

Base::VALID_SERVER_TYPES

Instance Attribute Summary

Attributes inherited from Base

#returned_parameters

Instance Method Summary collapse

Methods inherited from Base

#api_endpoint, #api_id, #api_key, #api_login, #api_options, #conn, #initialize, #log_messages, #parse_error, #parse_response, #parse_returned_params_as_list, #perform_request, #ssl_option, #statusmsg, #successful?, #validate_server_type

Constructor Details

This class inherits a constructor from SolusVM::Base

Instance Method Details

#change_resources(username, options = {}) ⇒ Object

Changes the available resources for a specific reseller.

options - A Hash of options, see `#create` for details

Returns a Hash with the new reseller info, or false if the reseller was not created successfully.


47
48
49
# File 'lib/solusvm/reseller.rb', line 47

def change_resources(username, options = {})
  perform_request(options.merge(action: 'reseller-modifyresources', username: username)) && returned_parameters
end

#create(options = {}) ⇒ Object

Public: Creates a reseller.

options - A Hash of options:

:username
:password
:email
:firstname
:lastname
:company        - (optional)
:usernameprefix - prefix for reseller client usernames (optional)
:maxvps         - maximum amount of virtual servers (optional)
:maxusers       - maximum amount of users (optional)
:maxmem         - maximum amount memory (optional)
:maxburst       - maximum amount of burst memory or swapspace
                  (optional)
:maxdisk        - maximum amount of diskspace (optional)
:maxbw          - maximum amount of bandwidth (optional)
:maxipv4        - maximum amount of ipv4 addresses (optional)
:maxipv6        - maximum amount of ipv6 addresses (optional)
:nodegroups     - comma separated list of node groups (optional)
:mediagroups    - comma separated list of media groups
                  (optional)
:openvz         - y|n Allow building of openvz virtual servers
                  (optional)
:xenpv          - y|n Allow building of xen pv virtual servers
                  (optional)
:xenhvm         - y|n Allow building of xen hvm virtual servers
                  (optional)
:kvm            - y|n Allow building of kvmvirtual servers
                  (optional)

Returns a Hash with the new client info, or false if the client was not created successfully.


37
38
39
# File 'lib/solusvm/reseller.rb', line 37

def create(options = {})
  perform_request(options.merge(action: 'reseller-create')) && returned_parameters
end

#delete(username) ⇒ Object

Public: Deletes an existing reseller.

Returns true if the reseller was deleted.


64
65
66
# File 'lib/solusvm/reseller.rb', line 64

def delete(username)
  perform_request(action: 'reseller-delete', username: username)
end

#info(username) ⇒ Object

Public: Retrieves information from an existing reseller.

username - The reseller's username

Returns a Hash with the reseller info, or false if the reseller was not found.


57
58
59
# File 'lib/solusvm/reseller.rb', line 57

def info(username)
  perform_request(action: 'reseller-info', username: username) && returned_parameters
end

#listObject

Public: Lists existing resellers.

Returns an Array.


71
72
73
74
# File 'lib/solusvm/reseller.rb', line 71

def list
  perform_request(action: 'reseller-list')
  parse_returned_params_as_list('usernames')
end