fog 0.0.76 → 0.0.77
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/Rakefile +1 -0
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/ec2.rb +2 -2
- data/lib/fog/aws/models/ec2/snapshot.rb +4 -0
- data/lib/fog/aws/models/ec2/snapshots.rb +9 -2
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +7 -3
- data/lib/fog/terremark/requests/instantiate_vapp_template.rb +19 -59
- metadata +3 -3
data/Rakefile
CHANGED
@@ -92,6 +92,7 @@ task :release => :build do
|
|
92
92
|
puts "You must be on the master branch to release!"
|
93
93
|
exit!
|
94
94
|
end
|
95
|
+
sh "sudo gem install pkg/#{name}-#{version}.gem"
|
95
96
|
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
96
97
|
sh "git tag v#{version}"
|
97
98
|
sh "git push origin master"
|
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.0.
|
11
|
-
s.date = '2010-04-
|
10
|
+
s.version = '0.0.77'
|
11
|
+
s.date = '2010-04-23'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws/ec2.rb
CHANGED
@@ -194,8 +194,8 @@ module Fog
|
|
194
194
|
def request(params)
|
195
195
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
196
196
|
|
197
|
-
idempotent
|
198
|
-
parser
|
197
|
+
idempotent = params.delete(:idempotent)
|
198
|
+
parser = params.delete(:parser)
|
199
199
|
|
200
200
|
params.merge!({
|
201
201
|
'AWSAccessKeyId' => @aws_access_key_id,
|
@@ -23,6 +23,8 @@ module Fog
|
|
23
23
|
|
24
24
|
class Snapshots < Fog::Collection
|
25
25
|
|
26
|
+
attribute :owner, 'Owner'
|
27
|
+
attribute :restorable_by, 'RestorableBy'
|
26
28
|
attribute :snapshot_id
|
27
29
|
attribute :volume
|
28
30
|
|
@@ -33,8 +35,13 @@ module Fog
|
|
33
35
|
super
|
34
36
|
end
|
35
37
|
|
36
|
-
def all(snapshot_id = @snapshot_id)
|
37
|
-
|
38
|
+
def all(snapshot_id = @snapshot_id, options = {})
|
39
|
+
options = {
|
40
|
+
'Owner' => @owner || 'self',
|
41
|
+
'RestorableBy' => @restorable_by
|
42
|
+
}
|
43
|
+
options = options.reject {|key,value| value.nil? || value.to_s.empty?}
|
44
|
+
merge_attributes(options)
|
38
45
|
data = connection.describe_snapshots(snapshot_id).body
|
39
46
|
load(data['snapshotSet'])
|
40
47
|
if volume
|
@@ -7,6 +7,9 @@ module Fog
|
|
7
7
|
#
|
8
8
|
# ==== Parameters
|
9
9
|
# * snapshot_id<~Array> - List of snapshots to describe, defaults to all
|
10
|
+
# * options<~Array>:
|
11
|
+
# * 'Owner'<~String> - Owner of snapshot in ['self', 'amazon', account_id]
|
12
|
+
# * 'RestorableBy'<~String> - Account id of user who can create volumes from this snapshot
|
10
13
|
#
|
11
14
|
# ==== Returns
|
12
15
|
# * response<~Excon::Response>:
|
@@ -18,12 +21,13 @@ module Fog
|
|
18
21
|
# * 'startTime'<~Time>: Timestamp of when snapshot was initiated
|
19
22
|
# * 'status'<~String>: Snapshot state, in ['pending', 'completed']
|
20
23
|
# * 'volumeId'<~String>: Id of volume that snapshot contains
|
21
|
-
def describe_snapshots(snapshot_id = [])
|
22
|
-
|
24
|
+
def describe_snapshots(snapshot_id = [], options = {})
|
25
|
+
options['Owner'] ||= 'self'
|
26
|
+
options.merge!(AWS.indexed_param('SnapshotId', snapshot_id))
|
23
27
|
request({
|
24
28
|
'Action' => 'DescribeSnapshots',
|
25
29
|
:parser => Fog::Parsers::AWS::EC2::DescribeSnapshots.new
|
26
|
-
}.merge!(
|
30
|
+
}.merge!(options))
|
27
31
|
end
|
28
32
|
|
29
33
|
end
|
@@ -5,68 +5,32 @@ module Fog
|
|
5
5
|
# Instatiate a vapp template
|
6
6
|
#
|
7
7
|
# ==== Parameters
|
8
|
-
# *
|
8
|
+
# * name<~String>: Name of the resulting vapp .. must start with letter, up to 15 chars alphanumeric.
|
9
9
|
# * options<~Hash>:
|
10
10
|
# * cpus<~Integer>: Number of cpus in [1, 2, 4, 8], defaults to 1
|
11
11
|
# * memory<~Integer>: Amount of memory either 512 or a multiple of 1024, defaults to 512
|
12
|
+
# * vapp_template<~String>: id of the vapp template to be instantiated
|
12
13
|
# ==== Returns
|
13
14
|
# * response<~Excon::Response>:
|
14
15
|
# * body<~Hash>:
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
options['
|
26
|
-
options['
|
27
|
-
|
28
|
-
# FIXME: much cheating to commence
|
29
|
-
vdc_id = default_vdc_id
|
30
|
-
network_id = default_network_id
|
31
|
-
catalog_item = 12 # Ubuntu JeOS 9.10 (64-bit)
|
32
|
-
|
33
|
-
# case UNRESOLVED:
|
34
|
-
# return "0";
|
35
|
-
# case RESOLVED:
|
36
|
-
# return "1";
|
37
|
-
# case OFF:
|
38
|
-
# return "2";
|
39
|
-
# case SUSPENDED:
|
40
|
-
# return "3";
|
41
|
-
# case ON:
|
42
|
-
# return "4";
|
43
|
-
# default:
|
44
|
-
#
|
45
|
-
# /**
|
46
|
-
# * The vApp is unresolved (one or more file references are unavailable in the cloud)
|
47
|
-
# */
|
48
|
-
# UNRESOLVED,
|
49
|
-
# /**
|
50
|
-
# * The vApp is resolved (all file references are available in the cloud) but not deployed
|
51
|
-
# */
|
52
|
-
# RESOLVED,
|
53
|
-
# /**
|
54
|
-
# * The vApp is deployed and powered off
|
55
|
-
# */
|
56
|
-
# OFF,
|
57
|
-
# /**
|
58
|
-
# * The vApp is deployed and suspended
|
59
|
-
# */
|
60
|
-
# SUSPENDED,
|
61
|
-
# /**
|
62
|
-
# * The vApp is deployed and powered on
|
63
|
-
# */
|
64
|
-
# ON;
|
16
|
+
# * 'Links;<~Array> (e.g. up to vdc)
|
17
|
+
# * 'href'<~String> Link to the resulting vapp
|
18
|
+
# * 'name'<~String> - name of item
|
19
|
+
# * 'type'<~String> - type of item
|
20
|
+
# * 'status'<~String> - 0(pending) --> 2(off) -->4(on)
|
21
|
+
def instantiate_vapp_template(name, vapp_template, options = {})
|
22
|
+
unless name.length < 15
|
23
|
+
raise ArgumentError.new('Name must be fewer than 15 characters')
|
24
|
+
end
|
25
|
+
options['cpus'] ||= 1
|
26
|
+
options['memory'] ||= 512
|
27
|
+
options['network_id'] ||= default_network_id
|
28
|
+
options['vdc_id'] ||= default_vdc_id
|
65
29
|
|
66
30
|
data = <<-DATA
|
67
31
|
<?xml version="1.0" encoding="UTF-8"?>
|
68
32
|
<InstantiateVAppTemplateParams name="#{name}" xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://services.vcloudexpress.terremark.com/api/v0.8/ns/vcloud.xsd">
|
69
|
-
<VAppTemplate href="
|
33
|
+
<VAppTemplate href="#{@scheme}://#{@host}/#{@path}/vAppTemplate/#{vapp_template}" />
|
70
34
|
<InstantiationParams xmlns:vmw="http://www.vmware.com/schema/ovf">
|
71
35
|
<ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8"/>
|
72
36
|
<VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8">
|
@@ -82,12 +46,8 @@ module Fog
|
|
82
46
|
</Item>
|
83
47
|
</VirtualHardwareSection>
|
84
48
|
<NetworkConfigSection>
|
85
|
-
<NetworkConfig
|
86
|
-
<
|
87
|
-
<vmw:FenceMode>allowInOut</vmw:FenceMode>
|
88
|
-
<vmw:Dhcp>true</vmw:Dhcp>
|
89
|
-
</Features>
|
90
|
-
<NetworkAssociation href="https://services.vcloudexpress.terremark.com/api/v8/network/#{network_id}" />
|
49
|
+
<NetworkConfig>
|
50
|
+
<NetworkAssociation href="#{@scheme}://#{@host}/#{@path}/network/#{options['network_id']}"/>
|
91
51
|
</NetworkConfig>
|
92
52
|
</NetworkConfigSection>
|
93
53
|
</InstantiationParams>
|
@@ -100,7 +60,7 @@ DATA
|
|
100
60
|
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' },
|
101
61
|
:method => 'POST',
|
102
62
|
:parser => Fog::Parsers::Terremark::InstantiateVappTemplate.new,
|
103
|
-
:path => "vdc/#{vdc_id}/action/instantiatevAppTemplate"
|
63
|
+
:path => "vdc/#{options['vdc_id']}/action/instantiatevAppTemplate"
|
104
64
|
)
|
105
65
|
end
|
106
66
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 77
|
9
|
+
version: 0.0.77
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-23 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|