deltacloud-client 0.0.8 → 0.0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/deltacloud.rb +13 -0
  2. data/lib/documentation.rb +4 -3
  3. metadata +4 -3
data/lib/deltacloud.rb CHANGED
@@ -240,6 +240,17 @@ module DeltaCloud
240
240
  end
241
241
  declare_entry_points_methods(@entry_points)
242
242
  end
243
+
244
+ def create_key(opts={}, &block)
245
+ params = { :name => opts[:name] }
246
+ key = nil
247
+ request(:post, entry_points[:keys], {}, params) do |response|
248
+ c = DeltaCloud.define_class("Key")
249
+ key = base_object(c, :key, response)
250
+ yield key if block_given?
251
+ end
252
+ return key
253
+ end
243
254
 
244
255
  # Create a new instance, using image +image_id+. Possible optiosn are
245
256
  #
@@ -255,11 +266,13 @@ module DeltaCloud
255
266
  name = opts[:name]
256
267
  realm_id = opts[:realm]
257
268
  user_data = opts[:user_data]
269
+ key_name = opts[:key_name]
258
270
 
259
271
  params = {}
260
272
  ( params[:realm_id] = realm_id ) if realm_id
261
273
  ( params[:name] = name ) if name
262
274
  ( params[:user_data] = user_data ) if user_data
275
+ ( params[:keyname] = user_data ) if key_name
263
276
 
264
277
  if opts[:hardware_profile].is_a?(String)
265
278
  params[:hwp_id] = opts[:hardware_profile]
data/lib/documentation.rb CHANGED
@@ -12,7 +12,8 @@ end
12
12
  @dc.entry_points.keys.each do |ep|
13
13
  @dc.send(ep)
14
14
  end
15
- class_list = @dc.classes
15
+
16
+ class_list = DeltaCloud::classes.collect { |c| DeltaCloud::module_eval("::DeltaCloud::API::#{c}")}
16
17
 
17
18
  def read_method_description(c, method)
18
19
  if method =~ /es$/
@@ -57,13 +58,13 @@ class_list.each do |c|
57
58
  @dc.entry_points.keys.each do |ep|
58
59
  out << "# Return #{ep.to_s.classify} object with given id\n"
59
60
  out << "# "
60
- out << "# *#{@dc.documentation(ep.to_s).description}*"
61
+ out << "# #{@dc.documentation(ep.to_s).description.split("\n").join("\n# ")}"
61
62
  out << "# @return [#{ep.to_s.classify}]"
62
63
  out << "def #{ep.to_s.gsub(/s$/, '')}"
63
64
  out << "end"
64
65
  out << "# Return collection of #{ep.to_s.classify} objects"
65
66
  out << "# "
66
- out << "# *#{@dc.documentation(ep.to_s).description}*"
67
+ out << "# #{@dc.documentation(ep.to_s).description.split("\n").join("\n# ")}"
67
68
  @dc.documentation(ep.to_s, 'index').params.each do |p|
68
69
  out << p.to_comment
69
70
  end
metadata CHANGED
@@ -5,8 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ - 2
10
+ version: 0.0.9.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Red Hat, Inc.
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-27 00:00:00 +02:00
18
+ date: 2010-08-04 00:00:00 +02:00
18
19
  default_executable: deltacloudc
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency