linodeapi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/linodeapi.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'httparty'
2
+
1
3
  ##
2
4
  # Linode API wrapper
3
5
  module LinodeAPI
@@ -5,6 +7,7 @@ module LinodeAPI
5
7
  # Default API endpoint
6
8
 
7
9
  DEFAULT_ENDPOINT = 'https://api.linode.com/'
10
+ SPEC_URL = 'https://api.linode.com/?api_action=api.spec'
8
11
 
9
12
  class << self
10
13
  ##
@@ -13,9 +16,62 @@ module LinodeAPI
13
16
  def new(*args)
14
17
  self::API.new(*args)
15
18
  end
19
+
20
+ def spec
21
+ @spec ||= { type: :group, subs: fetch_spec }
22
+ end
23
+
24
+ private
25
+
26
+ def fetch_spec
27
+ raw = JSON.parse(HTTParty.get(SPEC_URL).body)['DATA']['METHODS']
28
+ raw.each_with_object({}) do |(method, info), spec|
29
+ name, groups = parse_method(method)
30
+ params = parse_params(info['PARAMETERS'])
31
+ add_call(spec, groups, name, params, info)
32
+ end
33
+ end
34
+
35
+ def add_call(spec, groups, name, params, info)
36
+ subgroup = nest_spec(spec, groups)
37
+ subgroup[name] = {
38
+ type: :call,
39
+ desc: info['DESCRIPTION'],
40
+ throws: info['THROWS'].split(','),
41
+ params: Hash[params]
42
+ }
43
+ end
44
+
45
+ def nest_spec(spec, groups)
46
+ groups.reduce(spec) do |layout, new|
47
+ layout[new] ||= { type: :group, subs: {} }
48
+ layout[new][:subs]
49
+ end
50
+ end
51
+
52
+ def parse_method(method)
53
+ keys = method.split('.').map(&:to_sym)
54
+ [keys.pop, keys]
55
+ end
56
+
57
+ def parse_params(params)
58
+ params.map do |k, v|
59
+ [
60
+ k.downcase.to_sym,
61
+ parse_args(v)
62
+ ]
63
+ end
64
+ end
65
+
66
+ def parse_args(args)
67
+ {
68
+ desc: args['DESCRIPTION'],
69
+ type: args['TYPE'].to_sym,
70
+ required: args['REQUIRED']
71
+ }
72
+ end
16
73
  end
17
74
  end
18
75
 
19
- require 'linodeapi/spec'
20
76
  require 'linodeapi/raw'
21
77
  require 'linodeapi/api'
data/lib/linodeapi/raw.rb CHANGED
@@ -14,7 +14,7 @@ module LinodeAPI
14
14
  def initialize(params = {})
15
15
  self.class.base_uri params.fetch(:endpoint, DEFAULT_ENDPOINT)
16
16
  @names = params.fetch(:names) { [] }
17
- @spec = params.fetch(:spec) { SPEC }
17
+ @spec = params.fetch(:spec) { LinodeAPI.spec }
18
18
  @apikey = params.fetch(:apikey) { authenticate(params).first }
19
19
  end
20
20
 
@@ -68,7 +68,15 @@ module LinodeAPI
68
68
  method = (@names + [method.to_s]).join '.'
69
69
  options = self.class.validate method, spec[:params], params
70
70
  options.merge! api_key: @apikey, api_action: method
71
- self.class.parse self.class.post('', body: options).parsed_response
71
+ error_check self.class.post('', body: options)
72
+ end
73
+
74
+ def error_check(resp)
75
+ code = resp.code
76
+ fail("API threw HTTP error code #{code}") unless code == 200
77
+ data = resp.parsed_response
78
+ fail('Invalid API response received') if data.nil?
79
+ self.class.parse data
72
80
  end
73
81
 
74
82
  def self.parse(resp)
data/linodeapi.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'linodeapi'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
 
6
6
  s.summary = 'Linode API wrapper'
@@ -15,10 +15,10 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency 'httparty', '~> 0.13.1'
17
17
 
18
- s.add_development_dependency 'rubocop', '~> 0.29.0'
18
+ s.add_development_dependency 'rubocop', '~> 0.32.0'
19
19
  s.add_development_dependency 'rake', '~> 10.4.0'
20
- s.add_development_dependency 'coveralls', '~> 0.7.1'
21
- s.add_development_dependency 'rspec', '~> 3.2.0'
20
+ s.add_development_dependency 'coveralls', '~> 0.8.0'
21
+ s.add_development_dependency 'rspec', '~> 3.3.0'
22
22
  s.add_development_dependency 'fuubar', '~> 2.0.0'
23
- s.add_development_dependency 'activesupport', '~> 4.2.0'
23
+ s.add_development_dependency 'activesupport', '~> 4.2.2'
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linodeapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-01 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.29.0
33
+ version: 0.32.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.29.0
40
+ version: 0.32.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.7.1
61
+ version: 0.8.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.7.1
68
+ version: 0.8.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.2.0
75
+ version: 3.3.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 3.2.0
82
+ version: 3.3.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: fuubar
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 4.2.0
103
+ version: 4.2.2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 4.2.0
110
+ version: 4.2.2
111
111
  description: Wraps the Linode API with multiple levels of interaction
112
112
  email: me@lesaker.org
113
113
  executables: []
@@ -122,11 +122,11 @@ files:
122
122
  - LICENSE
123
123
  - README.md
124
124
  - Rakefile
125
- - dev/update_spec.rb
125
+ - dev/cache_spec.rb
126
+ - dev/spec.yml
126
127
  - lib/linodeapi.rb
127
128
  - lib/linodeapi/api.rb
128
129
  - lib/linodeapi/raw.rb
129
- - lib/linodeapi/spec.rb
130
130
  - linodeapi.gemspec
131
131
  - spec/linodeapi_spec.rb
132
132
  - spec/spec_helper.rb
