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

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

- (Object) change_resources(username, options = {})

Changes the available resources for a specific reseller.

Parameters:

  • options (defaults to: {})

    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

- (Object) create(options = {})

Creates a reseller.

Parameters:

  • options (defaults to: {})

    A Hash of options: :username :password :email :firstname :lastname

Options Hash (options):

  • :company (Object) — default: optional
  • :usernameprefix (Object)

    prefix for reseller client usernames (optional)

  • :maxvps (Object)

    maximum amount of virtual servers (optional)

  • :maxusers (Object)

    maximum amount of users (optional)

  • :maxmem (Object)

    maximum amount memory (optional)

  • :maxburst (Object)

    maximum amount of burst memory or swapspace (optional)

  • :maxdisk (Object)

    maximum amount of diskspace (optional)

  • :maxbw (Object)

    maximum amount of bandwidth (optional)

  • :maxipv4 (Object)

    maximum amount of ipv4 addresses (optional)

  • :maxipv6 (Object)

    maximum amount of ipv6 addresses (optional)

  • :nodegroups (Object)

    comma separated list of node groups (optional)

  • :mediagroups (Object)

    comma separated list of media groups (optional)

  • :openvz (Object)

    y|n Allow building of openvz virtual servers (optional)

  • :xenpv (Object)

    y|n Allow building of xen pv virtual servers (optional)

  • :xenhvm (Object)

    y|n Allow building of xen hvm virtual servers (optional)

  • :kvm (Object)

    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

- (Object) delete(username)

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

- (Object) info(username)

Retrieves information from an existing reseller.

Parameters:

  • 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

- (Object) list

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