lumberg 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +98 -0
- data/LICENSE +20 -0
- data/README.md +178 -0
- data/Rakefile +49 -0
- data/lib/cacert.pem +3910 -0
- data/lib/lumberg.rb +23 -0
- data/lib/lumberg/exceptions.rb +6 -0
- data/lib/lumberg/version.rb +3 -0
- data/lib/lumberg/whm.rb +70 -0
- data/lib/lumberg/whm/account.rb +329 -0
- data/lib/lumberg/whm/args.rb +113 -0
- data/lib/lumberg/whm/base.rb +28 -0
- data/lib/lumberg/whm/dns.rb +205 -0
- data/lib/lumberg/whm/reseller.rb +268 -0
- data/lib/lumberg/whm/server.rb +290 -0
- data/lib/net_http_hacked.rb +42 -0
- data/lumberg.gemspec +28 -0
- data/spec/lumberg_spec.rb +9 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/vcr_cassettes/whm/account/accountsummary.yml +43 -0
- data/spec/vcr_cassettes/whm/account/changepackage.yml +64 -0
- data/spec/vcr_cassettes/whm/account/createacct.yml +43 -0
- data/spec/vcr_cassettes/whm/account/domainuserdata.yml +43 -0
- data/spec/vcr_cassettes/whm/account/editquota.yml +85 -0
- data/spec/vcr_cassettes/whm/account/limitbw.yml +85 -0
- data/spec/vcr_cassettes/whm/account/listaccts.yml +147 -0
- data/spec/vcr_cassettes/whm/account/listsuspended.yml +43 -0
- data/spec/vcr_cassettes/whm/account/modifyacct.yml +63 -0
- data/spec/vcr_cassettes/whm/account/myprivs.yml +43 -0
- data/spec/vcr_cassettes/whm/account/passwd.yml +43 -0
- data/spec/vcr_cassettes/whm/account/removeacct.yml +85 -0
- data/spec/vcr_cassettes/whm/account/restoreaccount.yml +198 -0
- data/spec/vcr_cassettes/whm/account/setsiteip.yml +190 -0
- data/spec/vcr_cassettes/whm/account/suspend.yml +64 -0
- data/spec/vcr_cassettes/whm/account/unsuspend.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/adddns.yml +64 -0
- data/spec/vcr_cassettes/whm/dns/addzonerecord.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/dumpzone.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/editzonerecord.yml +64 -0
- data/spec/vcr_cassettes/whm/dns/getzonerecord.yml +64 -0
- data/spec/vcr_cassettes/whm/dns/killdns.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/listmxs.yml +22 -0
- data/spec/vcr_cassettes/whm/dns/listzones.yml +22 -0
- data/spec/vcr_cassettes/whm/dns/lookupnsip.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/removezonerecord.yml +64 -0
- data/spec/vcr_cassettes/whm/dns/resetzone.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/resolvedomainname.yml +43 -0
- data/spec/vcr_cassettes/whm/dns/savemxs.yml +22 -0
- data/spec/vcr_cassettes/whm/reseller/acctcounts.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/listacls.yml +22 -0
- data/spec/vcr_cassettes/whm/reseller/listresellers.yml +22 -0
- data/spec/vcr_cassettes/whm/reseller/resellerstats.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/saveacllist.yml +85 -0
- data/spec/vcr_cassettes/whm/reseller/setacls.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/setresellerips.yml +42 -0
- data/spec/vcr_cassettes/whm/reseller/setresellerlimits.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/setresellermainip.yml +64 -0
- data/spec/vcr_cassettes/whm/reseller/setresellernameservers.yml +64 -0
- data/spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml +64 -0
- data/spec/vcr_cassettes/whm/reseller/setupreseller.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/suspendreseller.yml +64 -0
- data/spec/vcr_cassettes/whm/reseller/terminatereseller.yml +64 -0
- data/spec/vcr_cassettes/whm/reseller/unsetupreseller.yml +43 -0
- data/spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml +43 -0
- data/spec/vcr_cassettes/whm/server/applist.yml +22 -0
- data/spec/vcr_cassettes/whm/server/gethostname.yml +22 -0
- data/spec/vcr_cassettes/whm/server/getlanglist.yml +22 -0
- data/spec/vcr_cassettes/whm/server/loadavg.yml +28 -0
- data/spec/vcr_cassettes/whm/server/my_function.yml +64 -0
- data/spec/vcr_cassettes/whm/server/response_type.yml +85 -0
- data/spec/vcr_cassettes/whm/server/systemloadavg.yml +43 -0
- data/spec/vcr_cassettes/whm/server/version.yml +22 -0
- data/spec/whm/account_spec.rb +577 -0
- data/spec/whm/args_spec.rb +179 -0
- data/spec/whm/base_spec.rb +28 -0
- data/spec/whm/dns_spec.rb +352 -0
- data/spec/whm/reseller_spec.rb +359 -0
- data/spec/whm/server_spec.rb +288 -0
- data/spec/whm/whm_spec.rb +41 -0
- metadata +265 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Lumberg
|
|
2
|
+
module Whm
|
|
3
|
+
class Base
|
|
4
|
+
# Whm::Server
|
|
5
|
+
attr_accessor :server
|
|
6
|
+
|
|
7
|
+
#
|
|
8
|
+
# ==== Required
|
|
9
|
+
# * <tt>:server</tt> - PENDING
|
|
10
|
+
def initialize(options = {})
|
|
11
|
+
Args.new(options) do |c|
|
|
12
|
+
c.requires :server
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
@server = setup_server options.delete(:server)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def setup_server(value)
|
|
19
|
+
if value.is_a?(Whm::Server)
|
|
20
|
+
value
|
|
21
|
+
else
|
|
22
|
+
Whm::Server.new value
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
module Lumberg
|
|
2
|
+
module Whm
|
|
3
|
+
class Dns < Base
|
|
4
|
+
# Creates a DNS zone. All zone information other than domain name and IP address is created based on the standard zone template in WHM.
|
|
5
|
+
# Your MX, nameserver, domain PTR, and A records will all be generated automatically
|
|
6
|
+
#
|
|
7
|
+
# ==== Required
|
|
8
|
+
# * <tt>:domain</tt> - PENDING
|
|
9
|
+
# * <tt>:ip</tt> - PENDING
|
|
10
|
+
#
|
|
11
|
+
# ==== Optional
|
|
12
|
+
# * <tt>:template</tt> - PENDING
|
|
13
|
+
# * <tt>:trueowner</tt> - PENDING
|
|
14
|
+
def add_zone(options = {})
|
|
15
|
+
Args.new(options) do |c|
|
|
16
|
+
c.requires :domain, :ip
|
|
17
|
+
c.optionals :template, :trueowner
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
server.perform_request('adddns', options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Adds a DNS zone record to the server
|
|
24
|
+
#
|
|
25
|
+
# ==== Required
|
|
26
|
+
# * <tt>:zone</tt> - PENDING
|
|
27
|
+
#
|
|
28
|
+
# ==== Optional
|
|
29
|
+
# * <tt>:name</tt> - PENDING
|
|
30
|
+
# * <tt>:address</tt> - PENDING
|
|
31
|
+
# * <tt>:type</tt> - PENDING
|
|
32
|
+
# * <tt>:class</tt> - PENDING
|
|
33
|
+
# * <tt>:cname</tt> - PENDING
|
|
34
|
+
# * <tt>:exchange</tt> - PENDING
|
|
35
|
+
# * <tt>:nsdname</tt> - PENDING
|
|
36
|
+
# * <tt>:ptdrname</tt> - PENDING
|
|
37
|
+
# * <tt>:preference</tt> - PENDING
|
|
38
|
+
# * <tt>:ttl</tt> - PENDING
|
|
39
|
+
def add_zone_record(options = {})
|
|
40
|
+
Args.new(options) do |c|
|
|
41
|
+
c.requires :zone
|
|
42
|
+
c.optionals :name, :address, :type, :class, :cname, :exchange, :nsdname, :ptdrname, :preference, :ttl
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
server.perform_request('addzonerecord', options)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Generates a list of all domains and corresponding DNS zones associated with your server
|
|
49
|
+
def list_zones(options = {})
|
|
50
|
+
server.perform_request('listzones', options.merge(:key => 'zone'))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Return zone records for a domain.
|
|
54
|
+
#
|
|
55
|
+
# To use this function most effectively, you may first wish to run the dumpzone function for the domain(s) whose record(s) you wish to retrieve.
|
|
56
|
+
# The Line output variable from that function call can then be used as a reference to create the input for this function.
|
|
57
|
+
#
|
|
58
|
+
# ==== Required
|
|
59
|
+
# * <tt>:domain</tt> - PENDING
|
|
60
|
+
# * <tt>:Line</tt> - PENDING
|
|
61
|
+
def get_zone_record(options = {})
|
|
62
|
+
Args.new(options) do |c|
|
|
63
|
+
c.requires :domain, :Line
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
server.perform_request('getzonerecord', options)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Displays the DNS zone configuration for a specific domain
|
|
70
|
+
#
|
|
71
|
+
# ==== Required
|
|
72
|
+
# * <tt>:domain</tt> - PENDING
|
|
73
|
+
def dump_zone(options = {})
|
|
74
|
+
Args.new(options) do |c|
|
|
75
|
+
c.requires :domain
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
server.perform_request('dumpzone', options)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attempts to resolve an IP address for a specified domain name
|
|
82
|
+
#
|
|
83
|
+
# ==== Required
|
|
84
|
+
# * <tt>:domain</tt> - PENDING
|
|
85
|
+
# * <tt>:"api.version".to_sym</tt> - PENDING
|
|
86
|
+
def resolve_domain(options = {})
|
|
87
|
+
Args.new(options) do |c|
|
|
88
|
+
c.requires :domain, "api.version".to_sym
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
server.perform_request('resolvedomainname', options.merge(:key => 'data'))
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Allows you to edit a DNS zone record on the server.
|
|
95
|
+
#
|
|
96
|
+
# To use this function most effectively, you should first run the dumpzone function for the domain(s) whose record(s) you wish to edit.
|
|
97
|
+
# The output of that function call will be used as a reference to create the input for this function.
|
|
98
|
+
#
|
|
99
|
+
# ==== Required
|
|
100
|
+
# * <tt>:domain</tt> - PENDING
|
|
101
|
+
# * <tt>:Line</tt> - PENDING
|
|
102
|
+
#
|
|
103
|
+
# ==== Optional
|
|
104
|
+
# * <tt>:address</tt> - PENDING
|
|
105
|
+
# * <tt>:class</tt> - PENDING
|
|
106
|
+
# * <tt>:cname</tt> - PENDING
|
|
107
|
+
# * <tt>:exchange</tt> - PENDING
|
|
108
|
+
# * <tt>:preference</tt> - PENDING
|
|
109
|
+
# * <tt>:expire</tt> - PENDING
|
|
110
|
+
# * <tt>:minimum</tt> - PENDING
|
|
111
|
+
# * <tt>:mname</tt> - PENDING
|
|
112
|
+
def edit_zone_record(options = {})
|
|
113
|
+
Args.new(options) do |c|
|
|
114
|
+
c.requires :domain, :Line
|
|
115
|
+
c.optionals :address, :class, :cname, :exchange, :preference, :expire, :minimum, :mname,
|
|
116
|
+
:name, :nsdname, :raw, :refresh, :retry, :rname, :serial, :ttl, :type, :txtdata
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
server.perform_request('editzonerecord', options)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Deletes a DNS zone
|
|
123
|
+
#
|
|
124
|
+
# ==== Required
|
|
125
|
+
# * <tt>:domain</tt> - PENDING
|
|
126
|
+
def kill_dns(options = {})
|
|
127
|
+
Args.new(options) do |c|
|
|
128
|
+
c.requires :domain
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
server.perform_request('killdns', options)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Obtains the IP address of a registered nameserver from the root nameservers
|
|
135
|
+
#
|
|
136
|
+
# ==== Required
|
|
137
|
+
# * <tt>:nameserver</tt> - PENDING
|
|
138
|
+
def lookup_nameserver_ip(options = {})
|
|
139
|
+
Args.new(options) do |c|
|
|
140
|
+
c.requires :nameserver
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
server.perform_request('lookupnsip', options.merge(:key => 'ip'))
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Allows you to remove a DNS zone record from the server.
|
|
147
|
+
#
|
|
148
|
+
# To use this function most effectively, you should first run the dumpzone function for the domain(s) whose record(s) you wish to remove.
|
|
149
|
+
# The output of that function call will be used as a reference to create the input for this function.
|
|
150
|
+
#
|
|
151
|
+
# ==== Required
|
|
152
|
+
# * <tt>:zone</tt> - PENDING
|
|
153
|
+
# * <tt>:Line</tt> - PENDING
|
|
154
|
+
def remove_zone_record(options = {})
|
|
155
|
+
Args.new(options) do |c|
|
|
156
|
+
c.requires :zone, :Line
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
server.perform_request('removezonerecord', options)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Restore a DNS zone to its default values. This includes any subdomain DNS records associated with the domain.
|
|
163
|
+
#
|
|
164
|
+
# This function can be useful for restoring DNS zones that have become corrupted or have been improperly edited.
|
|
165
|
+
# It will also restore zone file subdomains listed in the server's httpd.conf file, along with default settings for new accounts.
|
|
166
|
+
#
|
|
167
|
+
# ==== Required
|
|
168
|
+
# * <tt>:domain</tt> - PENDING
|
|
169
|
+
# * <tt>:zone</tt> - PENDING
|
|
170
|
+
def reset_zone(options = {})
|
|
171
|
+
Args.new(options) do |c|
|
|
172
|
+
c.requires :domain, :zone
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
server.perform_request('resetzone', options)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# This function will list a specified domain's MX records
|
|
179
|
+
#
|
|
180
|
+
# *This function is only available in version 11.27/11.28+*
|
|
181
|
+
#
|
|
182
|
+
# ==== Required
|
|
183
|
+
# * <tt>:domain</tt> - PENDING
|
|
184
|
+
# * <tt>:"api.version".to_sym</tt> - PENDING
|
|
185
|
+
def list_mxs(options = {})
|
|
186
|
+
Args.new(options) do |c|
|
|
187
|
+
c.requires :domain, "api.version".to_sym
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
server.perform_request('listmxs', options.merge(:key => 'data'))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# This function will add an MX record
|
|
194
|
+
#
|
|
195
|
+
# *This function is only available in version 11.27/11.28+*
|
|
196
|
+
def save_mx(options = {})
|
|
197
|
+
Args.new(options) do |c|
|
|
198
|
+
c.requires "api.version".to_sym, :domain, :name, :exchange, :preference
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
server.perform_request('savemxs', options)
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
module Lumberg
|
|
2
|
+
module Whm
|
|
3
|
+
class Reseller < Base
|
|
4
|
+
# Gives reseller status to an account.
|
|
5
|
+
#
|
|
6
|
+
# *Note:* The user must already exist to be made a reseller. This function will not create an account. If the account does not yet exist, you can use the createacct function to set it up before conferring reseller privileges.
|
|
7
|
+
#
|
|
8
|
+
# ==== Required
|
|
9
|
+
# * <tt>:username</tt> - PENDING
|
|
10
|
+
def create(options = {})
|
|
11
|
+
Args.new(options) do |c|
|
|
12
|
+
c.requires :username
|
|
13
|
+
c.booleans :makeowner
|
|
14
|
+
end
|
|
15
|
+
options[:user] = options.delete(:username)
|
|
16
|
+
server.perform_request('setupreseller', options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Lists the usernames of all resellers on the server
|
|
20
|
+
def list
|
|
21
|
+
# This method is funky. That is all
|
|
22
|
+
result = server.perform_request('listresellers', :key => 'reseller')
|
|
23
|
+
result[:success] = true
|
|
24
|
+
result[:params] = {:resellers => result.delete(:params)}
|
|
25
|
+
result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Adds IP addresses to a reseller account
|
|
29
|
+
#
|
|
30
|
+
# ==== Required
|
|
31
|
+
# * <tt>:username</tt> - PENDING
|
|
32
|
+
#
|
|
33
|
+
# ==== Optional
|
|
34
|
+
# * <tt>:ips</tt> - PENDING
|
|
35
|
+
def add_ips(options = {})
|
|
36
|
+
Args.new(options) do |c|
|
|
37
|
+
c.requires :username
|
|
38
|
+
c.optionals :ips
|
|
39
|
+
c.booleans :delegate
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
options[:user] = options.delete(:username)
|
|
43
|
+
server.perform_request('setresellerips', options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Specifies the amount of bandwidth and disk space a reseller is able to use
|
|
47
|
+
#
|
|
48
|
+
# ==== Required
|
|
49
|
+
# * <tt>:username</tt> - PENDING
|
|
50
|
+
#
|
|
51
|
+
# ==== Optional
|
|
52
|
+
# * <tt>:account_limit</tt> - PENDING
|
|
53
|
+
# * <tt>:bandwidth_limit</tt> - PENDING
|
|
54
|
+
# * <tt>:diskspace_limit</tt> - PENDING
|
|
55
|
+
def set_limits(options = {})
|
|
56
|
+
Args.new(options) do |c|
|
|
57
|
+
c.requires :username
|
|
58
|
+
c.optionals :account_limit, :bandwidth_limit, :diskspace_limit
|
|
59
|
+
c.booleans :enable_account_limit, :enable_resource_limits, :enable_overselling,
|
|
60
|
+
:enable_overselling_bandwidth, :enable_overselling_diskspace, :enable_package_limits,
|
|
61
|
+
:enable_package_limit_numbers
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
options[:user] = options.delete(:username)
|
|
65
|
+
server.perform_request('setresellerlimits', options)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Terminates a reseller's main account, as well as all accounts owned by the reseller
|
|
69
|
+
#
|
|
70
|
+
# ==== Required
|
|
71
|
+
# * <tt>:reseller</tt> - PENDING
|
|
72
|
+
def terminate(options = {})
|
|
73
|
+
Args.new(options) do |c|
|
|
74
|
+
c.requires :reseller
|
|
75
|
+
c.booleans :terminatereseller
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# WTF, seriously?
|
|
79
|
+
wtf = "I understand this will irrevocably remove all the "
|
|
80
|
+
wtf << "accounts owned by the reseller #{options[:reseller]}"
|
|
81
|
+
options[:verify] = wtf
|
|
82
|
+
|
|
83
|
+
server.perform_request('terminatereseller', options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Assigns a main, shared IP address to a reseller
|
|
87
|
+
#
|
|
88
|
+
# ==== Required
|
|
89
|
+
# * <tt>:username</tt> - PENDING
|
|
90
|
+
# * <tt>:ip</tt> - PENDING
|
|
91
|
+
def set_main_ip(options = {})
|
|
92
|
+
Args.new(options) do |c|
|
|
93
|
+
c.requires :username, :ip
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
options[:user] = options.delete(:username)
|
|
97
|
+
server.perform_request('setresellermainip', options)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Sets which packages resellers are able to use. It also allows you to define the number of times a package can be used by a reseller
|
|
101
|
+
#
|
|
102
|
+
# ==== Required
|
|
103
|
+
# * <tt>:username</tt> - PENDING
|
|
104
|
+
# * <tt>:no_limit</tt> - PENDING
|
|
105
|
+
# * <tt>:package</tt> - PENDING
|
|
106
|
+
#
|
|
107
|
+
# ==== Optional
|
|
108
|
+
# * <tt>:allowed</tt> - PENDING
|
|
109
|
+
# * <tt>:number</tt> - PENDING
|
|
110
|
+
def set_package_limit(options = {})
|
|
111
|
+
Args.new(options) do |c|
|
|
112
|
+
c.requires :username, :no_limit, :package
|
|
113
|
+
c.booleans :no_limit, :allowed
|
|
114
|
+
c.optionals :allowed, :number
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
options[:user] = options.delete(:username)
|
|
118
|
+
server.perform_request('setresellerpackagelimit', options)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Suspends a reseller's account. The suspension will prevent the reseller from accessing his or her account
|
|
122
|
+
#
|
|
123
|
+
# ==== Required
|
|
124
|
+
# * <tt>:username</tt> - PENDING
|
|
125
|
+
#
|
|
126
|
+
# ==== Optional
|
|
127
|
+
# * <tt>:reason</tt> - PENDING
|
|
128
|
+
def suspend(options = {})
|
|
129
|
+
Args.new(options) do |c|
|
|
130
|
+
c.requires :username
|
|
131
|
+
c.optionals :reason
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
options[:user] = options.delete(:username)
|
|
135
|
+
server.perform_request('suspendreseller', options)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Unsuspends a reseller's account
|
|
139
|
+
#
|
|
140
|
+
# ==== Required
|
|
141
|
+
# * <tt>:username</tt> - PENDING
|
|
142
|
+
def unsuspend(options = {})
|
|
143
|
+
Args.new(options) do |c|
|
|
144
|
+
c.requires :username
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
options[:user] = options.delete(:username)
|
|
148
|
+
server.perform_request('unsuspendreseller', options)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Lists the total number of accounts owned by a reseller, as well as how many suspended accounts the reseller owns, and what the reseller's account creation limit is, if any.
|
|
152
|
+
# If no reseller is specified, counts will be provided for the reseller who is currently logged in.
|
|
153
|
+
#
|
|
154
|
+
# *Note:* Counts for other users will only be provided if the user issuing the function call has root-level permissions or owns the provided account.
|
|
155
|
+
#
|
|
156
|
+
# ==== Required
|
|
157
|
+
# * <tt>:username</tt> - PENDING
|
|
158
|
+
def account_counts(options = {})
|
|
159
|
+
Args.new(options) do |c|
|
|
160
|
+
c.requires :username
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
options[:user] = options.delete(:username)
|
|
164
|
+
server.perform_request('acctcounts', options.merge(:key => 'reseller'))
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Defines a reseller's nameservers. Additionally, you may use it to reset a reseller's nameservers to the default settings
|
|
168
|
+
#
|
|
169
|
+
# ==== Required
|
|
170
|
+
# * <tt>:username</tt> - PENDING
|
|
171
|
+
#
|
|
172
|
+
# ==== Optional
|
|
173
|
+
# * <tt>:nameservers</tt> - PENDING
|
|
174
|
+
def set_nameservers(options = {})
|
|
175
|
+
Args.new(options) do |c|
|
|
176
|
+
c.requires :username
|
|
177
|
+
c.optionals :nameservers
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
options[:user] = options.delete(:username)
|
|
181
|
+
server.perform_request('setresellernameservers', options)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Shows account statistics for a specific reseller's accounts
|
|
185
|
+
#
|
|
186
|
+
# ==== Required
|
|
187
|
+
# * <tt>:reseller</tt> - PENDING
|
|
188
|
+
def stats(options = {})
|
|
189
|
+
Args.new(options) do |c|
|
|
190
|
+
c.requires :reseller
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
server.perform_request('resellerstats', options)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Lists the saved reseller ACL lists on the server
|
|
197
|
+
def list_acls
|
|
198
|
+
server.perform_request('listacls', {:key => 'acls'})
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Creates a new reseller ACL list
|
|
202
|
+
#
|
|
203
|
+
# ==== Required
|
|
204
|
+
# * <tt>:acllist</tt> - PENDING
|
|
205
|
+
def save_acl_list(options = {})
|
|
206
|
+
optional_args = [
|
|
207
|
+
"acl-add-pkg", "acl-add-pkg-ip", "acl-add-pkg-shell", "acl-all", "acl-allow-addoncreate",
|
|
208
|
+
"acl-allow-parkedcreate", "acl-allow-unlimited-disk-pkgs", "acl-allow-unlimited-pkgs",
|
|
209
|
+
"acl-clustering", "acl-create-acct", "acl-create-dns", "acl-demo-setup", "acl-disallow-shell",
|
|
210
|
+
"acl-edit-account", "acl-edit-dns", "acl-edit-mx", "acl-edit-pkg", "acl-frontpage",
|
|
211
|
+
"acl-kill-acct", "acl-kill-dns", "acl-limit-bandwidth", "acl-list-accts", "acl-mailcheck",
|
|
212
|
+
"acl-mod-subdomains", "acl-news", "acl-onlyselfandglobalpkgs", "acl-park-dns", "acl-passwd",
|
|
213
|
+
"acl-quota", "acl-rearrange-accts", "acl-res-cart", "acl-status", "acl-resftp", "acl-restart",
|
|
214
|
+
"acl-show-bandwidth", "acl-ssl", "acl-ssl-gencrt", "acl-stats", "acl-suspend-acct", "acl-upgrade-account"
|
|
215
|
+
].collect { |option| option.to_sym }
|
|
216
|
+
|
|
217
|
+
Args.new(options) do |c|
|
|
218
|
+
c.requires :acllist
|
|
219
|
+
c.booleans *optional_args
|
|
220
|
+
c.optionals *optional_args
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
server.perform_request('saveacllist', options.merge(:key => 'results'))
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Sets the ACL for a reseller, or modifies specific ACL items for a reseller
|
|
227
|
+
#
|
|
228
|
+
# ==== Required
|
|
229
|
+
# * <tt>:reseller</tt> - PENDING
|
|
230
|
+
#
|
|
231
|
+
# ==== Optional
|
|
232
|
+
# * <tt>:acllist</tt> - PENDING
|
|
233
|
+
# * <tt>:*optional_args</tt> - PENDING
|
|
234
|
+
def set_acls(options = {})
|
|
235
|
+
optional_args = [
|
|
236
|
+
"acl-add-pkg", "acl-add-pkg-ip", "acl-add-pkg-shell", "acl-all", "acl-allow-addoncreate",
|
|
237
|
+
"acl-allow-parkedcreate", "acl-allow-unlimited-disk-pkgs", "acl-allow-unlimited-pkgs",
|
|
238
|
+
"acl-clustering", "acl-create-acct", "acl-create-dns", "acl-demo-setup", "acl-disallow-shell",
|
|
239
|
+
"acl-edit-account", "acl-edit-dns", "acl-edit-mx", "acl-edit-pkg", "acl-frontpage",
|
|
240
|
+
"acl-kill-acct", "acl-kill-dns", "acl-limit-bandwidth", "acl-list-accts", "acl-mailcheck",
|
|
241
|
+
"acl-mod-subdomains", "acl-news", "acl-onlyselfandglobalpkgs", "acl-park-dns", "acl-passwd",
|
|
242
|
+
"acl-quota", "acl-rearrange-accts", "acl-res-cart", "acl-status", "acl-resftp", "acl-restart",
|
|
243
|
+
"acl-show-bandwidth", "acl-ssl", "acl-ssl-gencrt", "acl-stats", "acl-suspend-acct", "acl-upgrade-account"
|
|
244
|
+
].collect { |option| option.to_sym }
|
|
245
|
+
|
|
246
|
+
Args.new(options) do |c|
|
|
247
|
+
c.requires :reseller
|
|
248
|
+
c.booleans *optional_args
|
|
249
|
+
c.optionals :acllist, *optional_args
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
server.perform_request('setacls', options)
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Removes reseller status from an account
|
|
256
|
+
#
|
|
257
|
+
# *Note:* This function will not delete the account; it will only remove its reseller status
|
|
258
|
+
def unsetup(options = {})
|
|
259
|
+
Args.new(options) do |c|
|
|
260
|
+
c.requires :username
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
options[:user] = options.delete(:username)
|
|
264
|
+
server.perform_request('unsetupreseller', options)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
end
|