data/dev/update_spec.rb DELETED
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'httparty'
4
- require 'pp'
5
- require 'erb'
6
- require 'active_support/ordered_hash'
7
-
8
- SPEC_PATH = 'lib/linodeapi/spec.rb'
9
-
10
- TEMPLATE = '##
11
- # Dynamically updated spec from the api.spec call
12
- # rubocop:disable all
13
-
14
- module LinodeAPI
15
- SPEC =
16
- <%= clean %>
17
- end
18
- '
19
- # rubocop:enable all
20
-
21
- raw = HTTParty.get('https://api.linode.com/?api_action=api.spec').body
22
- raw = JSON.parse(raw)['DATA']['METHODS']
23
-
24
- spec = ActiveSupport::OrderedHash.new
25
-
26
- raw.sort_by(&:first).each_with_object(spec) do |(method, info), acc|
27
- groups = method.split('.').map(&:to_sym)
28
- name = groups.pop
29
-
30
- params = info['PARAMETERS'].sort_by(&:first).map do |k, v|
31
- # rubocop:disable Style/MultilineOperationIndentation
32
- [
33
- k.downcase.to_sym,
34
- ActiveSupport::OrderedHash[
35
- desc: v['DESCRIPTION'],
36
- type: v['TYPE'].to_sym,
37
- required: v['REQUIRED']
38
- ]
39
- ]
40
- # rubocop:enable Style/MultilineOperationIndentation
41
- end
42
-
43
- local = groups.reduce(acc) do |layout, new|
44
- layout[new] ||= { type: :group, subs: {} }
45
- layout[new][:subs]
46
- end
47
-
48
- local[name] = {
49
- type: :call,
50
- desc: info['DESCRIPTION'],
51
- throws: info['THROWS'].split(','),
52
- params: ActiveSupport::OrderedHash[params]
53
- }
54
- end
55
-
56
- clean = ''
57
- PP.pp({ type: 'group', subs: spec }, clean)
58
- File.open(SPEC_PATH, 'w') { |fh| fh.write ERB.new(TEMPLATE).result }
59
-
60
- puts 'Updated spec file'
@@ -1,1359 +0,0 @@
1
- ##
2
- # Dynamically updated spec from the api.spec call
3
- # rubocop:disable all
4
-
5
- module LinodeAPI
6
- SPEC =
7
- {:type=>"group",
8
- :subs=>
9
- {:account=>
10
- {:type=>:group,
11
- :subs=>
12
- {:estimateinvoice=>
13
- {:type=>:call,
14
- :desc=>
15
- "Estimates the invoice for adding a new Linode or NodeBalancer as well as resizing a Linode. This returns two fields: PRICE which is the estimated cost of the invoice, and INVOICE_TO which is the date invoice would be though with timezone set to America/New_York",
16
- :throws=>["VALIDATION"],
17
- :params=>
18
- {:linodeid=>
19
- {:desc=>
20
- "This is the LinodeID you want to resize and is required for mode 'linode_resize'.",
21
- :type=>:numeric,
22
- :required=>false},
23
- :paymentterm=>
24
- {:desc=>
25
- "Subscription term in months. One of: 1, 12, or 24. This is required for modes 'linode_new' and 'nodebalancer_new'.",
26
- :type=>:numeric,
27
- :required=>false},
28
- :planid=>
29
- {:desc=>
30
- "The desired PlanID available from avail.LinodePlans(). This is required for modes 'linode_new' and 'linode_resize'.",
31
- :type=>:numeric,
32
- :required=>false},
33
- :mode=>
34
- {:desc=>
35
- "This is one of the following options: 'linode_new', 'linode_resize', or 'nodebalancer_new'.",
36
- :type=>:string,
37
- :required=>true}}},
38
- :info=>
39
- {:type=>:call,
40
- :desc=>
41
- "Shows information about your account such as the date your account was opened as well as your network utilization for the current month in gigabytes.",
42
- :throws=>[],
43
- :params=>{}},
44
- :paybalance=>
45
- {:type=>:call,
46
- :desc=>"Pays current balance on file, returning it in the response.",
47
- :throws=>
48
- ["CCEXPIRED",
49
- "CCFAILED",
50
- "NOACCESS",
51
- "PAYMENTLIMITER",
52
- "VALIDATION"],
53
- :params=>{}},
54
- :updatecard=>
55
- {:type=>:call,
56
- :desc=>"",
57
- :throws=>[],
58
- :params=>
59
- {:ccexpmonth=>{:desc=>"", :type=>:numeric, :required=>true},
60
- :ccexpyear=>{:desc=>"", :type=>:numeric, :required=>true},
61
- :ccnumber=>{:desc=>"", :type=>:numeric, :required=>true}}}}},
62
- :api=>
63
- {:type=>:group,
64
- :subs=>
65
- {:spec=>
66
- {:type=>:call,
67
- :desc=>
68
- "Returns a data structure of the entire Linode API specification. This method does not require authorization.<br><br>For example: <a target=\"_blank\" href=\"https://api.linode.com/?api_action=api.spec\">https://api.linode.com/?api_action=api.spec</a>",
69
- :throws=>[],
70
- :params=>{}}}},
71
- :avail=>
72
- {:type=>:group,
73
- :subs=>
74
- {:datacenters=>
75
- {:type=>:call,
76
- :desc=>"Returns a list of Linode data center facilities.",
77
- :throws=>[],
78
- :params=>{}},
79
- :distributions=>
80
- {:type=>:call,
81
- :desc=>"Returns a list of available Linux Distributions.",
82
- :throws=>[],
83
- :params=>
84
- {:distributionid=>
85
- {:desc=>"Limits the results to the specified DistributionID",
86
- :type=>:numeric,
87
- :required=>false}}},
88
- :kernels=>
89
- {:type=>:call,
90
- :desc=>"List available kernels.",
91
- :throws=>[],
92
- :params=>
93
- {:kernelid=>{:desc=>"", :type=>:numeric, :required=>false},
94
- :isxen=>
95
- {:desc=>"Limits the results to show only Xen kernels",
96
- :type=>:boolean,
97
- :required=>false}}},
98
- :linodeplans=>
99
- {:type=>:call,
100
- :desc=>
101
- "Returns a structure of Linode PlanIDs containing the Plan label and the availability in each Datacenter.",
102
- :throws=>[],
103
- :params=>
104
- {:planid=>
105
- {:desc=>"Limits the list to the specified PlanID",
106
- :type=>:numeric,
107
- :required=>false}}},
108
- :nodebalancers=>
109
- {:type=>:call,
110
- :desc=>"Returns NodeBalancer pricing information.",
111
- :throws=>[],
112
- :params=>{}},
113
- :stackscripts=>
114
- {:type=>:call,
115
- :desc=>"Returns a list of available public StackScripts.",
116
- :throws=>[],
117
- :params=>
118
- {:distributionid=>
119
- {:desc=>
120
- "Limit the results to StackScripts that can be applied to this DistributionID",
121
- :type=>:numeric,
122
- :required=>false},
123
- :distributionvendor=>
124
- {:desc=>"Debian, Ubuntu, Fedora, etc.",
125
- :type=>:string,
126
- :required=>false},
127
- :keywords=>
128
- {:desc=>"Search terms", :type=>:string, :required=>false}}}}},
129
- :domain=>
130
- {:type=>:group,
131
- :subs=>
132
- {:create=>
133
- {:type=>:call,
134
- :desc=>"Create a domain record.",
135
- :throws=>["NOACCESS", "VALIDATION"],
136
- :params=>
137
- {:description=>
138
- {:desc=>"Currently undisplayed.",
139
- :type=>:string,
140
- :required=>false},
141
- :domain=>
142
- {:desc=>"The zone's name", :type=>:string, :required=>true},
143
- :expire_sec=>{:desc=>"", :type=>:numeric, :required=>false},
144
- :refresh_sec=>{:desc=>"", :type=>:numeric, :required=>false},
145
- :retry_sec=>{:desc=>"", :type=>:numeric, :required=>false},
146
- :soa_email=>
147
- {:desc=>"Required when type=master",
148
- :type=>:string,
149
- :required=>false},
150
- :ttl_sec=>{:desc=>"", :type=>:numeric, :required=>false},
151
- :type=>{:desc=>"master or slave", :type=>:string, :required=>true},
152
- :axfr_ips=>
153
- {:desc=>
154
- "IP addresses allowed to AXFR the entire zone, semicolon separated",
155
- :type=>:string,
156
- :required=>false},
157
- :lpm_displaygroup=>
158
- {:desc=>
159
- "Display group in the Domain list inside the Linode DNS Manager",
160
- :type=>:string,
161
- :required=>false},
162
- :master_ips=>
163
- {:desc=>
164
- "When type=slave, the zone's master DNS servers list, semicolon separated ",
165
- :type=>:string,
166
- :required=>false},
167
- :status=>
168
- {:desc=>"0, 1, or 2 (disabled, active, edit mode)",
169
- :type=>:numeric,
170
- :required=>false}}},
171
- :delete=>
172
- {:type=>:call,
173
- :desc=>"",
174
- :throws=>["NOTFOUND"],
175
- :params=>{:domainid=>{:desc=>"", :type=>:numeric, :required=>true}}},
176
- :list=>
177
- {:type=>:call,
178
- :desc=>"Lists domains you have access to.",
179
- :throws=>[],
180
- :params=>
181
- {:domainid=>
182
- {:desc=>"Limits the list to the specified DomainID",
183
- :type=>:numeric,
184
- :required=>false}}},
185
- :resource=>
186
- {:type=>:group,
187
- :subs=>
188
- {:create=>
189
- {:type=>:call,
190
- :desc=>"Create a domain record.",
191
- :throws=>["NOACCESS", "VALIDATION"],
192
- :params=>
193
- {:domainid=>{:desc=>"", :type=>:numeric, :required=>true},
194
- :name=>
195
- {:desc=>
196
- "The hostname or FQDN. When Type=MX the subdomain to delegate to the Target MX server.",
197
- :type=>:string,
198
- :required=>false},
199
- :port=>{:desc=>"", :type=>:numeric, :required=>false},
200
- :priority=>
201
- {:desc=>"Priority for MX and SRV records, 0-255",
202
- :type=>:numeric,
203
- :required=>false},
204
- :protocol=>
205
- {:desc=>
206
- "The protocol to append to an SRV record. Ignored on other record types.",
207
- :type=>:string,
208
- :required=>false},
209
- :ttl_sec=>
210
- {:desc=>"TTL. Leave as 0 to accept our default.",
211
- :type=>:numeric,
212
- :required=>false},
213
- :target=>
214
- {:desc=>
215
- "When Type=MX the hostname. When Type=CNAME the target of the alias. When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.",
216
- :type=>:string,
217
- :required=>false},
218
- :type=>
219
- {:desc=>"One of: NS, MX, A, AAAA, CNAME, TXT, or SRV",
220
- :type=>:string,
221
- :required=>true},
222
- :weight=>{:desc=>"", :type=>:numeric, :required=>false}}},
223
- :delete=>
224
- {:type=>:call,
225
- :desc=>"",
226
- :throws=>["NOTFOUND"],
227
- :params=>
228
- {:domainid=>{:desc=>"", :type=>:numeric, :required=>true},
229
- :resourceid=>{:desc=>"", :type=>:numeric, :required=>true}}},
230
- :list=>
231
- {:type=>:call,
232
- :desc=>"",
233
- :throws=>[],
234
- :params=>
235
- {:domainid=>{:desc=>"", :type=>:numeric, :required=>true},
236
- :resourceid=>{:desc=>"", :type=>:numeric, :required=>false}}},
237
- :update=>
238
- {:type=>:call,
239
- :desc=>"Update a domain record.",
240
- :throws=>["NOTFOUND", "VALIDATION"],
241
- :params=>
242
- {:domainid=>{:desc=>"", :type=>:numeric, :required=>false},
243
- :name=>
244
- {:desc=>
245
- "The hostname or FQDN. When Type=MX the subdomain to delegate to the Target MX server.",
246
- :type=>:string,
247
- :required=>false},
248
- :port=>{:desc=>"", :type=>:numeric, :required=>false},
249
- :priority=>
250
- {:desc=>"Priority for MX and SRV records, 0-255",
251
- :type=>:numeric,
252
- :required=>false},
253
- :protocol=>
254
- {:desc=>
255
- "The protocol to append to an SRV record. Ignored on other record types.",
256
- :type=>:string,
257
- :required=>false},
258
- :resourceid=>{:desc=>"", :type=>:numeric, :required=>true},
259
- :ttl_sec=>
260
- {:desc=>"TTL. Leave as 0 to accept our default.",
261
- :type=>:numeric,
262
- :required=>false},
263
- :target=>
264
- {:desc=>
265
- "When Type=MX the hostname. When Type=CNAME the target of the alias. When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.",
266
- :type=>:string,
267
- :required=>false},
268
- :weight=>{:desc=>"", :type=>:numeric, :required=>false}}}}},
269
- :update=>
270
- {:type=>:call,
271
- :desc=>"Update a domain record.",
272
- :throws=>["NOTFOUND", "VALIDATION"],
273
- :params=>
274
- {:description=>
275
- {:desc=>"Currently undisplayed.",
276
- :type=>:string,
277
- :required=>false},
278
- :domain=>
279
- {:desc=>"The zone's name", :type=>:string, :required=>false},
280
- :domainid=>{:desc=>"", :type=>:numeric, :required=>true},
281
- :expire_sec=>{:desc=>"", :type=>:numeric, :required=>false},
282
- :refresh_sec=>{:desc=>"", :type=>:numeric, :required=>false},
283
- :retry_sec=>{:desc=>"", :type=>:numeric, :required=>false},
284
- :soa_email=>
285
- {:desc=>"Required when type=master",
286
- :type=>:string,
287
- :required=>false},
288
- :ttl_sec=>{:desc=>"", :type=>:numeric, :required=>false},
289
- :type=>{:desc=>"master or slave", :type=>:string, :required=>false},
290
- :axfr_ips=>
291
- {:desc=>
292
- "IP addresses allowed to AXFR the entire zone, semicolon separated",
293
- :type=>:string,
294
- :required=>false},
295
- :lpm_displaygroup=>
296
- {:desc=>
297
- "Display group in the Domain list inside the Linode DNS Manager",
298
- :type=>:string,
299
- :required=>false},
300
- :master_ips=>
301
- {:desc=>
302
- "When type=slave, the zone's master DNS servers list, semicolon separated ",
303
- :type=>:string,
304
- :required=>false},
305
- :status=>
306
- {:desc=>"0, 1, or 2 (disabled, active, edit mode)",
307
- :type=>:numeric,
308
- :required=>false}}}}},
309
- :image=>
310
- {:type=>:group,
311
- :subs=>
312
- {:delete=>
313
- {:type=>:call,
314
- :desc=>"Deletes a gold-master image",
315
- :throws=>["NOTFOUND"],
316
- :params=>
317
- {:imageid=>
318
- {:desc=>"The ID of the gold-master image to delete",
319
- :type=>:numeric,
320
- :required=>true}}},
321
- :list=>
322
- {:type=>:call,
323
- :desc=>"Lists available gold-master images",
324
- :throws=>["NOTFOUND"],
325
- :params=>
326
- {:imageid=>
327
- {:desc=>"Request information for a specific gold-master image",
328
- :type=>:numeric,
329
- :required=>false},
330
- :pending=>
331
- {:desc=>"Show images currently being created.",
332
- :type=>:numeric,
333
- :required=>false}}},
334
- :update=>
335
- {:type=>:call,
336
- :desc=>"Update an Image record.",
337
- :throws=>["NOTFOUND", "VALIDATION"],
338
- :params=>
339
- {:imageid=>
340
- {:desc=>"The ID of the Image to modify.",
341
- :type=>:numeric,
342
- :required=>true},
343
- :description=>
344
- {:desc=>"An optional description of the Image.",
345
- :type=>:string,
346
- :required=>false},
347
- :label=>
348
- {:desc=>"The label of the Image.",
349
- :type=>:string,
350
- :required=>false}}}}},
351
- :linode=>
352
- {:type=>:group,
353
- :subs=>
354
- {:boot=>
355
- {:type=>:call,
356
- :desc=>
357
- "Issues a boot job for the provided ConfigID. If no ConfigID is provided boots the last used configuration profile, or the first configuration profile if this Linode has never been booted.",
358
- :throws=>["NOTFOUND"],
359
- :params=>
360
- {:configid=>
361
- {:desc=>
362
- "The ConfigID to boot, available from linode.config.list().",
363
- :type=>:numeric,
364
- :required=>false},
365
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
366
- :clone=>
367
- {:type=>:call,
368
- :desc=>
369
- "Creates a new Linode, assigns you full privileges, and then clones the specified LinodeID to the new Linode. There is a limit of 5 active clone operations per source Linode. It is recommended that the source Linode be powered down during the clone.",
370
- :throws=>
371
- ["NOACCESS",
372
- "NOTFOUND",
373
- "CCFAILED",
374
- "VALIDATION",
375
- "LINODELIMITER",
376
- "ACCOUNTLIMIT"],
377
- :params=>
378
- {:datacenterid=>
379
- {:desc=>
380
- "The DatacenterID from avail.datacenters() where you wish to place this new Linode",
381
- :type=>:numeric,
382
- :required=>true},
383
- :linodeid=>
384
- {:desc=>"The LinodeID that you want cloned",
385
- :type=>:numeric,
386
- :required=>true},
387
- :paymentterm=>
388
- {:desc=>
389
- "Subscription term in months for prepaid customers. One of: 1, 12, or 24",
390
- :type=>:numeric,
391
- :required=>false},
392
- :planid=>
393
- {:desc=>"The desired PlanID available from avail.LinodePlans()",
394
- :type=>:numeric,
395
- :required=>true}}},
396
- :config=>
397
- {:type=>:group,
398
- :subs=>
399
- {:create=>
400
- {:type=>:call,
401
- :desc=>"Creates a Linode Configuration Profile.",
402
- :throws=>["NOTFOUND", "VALIDATION"],
403
- :params=>
404
- {:comments=>
405
- {:desc=>"Comments you wish to save along with this profile",
406
- :type=>:string,
407
- :required=>false},
408
- :disklist=>
409
- {:desc=>
410
- "A comma delimited list of DiskIDs; position reflects device node. The 9th element for specifying the initrd.",
411
- :type=>:string,
412
- :required=>true},
413
- :kernelid=>
414
- {:desc=>
415
- "The KernelID for this profile. Found in avail.kernels()",
416
- :type=>:numeric,
417
- :required=>true},
418
- :label=>
419
- {:desc=>"The Label for this profile",
420
- :type=>:string,
421
- :required=>true},
422
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
423
- :ramlimit=>
424
- {:desc=>"RAMLimit in MB. 0 for max.",
425
- :type=>:numeric,
426
- :required=>false},
427
- :rootdevicecustom=>
428
- {:desc=>"A custom root device setting.",
429
- :type=>:string,
430
- :required=>false},
431
- :rootdevicenum=>
432
- {:desc=>
433
- "Which device number (1-8) that contains the root partition. 0 to utilize RootDeviceCustom.",
434
- :type=>:numeric,
435
- :required=>false},
436
- :rootdevicero=>
437
- {:desc=>
438
- "Enables the 'ro' kernel flag. Modern distros want this. ",
439
- :type=>:boolean,
440
- :required=>false},
441
- :runlevel=>
442
- {:desc=>"One of 'default', 'single', 'binbash' ",
443
- :type=>:string,
444
- :required=>false},
445
- :devtmpfs_automount=>
446
- {:desc=>
447
- "Controls if pv_ops kernels should automount devtmpfs at boot. ",
448
- :type=>:boolean,
449
- :required=>false},
450
- :helper_depmod=>
451
- {:desc=>
452
- "Creates an empty modprobe file for the kernel you're booting. ",
453
- :type=>:boolean,
454
- :required=>false},
455
- :helper_disableupdatedb=>
456
- {:desc=>"Enable the disableUpdateDB filesystem helper",
457
- :type=>:boolean,
458
- :required=>false},
459
- :helper_network=>
460
- {:desc=>
461
- "Automatically creates network configuration files for your distro and places them into your filesystem.",
462
- :type=>:boolean,
463
- :required=>false},
464
- :helper_xen=>
465
- {:desc=>
466
- "Enable the Xen filesystem helper. Corrects fstab and inittab/upstart entries depending on the kernel you're booting. You want this.",
467
- :type=>:boolean,
468
- :required=>false}}},
469
- :delete=>
470
- {:type=>:call,
471
- :desc=>"Deletes a Linode Configuration Profile.",
472
- :throws=>["NOTFOUND", "VALIDATION"],
473
- :params=>
474
- {:configid=>{:desc=>"", :type=>:numeric, :required=>true},
475
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
476
- :list=>
477
- {:type=>:call,
478
- :desc=>"Lists a Linode's Configuration Profiles.",
479
- :throws=>["NOTFOUND"],
480
- :params=>
481
- {:configid=>{:desc=>"", :type=>:numeric, :required=>false},
482
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
483
- :update=>
484
- {:type=>:call,
485
- :desc=>"Updates a Linode Configuration Profile.",
486
- :throws=>["NOTFOUND", "VALIDATION"],
487
- :params=>
488
- {:comments=>
489
- {:desc=>"Comments you wish to save along with this profile",
490
- :type=>:string,
491
- :required=>false},
492
- :configid=>{:desc=>"", :type=>:numeric, :required=>true},
493
- :disklist=>
494
- {:desc=>
495
- "A comma delimited list of DiskIDs; position reflects device node. The 9th element for specifying the initrd.",
496
- :type=>:string,
497
- :required=>false},
498
- :kernelid=>
499
- {:desc=>
500
- "The KernelID for this profile. Found in avail.kernels()",
501
- :type=>:numeric,
502
- :required=>false},
503
- :label=>
504
- {:desc=>"The Label for this profile",
505
- :type=>:string,
506
- :required=>false},
507
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>false},
508
- :ramlimit=>
509
- {:desc=>"RAMLimit in MB. 0 for max.",
510
- :type=>:numeric,
511
- :required=>false},
512
- :rootdevicecustom=>
513
- {:desc=>"A custom root device setting.",
514
- :type=>:string,
515
- :required=>false},
516
- :rootdevicenum=>
517
- {:desc=>
518
- "Which device number (1-8) that contains the root partition. 0 to utilize RootDeviceCustom.",
519
- :type=>:numeric,
520
- :required=>false},
521
- :rootdevicero=>
522
- {:desc=>
523
- "Enables the 'ro' kernel flag. Modern distros want this. ",
524
- :type=>:boolean,
525
- :required=>false},
526
- :runlevel=>
527
- {:desc=>"One of 'default', 'single', 'binbash' ",
528
- :type=>:string,
529
- :required=>false},
530
- :devtmpfs_automount=>
531
- {:desc=>
532
- "Controls if pv_ops kernels should automount devtmpfs at boot. ",
533
- :type=>:boolean,
534
- :required=>false},
535
- :helper_depmod=>
536
- {:desc=>
537
- "Creates an empty modprobe file for the kernel you're booting. ",
538
- :type=>:boolean,
539
- :required=>false},
540
- :helper_disableupdatedb=>
541
- {:desc=>"Enable the disableUpdateDB filesystem helper",
542
- :type=>:boolean,
543
- :required=>false},
544
- :helper_network=>
545
- {:desc=>
546
- "Automatically creates network configuration files for your distro and places them into your filesystem.",
547
- :type=>:boolean,
548
- :required=>false},
549
- :helper_xen=>
550
- {:desc=>
551
- "Enable the Xen filesystem helper. Corrects fstab and inittab/upstart entries depending on the kernel you're booting. You want this.",
552
- :type=>:boolean,
553
- :required=>false}}}}},
554
- :create=>
555
- {:type=>:call,
556
- :desc=>
557
- "Creates a Linode and assigns you full privileges. There is a 75-linodes-per-hour limiter.",
558
- :throws=>
559
- ["NOACCESS",
560
- "CCFAILED",
561
- "VALIDATION",
562
- "LINODELIMITER",
563
- "ACCOUNTLIMIT"],
564
- :params=>
565
- {:datacenterid=>
566
- {:desc=>
567
- "The DatacenterID from avail.datacenters() where you wish to place this new Linode",
568
- :type=>:numeric,
569
- :required=>true},
570
- :paymentterm=>
571
- {:desc=>
572
- "Subscription term in months for prepaid customers. One of: 1, 12, or 24",
573
- :type=>:numeric,
574
- :required=>false},
575
- :planid=>
576
- {:desc=>"The desired PlanID available from avail.LinodePlans()",
577
- :type=>:numeric,
578
- :required=>true}}},
579
- :delete=>
580
- {:type=>:call,
581
- :desc=>
582
- "Immediately removes a Linode from your account and issues a pro-rated credit back to your account, if applicable. To prevent accidental deletes, this requires the Linode has no Disk images. You must first delete its disk images.\"",
583
- :throws=>["NOTFOUND", "LINODENOTEMPTY"],
584
- :params=>
585
- {:linodeid=>
586
- {:desc=>"The LinodeID to delete",
587
- :type=>:numeric,
588
- :required=>true},
589
- :skipchecks=>
590
- {:desc=>
591
- "Skips the safety checks and will always delete the Linode",
592
- :type=>:boolean,
593
- :required=>false}}},
594
- :disk=>
595
- {:type=>:group,
596
- :subs=>
597
- {:create=>
598
- {:type=>:call,
599
- :desc=>"",
600
- :throws=>["NOTFOUND", "VALIDATION"],
601
- :params=>
602
- {:fromdistributionid=>
603
- {:desc=>"", :type=>:numeric, :required=>false},
604
- :label=>
605
- {:desc=>"The display label for this Disk",
606
- :type=>:string,
607
- :required=>true},
608
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
609
- :size=>
610
- {:desc=>"The size in MB of this Disk.",
611
- :type=>:numeric,
612
- :required=>true},
613
- :type=>
614
- {:desc=>
615
- "The formatted type of this disk. Valid types are: ext3, ext4, swap, raw",
616
- :type=>:string,
617
- :required=>true},
618
- :isreadonly=>
619
- {:desc=>"Enable forced read-only for this Disk",
620
- :type=>:boolean,
621
- :required=>false},
622
- :rootpass=>{:desc=>"", :type=>:string, :required=>false},
623
- :rootsshkey=>{:desc=>"", :type=>:string, :required=>false}}},
624
- :createfromdistribution=>
625
- {:type=>:call,
626
- :desc=>"",
627
- :throws=>["NOTFOUND", "VALIDATION"],
628
- :params=>
629
- {:distributionid=>
630
- {:desc=>
631
- "The DistributionID to create this disk from. Found in avail.distributions()",
632
- :type=>:numeric,
633
- :required=>true},
634
- :label=>
635
- {:desc=>"The label of this new disk image",
636
- :type=>:string,
637
- :required=>true},
638
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
639
- :size=>
640
- {:desc=>"Size of this disk image in MB",
641
- :type=>:numeric,
642
- :required=>true},
643
- :rootpass=>
644
- {:desc=>"The root user's password",
645
- :type=>:string,
646
- :required=>true},
647
- :rootsshkey=>
648
- {:desc=>
649
- "Optionally sets this string into /root/.ssh/authorized_keys upon distribution configuration.",
650
- :type=>:string,
651
- :required=>false}}},
652
- :createfromimage=>
653
- {:type=>:call,
654
- :desc=>"Creates a new disk from a previously imagized disk.",
655
- :throws=>[],
656
- :params=>
657
- {:imageid=>
658
- {:desc=>"The ID of the frozen image to deploy from",
659
- :type=>:numeric,
660
- :required=>true},
661
- :label=>
662
- {:desc=>"The label of this new disk image",
663
- :type=>:string,
664
- :required=>false},
665
- :linodeid=>
666
- {:desc=>"Specifies the Linode to deploy on to",
667
- :type=>:numeric,
668
- :required=>true},
669
- :rootpass=>
670
- {:desc=>
671
- "Optionally sets the root password at deployment time. If a password is not provided the existing root password of the frozen image will not be modified",
672
- :type=>:string,
673
- :required=>false},
674
- :rootsshkey=>
675
- {:desc=>
676
- "Optionally sets this string into /root/.ssh/authorized_keys upon image deployment",
677
- :type=>:string,
678
- :required=>false},
679
- :size=>
680
- {:desc=>
681
- "The size of the disk image to creates. Defaults to the minimum size required for the requested image",
682
- :type=>:numeric,
683
- :required=>false}}},
684
- :createfromstackscript=>
685
- {:type=>:call,
686
- :desc=>"",
687
- :throws=>["NOTFOUND", "VALIDATION"],
688
- :params=>
689
- {:distributionid=>
690
- {:desc=>
691
- "Which Distribution to apply this StackScript to. Must be one from the script's DistributionIDList",
692
- :type=>:numeric,
693
- :required=>true},
694
- :label=>
695
- {:desc=>"The label of this new disk image",
696
- :type=>:string,
697
- :required=>true},
698
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
699
- :size=>
700
- {:desc=>"Size of this disk image in MB",
701
- :type=>:numeric,
702
- :required=>true},
703
- :stackscriptid=>
704
- {:desc=>"The StackScript to create this image from",
705
- :type=>:numeric,
706
- :required=>true},
707
- :stackscriptudfresponses=>
708
- {:desc=>
709
- "JSON encoded name/value pairs, answering this StackScript's User Defined Fields",
710
- :type=>:string,
711
- :required=>true},
712
- :rootpass=>
713
- {:desc=>"The root user's password",
714
- :type=>:string,
715
- :required=>true},
716
- :rootsshkey=>
717
- {:desc=>
718
- "Optionally sets this string into /root/.ssh/authorized_keys upon distribution configuration.",
719
- :type=>:string,
720
- :required=>false}}},
721
- :delete=>
722
- {:type=>:call,
723
- :desc=>"",
724
- :throws=>["NOTFOUND", "VALIDATION"],
725
- :params=>
726
- {:diskid=>{:desc=>"", :type=>:numeric, :required=>true},
727
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
728
- :duplicate=>
729
- {:type=>:call,
730
- :desc=>"Performs a bit-for-bit copy of a disk image.",
731
- :throws=>["NOTFOUND", "VALIDATION"],
732
- :params=>
733
- {:diskid=>{:desc=>"", :type=>:numeric, :required=>true},
734
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
735
- :imagize=>
736
- {:type=>:call,
737
- :desc=>"Creates a gold-master image for future deployments",
738
- :throws=>[],
739
- :params=>
740
- {:description=>
741
- {:desc=>"An optional description of the created image",
742
- :type=>:string,
743
- :required=>false},
744
- :diskid=>
745
- {:desc=>"Specifies the source Disk to create the image from",
746
- :type=>:numeric,
747
- :required=>true},
748
- :label=>
749
- {:desc=>
750
- "Sets the name of the image shown in the base image list, defaults to the source image label",
751
- :type=>:string,
752
- :required=>false},
753
- :linodeid=>
754
- {:desc=>"Specifies the source Linode to create the image from",
755
- :type=>:numeric,
756
- :required=>true}}},
757
- :list=>
758
- {:type=>:call,
759
- :desc=>"Status values are 1: Ready and 2: Being Deleted.",
760
- :throws=>[],
761
- :params=>
762
- {:diskid=>{:desc=>"", :type=>:numeric, :required=>false},
763
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
764
- :resize=>
765
- {:type=>:call,
766
- :desc=>"",
767
- :throws=>["NOTFOUND", "VALIDATION"],
768
- :params=>
769
- {:diskid=>{:desc=>"", :type=>:numeric, :required=>true},
770
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
771
- :size=>
772
- {:desc=>"The requested new size of this Disk in MB",
773
- :type=>:numeric,
774
- :required=>true}}},
775
- :update=>
776
- {:type=>:call,
777
- :desc=>"",
778
- :throws=>["NOTFOUND", "VALIDATION"],
779
- :params=>
780
- {:diskid=>{:desc=>"", :type=>:numeric, :required=>true},
781
- :label=>
782
- {:desc=>"The display label for this Disk",
783
- :type=>:string,
784
- :required=>false},
785
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>false},
786
- :isreadonly=>
787
- {:desc=>"Enable forced read-only for this Disk",
788
- :type=>:boolean,
789
- :required=>false}}}}},
790
- :ip=>
791
- {:type=>:group,
792
- :subs=>
793
- {:addprivate=>
794
- {:type=>:call,
795
- :desc=>
796
- "Assigns a Private IP to a Linode. Returns the IPAddressID that was added.",
797
- :throws=>["NOTFOUND"],
798
- :params=>
799
- {:linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
800
- :addpublic=>
801
- {:type=>:call,
802
- :desc=>
803
- "Assigns a Public IP to a Linode. Returns the IPAddressID and IPAddress that was added.",
804
- :throws=>["NOTFOUND", "VALIDATION"],
805
- :params=>
806
- {:linodeid=>
807
- {:desc=>
808
- "The LinodeID of the Linode that will be assigned an additional public IP address",
809
- :type=>:numeric,
810
- :required=>true}}},
811
- :list=>
812
- {:type=>:call,
813
- :desc=>
814
- "Returns the IP addresses of all Linodes you have access to.",
815
- :throws=>["NOTFOUND"],
816
- :params=>
817
- {:ipaddressid=>
818
- {:desc=>"If specified, limits the result to this IPAddressID",
819
- :type=>:numeric,
820
- :required=>false},
821
- :linodeid=>
822
- {:desc=>"If specified, limits the result to this LinodeID",
823
- :type=>:numeric,
824
- :required=>false}}},
825
- :setrdns=>
826
- {:type=>:call,
827
- :desc=>
828
- "Sets the rDNS name of a Public IP. Returns the IPAddressID and IPAddress that were updated.",
829
- :throws=>["NOTFOUND", "VALIDATION"],
830
- :params=>
831
- {:hostname=>
832
- {:desc=>"The hostname to set the reverse DNS to",
833
- :type=>:string,
834
- :required=>true},
835
- :ipaddressid=>
836
- {:desc=>"The IPAddressID of the address to update",
837
- :type=>:numeric,
838
- :required=>true}}},
839
- :swap=>
840
- {:type=>:call,
841
- :desc=>
842
- "Exchanges Public IP addresses between two Linodes within a Datacenter. The destination of the IP Address can be designated by either the toLinodeID or withIPAddressID parameter. Returns the resulting relationship of the Linode and IP Address parameters. When performing a one directional swap, the source is represented by the first of the two resultant array members.",
843
- :throws=>["NOTFOUND", "VALIDATION"],
844
- :params=>
845
- {:ipaddressid=>
846
- {:desc=>"The IPAddressID of an IP Address to transfer or swap",
847
- :type=>:numeric,
848
- :required=>true},
849
- :tolinodeid=>
850
- {:desc=>
851
- "The LinodeID of the Linode where IPAddressID will be transfered",
852
- :type=>:numeric,
853
- :required=>false},
854
- :withipaddressid=>
855
- {:desc=>"The IP Address ID to swap",
856
- :type=>:numeric,
857
- :required=>false}}}}},
858
- :job=>
859
- {:type=>:group,
860
- :subs=>
861
- {:list=>
862
- {:type=>:call,
863
- :desc=>"",
864
- :throws=>[],
865
- :params=>
866
- {:jobid=>
867
- {:desc=>"Limits the list to the specified JobID",
868
- :type=>:numeric,
869
- :required=>false},
870
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
871
- :pendingonly=>
872
- {:desc=>"", :type=>:boolean, :required=>false}}}}},
873
- :list=>
874
- {:type=>:call,
875
- :desc=>
876
- "Returns a list of all Linodes user has access or delete to, including some properties. Status values are -1: Being Created, 0: Brand New, 1: Running, and 2: Powered Off.",
877
- :throws=>[],
878
- :params=>
879
- {:linodeid=>
880
- {:desc=>"Limits the list to the specified LinodeID",
881
- :type=>:numeric,
882
- :required=>false}}},
883
- :mutate=>
884
- {:type=>:call,
885
- :desc=>"Upgrades a Linode to its next generation.",
886
- :throws=>["NOTFOUND", "VALIDATION"],
887
- :params=>{:linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
888
- :reboot=>
889
- {:type=>:call,
890
- :desc=>"Issues a shutdown, and then boot job for a given LinodeID.",
891
- :throws=>["NOTFOUND"],
892
- :params=>
893
- {:configid=>{:desc=>"", :type=>:numeric, :required=>false},
894
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
895
- :resize=>
896
- {:type=>:call,
897
- :desc=>
898
- "Resizes a Linode from one plan to another. Immediately shuts the Linode down, charges/credits the account, and issue a migration to another host server.",
899
- :throws=>["NOTFOUND", "CCFAILED", "VALIDATION"],
900
- :params=>
901
- {:linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
902
- :planid=>
903
- {:desc=>"The desired PlanID available from avail.LinodePlans()",
904
- :type=>:numeric,
905
- :required=>true}}},
906
- :shutdown=>
907
- {:type=>:call,
908
- :desc=>"Issues a shutdown job for a given LinodeID.",
909
- :throws=>["NOTFOUND"],
910
- :params=>{:linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}},
911
- :update=>
912
- {:type=>:call,
913
- :desc=>"Updates a Linode's properties.",
914
- :throws=>["NOTFOUND", "VALIDATION"],
915
- :params=>
916
- {:alert_bwin_enabled=>
917
- {:desc=>"Enable the incoming bandwidth email alert",
918
- :type=>:boolean,
919
- :required=>false},
920
- :alert_bwin_threshold=>
921
- {:desc=>"Mb/sec", :type=>:numeric, :required=>false},
922
- :alert_bwout_enabled=>
923
- {:desc=>"Enable the outgoing bandwidth email alert",
924
- :type=>:boolean,
925
- :required=>false},
926
- :alert_bwout_threshold=>
927
- {:desc=>"Mb/sec", :type=>:numeric, :required=>false},
928
- :alert_bwquota_enabled=>
929
- {:desc=>"Enable the bw quote email alert",
930
- :type=>:boolean,
931
- :required=>false},
932
- :alert_bwquota_threshold=>
933
- {:desc=>"Percentage of monthly bw quota",
934
- :type=>:numeric,
935
- :required=>false},
936
- :alert_cpu_enabled=>
937
- {:desc=>"Enable the cpu usage email alert",
938
- :type=>:boolean,
939
- :required=>false},
940
- :alert_cpu_threshold=>
941
- {:desc=>"CPU Alert threshold, percentage 0-800",
942
- :type=>:numeric,
943
- :required=>false},
944
- :alert_diskio_enabled=>
945
- {:desc=>"Enable the disk IO email alert",
946
- :type=>:boolean,
947
- :required=>false},
948
- :alert_diskio_threshold=>
949
- {:desc=>"IO ops/sec", :type=>:numeric, :required=>false},
950
- :label=>
951
- {:desc=>"This Linode's label", :type=>:string, :required=>false},
952
- :linodeid=>{:desc=>"", :type=>:numeric, :required=>true},
953
- :backupweeklyday=>{:desc=>"", :type=>:numeric, :required=>false},
954
- :backupwindow=>{:desc=>"", :type=>:numeric, :required=>false},
955
- :lpm_displaygroup=>
956
- {:desc=>
957
- "Display group in the Linode list inside the Linode Manager",
958
- :type=>:string,
959
- :required=>false},
960
- :ms_ssh_disabled=>{:desc=>"", :type=>:boolean, :required=>false},
961
- :ms_ssh_ip=>{:desc=>"", :type=>:string, :required=>false},
962
- :ms_ssh_port=>{:desc=>"", :type=>:numeric, :required=>false},
963
- :ms_ssh_user=>{:desc=>"", :type=>:string, :required=>false},
964
- :watchdog=>
965
- {:desc=>"Enable the Lassie shutdown watchdog",
966
- :type=>:boolean,
967
- :required=>false}}},
968
- :webconsoletoken=>
969
- {:type=>:call,
970
- :desc=>
971
- "Generates a console token starting a web console LISH session for the requesting IP",
972
- :throws=>["NOTFOUND", "VALIDATION"],
973
- :params=>
974
- {:linodeid=>{:desc=>"", :type=>:numeric, :required=>true}}}}},
975
- :nodebalancer=>
976
- {:type=>:group,
977
- :subs=>
978
- {:config=>
979
- {:type=>:group,
980
- :subs=>
981
- {:create=>
982
- {:type=>:call,
983
- :desc=>"",
984
- :throws=>["NOTFOUND", "VALIDATION"],
985
- :params=>
986
- {:algorithm=>
987
- {:desc=>
988
- "Balancing algorithm. One of 'roundrobin', 'leastconn', 'source'",
989
- :type=>:string,
990
- :required=>false},
991
- :nodebalancerid=>
992
- {:desc=>"The parent NodeBalancer's ID",
993
- :type=>:numeric,
994
- :required=>true},
995
- :port=>
996
- {:desc=>"Port to bind to on the public interfaces. 1-65534",
997
- :type=>:numeric,
998
- :required=>false},
999
- :protocol=>
1000
- {:desc=>"Either 'tcp', 'http', or 'https'",
1001
- :type=>:string,
1002
- :required=>false},
1003
- :stickiness=>
1004
- {:desc=>
1005
- "Session persistence. One of 'none', 'table', 'http_cookie'",
1006
- :type=>:string,
1007
- :required=>false},
1008
- :check=>
1009
- {:desc=>
1010
- "Perform active health checks on the backend nodes. One of 'connection', 'http', 'http_body'",
1011
- :type=>:string,
1012
- :required=>false},
1013
- :check_attempts=>
1014
- {:desc=>
1015
- "Number of failed probes before taking a node out of rotation. 1-30",
1016
- :type=>:string,
1017
- :required=>false},
1018
- :check_body=>
1019
- {:desc=>
1020
- "When check=http_body, a regex against the expected result body",
1021
- :type=>:string,
1022
- :required=>false},
1023
- :check_interval=>
1024
- {:desc=>"Seconds between health check probes. 2-3600",
1025
- :type=>:numeric,
1026
- :required=>false},
1027
- :check_path=>
1028
- {:desc=>"When check=http, the path to request",
1029
- :type=>:string,
1030
- :required=>false},
1031
- :check_timeout=>
1032
- {:desc=>
1033
- "Seconds to wait before considering the probe a failure. 1-30. Must be less than check_interval.",
1034
- :type=>:string,
1035
- :required=>false},
1036
- :ssl_cert=>
1037
- {:desc=>
1038
- "SSL certificate served by the NodeBalancer when the protocol is 'https'",
1039
- :type=>:string,
1040
- :required=>false},
1041
- :ssl_key=>
1042
- {:desc=>
1043
- "Unpassphrased private key for the SSL certificate when protocol is 'https'",
1044
- :type=>:string,
1045
- :required=>false}}},
1046
- :delete=>
1047
- {:type=>:call,
1048
- :desc=>"Deletes a NodeBalancer's Config",
1049
- :throws=>["NOTFOUND"],
1050
- :params=>
1051
- {:configid=>
1052
- {:desc=>"The ConfigID to delete",
1053
- :type=>:numeric,
1054
- :required=>true},
1055
- :nodebalancerid=>
1056
- {:desc=>"", :type=>:numeric, :required=>true}}},
1057
- :list=>
1058
- {:type=>:call,
1059
- :desc=>
1060
- "Returns a list of NodeBalancers this user has access or delete to, including their properties",
1061
- :throws=>[],
1062
- :params=>
1063
- {:configid=>
1064
- {:desc=>"Limits the list to the specified ConfigID",
1065
- :type=>:numeric,
1066
- :required=>false},
1067
- :nodebalancerid=>
1068
- {:desc=>"", :type=>:numeric, :required=>true}}},
1069
- :update=>
1070
- {:type=>:call,
1071
- :desc=>"Updates a Config's properties",
1072
- :throws=>["NOTFOUND", "VALIDATION"],
1073
- :params=>
1074
- {:algorithm=>
1075
- {:desc=>
1076
- "Balancing algorithm. One of 'roundrobin', 'leastconn', 'source'",
1077
- :type=>:string,
1078
- :required=>false},
1079
- :configid=>{:desc=>"", :type=>:numeric, :required=>true},
1080
- :port=>
1081
- {:desc=>"Port to bind to on the public interfaces. 1-65534",
1082
- :type=>:numeric,
1083
- :required=>false},
1084
- :protocol=>
1085
- {:desc=>"Either 'tcp', 'http', or 'https'",
1086
- :type=>:string,
1087
- :required=>false},
1088
- :stickiness=>
1089
- {:desc=>
1090
- "Session persistence. One of 'none', 'table', 'http_cookie'",
1091
- :type=>:string,
1092
- :required=>false},
1093
- :check=>
1094
- {:desc=>
1095
- "Perform active health checks on the backend nodes. One of 'connection', 'http', 'http_body'",
1096
- :type=>:string,
1097
- :required=>false},
1098
- :check_attempts=>
1099
- {:desc=>
1100
- "Number of failed probes before taking a node out of rotation. 1-30",
1101
- :type=>:string,
1102
- :required=>false},
1103
- :check_body=>
1104
- {:desc=>
1105
- "When check=http_body, a regex against the expected result body",
1106
- :type=>:string,
1107
- :required=>false},
1108
- :check_interval=>
1109
- {:desc=>"Seconds between health check probes. 2-3600",
1110
- :type=>:numeric,
1111
- :required=>false},
1112
- :check_path=>
1113
- {:desc=>"When check=http, the path to request",
1114
- :type=>:string,
1115
- :required=>false},
1116
- :check_timeout=>
1117
- {:desc=>
1118
- "Seconds to wait before considering the probe a failure. 1-30. Must be less than check_interval.",
1119
- :type=>:string,
1120
- :required=>false},
1121
- :ssl_cert=>
1122
- {:desc=>
1123
- "SSL certificate served by the NodeBalancer when the protocol is 'https'",
1124
- :type=>:string,
1125
- :required=>false},
1126
- :ssl_key=>
1127
- {:desc=>
1128
- "Unpassphrased private key for the SSL certificate when protocol is 'https'",
1129
- :type=>:string,
1130
- :required=>false}}}}},
1131
- :create=>
1132
- {:type=>:call,
1133
- :desc=>"",
1134
- :throws=>["NOACCESS", "CCFAILED", "VALIDATION"],
1135
- :params=>
1136
- {:clientconnthrottle=>
1137
- {:desc=>
1138
- "To help mitigate abuse, throttle connections per second, per client IP. 0 to disable. Max of 20.",
1139
- :type=>:numeric,
1140
- :required=>false},
1141
- :datacenterid=>
1142
- {:desc=>
1143
- "The DatacenterID from avail.datacenters() where you wish to place this new NodeBalancer",
1144
- :type=>:numeric,
1145
- :required=>true},
1146
- :label=>
1147
- {:desc=>"This NodeBalancer's label",
1148
- :type=>:string,
1149
- :required=>false}}},
1150
- :delete=>
1151
- {:type=>:call,
1152
- :desc=>
1153
- "Immediately removes a NodeBalancer from your account and issues a pro-rated credit back to your account, if applicable.",
1154
- :throws=>["NOTFOUND"],
1155
- :params=>
1156
- {:nodebalancerid=>
1157
- {:desc=>"The NodeBalancerID to delete",
1158
- :type=>:numeric,
1159
- :required=>true}}},
1160
- :list=>
1161
- {:type=>:call,
1162
- :desc=>
1163
- "Returns a list of NodeBalancers this user has access or delete to, including their properties",
1164
- :throws=>[],
1165
- :params=>
1166
- {:nodebalancerid=>
1167
- {:desc=>"Limits the list to the specified NodeBalancerID",
1168
- :type=>:numeric,
1169
- :required=>false}}},
1170
- :node=>
1171
- {:type=>:group,
1172
- :subs=>
1173
- {:create=>
1174
- {:type=>:call,
1175
- :desc=>"",
1176
- :throws=>["NOTFOUND", "VALIDATION"],
1177
- :params=>
1178
- {:address=>
1179
- {:desc=>
1180
- "The address:port combination used to communicate with this Node",
1181
- :type=>:string,
1182
- :required=>true},
1183
- :configid=>
1184
- {:desc=>"The parent ConfigID to attach this Node to",
1185
- :type=>:numeric,
1186
- :required=>true},
1187
- :label=>
1188
- {:desc=>"This backend Node's label",
1189
- :type=>:string,
1190
- :required=>true},
1191
- :mode=>
1192
- {:desc=>
1193
- "The connections mode for this node. One of 'accept', 'reject', or 'drain'",
1194
- :type=>:string,
1195
- :required=>false},
1196
- :weight=>
1197
- {:desc=>
1198
- "Load balancing weight, 1-255. Higher means more connections.",
1199
- :type=>:numeric,
1200
- :required=>false}}},
1201
- :delete=>
1202
- {:type=>:call,
1203
- :desc=>"Deletes a Node from a NodeBalancer Config",
1204
- :throws=>["NOTFOUND"],
1205
- :params=>
1206
- {:nodeid=>
1207
- {:desc=>"The NodeID to delete",
1208
- :type=>:numeric,
1209
- :required=>true}}},
1210
- :list=>
1211
- {:type=>:call,
1212
- :desc=>
1213
- "Returns a list of Nodes associated with a NodeBalancer Config",
1214
- :throws=>[],
1215
- :params=>
1216
- {:configid=>{:desc=>"", :type=>:numeric, :required=>true},
1217
- :nodeid=>
1218
- {:desc=>"Limits the list to the specified NodeID",
1219
- :type=>:numeric,
1220
- :required=>false}}},
1221
- :update=>
1222
- {:type=>:call,
1223
- :desc=>"Updates a Node's properties",
1224
- :throws=>["NOTFOUND", "VALIDATION"],
1225
- :params=>
1226
- {:address=>
1227
- {:desc=>
1228
- "The address:port combination used to communicate with this Node",
1229
- :type=>:string,
1230
- :required=>false},
1231
- :label=>
1232
- {:desc=>"This backend Node's label",
1233
- :type=>:string,
1234
- :required=>false},
1235
- :mode=>
1236
- {:desc=>
1237
- "The connections mode for this node. One of 'accept', 'reject', or 'drain'",
1238
- :type=>:string,
1239
- :required=>false},
1240
- :nodeid=>{:desc=>"", :type=>:numeric, :required=>true},
1241
- :weight=>
1242
- {:desc=>
1243
- "Load balancing weight, 1-255. Higher means more connections.",
1244
- :type=>:numeric,
1245
- :required=>false}}}}},
1246
- :update=>
1247
- {:type=>:call,
1248
- :desc=>"Updates a NodeBalancer's properties",
1249
- :throws=>["NOTFOUND", "VALIDATION"],
1250
- :params=>
1251
- {:clientconnthrottle=>
1252
- {:desc=>
1253
- "To help mitigate abuse, throttle connections per second, per client IP. 0 to disable. Max of 20.",
1254
- :type=>:numeric,
1255
- :required=>false},
1256
- :label=>
1257
- {:desc=>"This NodeBalancer's label",
1258
- :type=>:string,
1259
- :required=>false},
1260
- :nodebalancerid=>{:desc=>"", :type=>:numeric, :required=>true}}}}},
1261
- :stackscript=>
1262
- {:type=>:group,
1263
- :subs=>
1264
- {:create=>
1265
- {:type=>:call,
1266
- :desc=>"Create a StackScript.",
1267
- :throws=>["NOACCESS", "VALIDATION"],
1268
- :params=>
1269
- {:description=>{:desc=>"", :type=>:string, :required=>false},
1270
- :distributionidlist=>
1271
- {:desc=>
1272
- "Comma delimited list of DistributionIDs that this script works on ",
1273
- :type=>:string,
1274
- :required=>true},
1275
- :label=>
1276
- {:desc=>"The Label for this StackScript",
1277
- :type=>:string,
1278
- :required=>true},
1279
- :ispublic=>
1280
- {:desc=>
1281
- "Whether this StackScript is published in the Library, for everyone to use",
1282
- :type=>:boolean,
1283
- :required=>false},
1284
- :rev_note=>{:desc=>"", :type=>:string, :required=>false},
1285
- :script=>
1286
- {:desc=>"The actual script", :type=>:string, :required=>true}}},
1287
- :delete=>
1288
- {:type=>:call,
1289
- :desc=>"",
1290
- :throws=>["NOTFOUND"],
1291
- :params=>
1292
- {:stackscriptid=>{:desc=>"", :type=>:numeric, :required=>true}}},
1293
- :list=>
1294
- {:type=>:call,
1295
- :desc=>"Lists StackScripts you have access to.",
1296
- :throws=>[],
1297
- :params=>
1298
- {:stackscriptid=>
1299
- {:desc=>"Limits the list to the specified StackScriptID",
1300
- :type=>:numeric,
1301
- :required=>false}}},
1302
- :update=>
1303
- {:type=>:call,
1304
- :desc=>"Update a StackScript.",
1305
- :throws=>["NOTFOUND", "VALIDATION"],
1306
- :params=>
1307
- {:description=>{:desc=>"", :type=>:string, :required=>false},
1308
- :distributionidlist=>
1309
- {:desc=>
1310
- "Comma delimited list of DistributionIDs that this script works on ",
1311
- :type=>:string,
1312
- :required=>false},
1313
- :label=>
1314
- {:desc=>"The Label for this StackScript",
1315
- :type=>:string,
1316
- :required=>false},
1317
- :stackscriptid=>{:desc=>"", :type=>:numeric, :required=>true},
1318
- :ispublic=>
1319
- {:desc=>
1320
- "Whether this StackScript is published in the Library, for everyone to use",
1321
- :type=>:boolean,
1322
- :required=>false},
1323
- :rev_note=>{:desc=>"", :type=>:string, :required=>false},
1324
- :script=>
1325
- {:desc=>"The actual script", :type=>:string, :required=>false}}}}},
1326
- :test=>
1327
- {:type=>:group,
1328
- :subs=>
1329
- {:echo=>
1330
- {:type=>:call,
1331
- :desc=>"Echos back parameters that were passed in.",
1332
- :throws=>[],
1333
- :params=>{}}}},
1334
- :user=>
1335
- {:type=>:group,
1336
- :subs=>
1337
- {:getapikey=>
1338
- {:type=>:call,
1339
- :desc=>
1340
- "Authenticates a Linode Manager user against their username, password, and two-factor token (when enabled), and then returns a new API key, which can be used until it expires. The number of active keys is limited to 20.",
1341
- :throws=>["AUTHFAIL", " NEEDTOKEN", " PASSWORDEXPIRED", " KEYLIMIT"],
1342
- :params=>
1343
- {:expires=>
1344
- {:desc=>
1345
- "Number of hours the key will remain valid, between 0 and 8760. 0 means no expiration. Defaults to 168.",
1346
- :type=>:numeric,
1347
- :required=>false},
1348
- :label=>
1349
- {:desc=>"An optional label for this key.",
1350
- :type=>:string,
1351
- :required=>false},
1352
- :password=>{:desc=>"", :type=>:string, :required=>true},
1353
- :token=>
1354
- {:desc=>"Required when two-factor authentication is enabled.",
1355
- :type=>:string,
1356
- :required=>false},
1357
- :username=>{:desc=>"", :type=>:string, :required=>true}}}}}}}
1358
-
1359
- end