jellyfish-aws 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/jellyfish_aws/product_type/ec2.rb +43 -0
- data/app/models/jellyfish_aws/provider/aws.rb +150 -0
- data/app/models/jellyfish_aws/registered_provider/aws.rb +35 -0
- data/app/models/jellyfish_aws/service/ec2.rb +39 -0
- data/db/migrate/20150917174153_namespace_classes.rb +10 -0
- data/lib/jellyfish_aws/version.rb +1 -1
- metadata +7 -6
- data/app/models/product_type/ec2.rb +0 -41
- data/app/models/provider/aws.rb +0 -148
- data/app/models/registered_provider/aws.rb +0 -33
- data/app/models/service/ec2.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e09924ce72253e783f269b2cc11712f461cb39f
|
4
|
+
data.tar.gz: e1d9c856ba4280164caaf97bc635658f146abaff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe54fac50f8f5cf81091c647a43220f963b8fb5c5758bc9f2df0935d74f12c11ead07fcfcc012905f7bd137f6217e941707d5f5c8b8ae16a006297932dd0f1bc
|
7
|
+
data.tar.gz: cc4adc8b4a24ec6c0548f84570c9e48df59180e93b24edb3daf199bbe345de893ddec119af7f6bf0f579be4dea84e0583bcac5387192d54d74c7485250c7cd77
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module JellyfishAws
|
2
|
+
class ProductType < ActiveRecord::Base
|
3
|
+
class Ec2 < ::ProductType
|
4
|
+
def self.load_product_types
|
5
|
+
return unless super
|
6
|
+
|
7
|
+
transaction do
|
8
|
+
[
|
9
|
+
set('EC2 Instance', 'd16d5017-6d6b-4775-958f-535f68b4cf04', provider_type: 'JellyfishAws::Provider::Aws')
|
10
|
+
].each do |s|
|
11
|
+
create! s.merge!(type: 'JellyfishAws::ProductType::Ec2')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def description
|
17
|
+
'Amazon Web Services Elastic Compute Cloud Instance'
|
18
|
+
end
|
19
|
+
|
20
|
+
def tags
|
21
|
+
['ec2', 'server']
|
22
|
+
end
|
23
|
+
|
24
|
+
def product_questions
|
25
|
+
[
|
26
|
+
{ name: :flavor_id, value_type: :string, field: :aws_ec2_flavors, required: true },
|
27
|
+
{ name: :image_id, value_type: :string, field: :aws_ec2_images, required: true },
|
28
|
+
{ name: :subnet_id, value_type: :string, field: :aws_subnets, required: true }
|
29
|
+
]
|
30
|
+
end
|
31
|
+
|
32
|
+
def order_questions
|
33
|
+
[
|
34
|
+
{ name: :zone_id, value_type: :string, field: :aws_zones, required: true }
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
def service_class
|
39
|
+
'JellyfishAws::Service::Ec2'.constantize
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module JellyfishAws
|
2
|
+
class Provider < ActiveRecord::Base
|
3
|
+
class Aws < ::Provider
|
4
|
+
def ec2_flavors
|
5
|
+
client.flavors.map do |f|
|
6
|
+
{
|
7
|
+
id: f.id, name: f.name, bits: f.bits, cores: f.cores, ram: f.ram,
|
8
|
+
label: [f.name, f.id].join(' - '), value: f.id
|
9
|
+
}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def ec2_images
|
14
|
+
case settings[:region]
|
15
|
+
when 'us-east-1'
|
16
|
+
[
|
17
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-1ecae776' },
|
18
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-12663b7a' },
|
19
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-aeb532c6' },
|
20
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-d05e75b8' },
|
21
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-f70cdd9c' },
|
22
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-1ccae774' },
|
23
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-c08fcba8' },
|
24
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-d85e75b0' }
|
25
|
+
]
|
26
|
+
when 'us-west-1'
|
27
|
+
[
|
28
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-e7527ed7' },
|
29
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-4dbf9e7d' },
|
30
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-d7450be7' },
|
31
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-5189a661' },
|
32
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-c3b3b1f3' },
|
33
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ff527ecf' },
|
34
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-5df2ab6d' },
|
35
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-6989a659' }
|
36
|
+
]
|
37
|
+
when 'us-west-2'
|
38
|
+
[
|
39
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-d114f295' },
|
40
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-a540a5e1' },
|
41
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-b95b4ffc' },
|
42
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-df6a8b9b' },
|
43
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-3bee1c7f' },
|
44
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-d514f291' },
|
45
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-fe8891bb' },
|
46
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-d16a8b95' }
|
47
|
+
]
|
48
|
+
when 'eu-west-1'
|
49
|
+
[
|
50
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-a10897d6' },
|
51
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-25158352' },
|
52
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-e801af9f' },
|
53
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-47a23a30' },
|
54
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-68347d1f' },
|
55
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-bf0897c8' },
|
56
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-17c44860' },
|
57
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-5da23a2a' }
|
58
|
+
]
|
59
|
+
when 'eu-central-1'
|
60
|
+
[
|
61
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-a8221fb5' },
|
62
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-dafdcfc7' },
|
63
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-a22610bf' },
|
64
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-accff2b1' },
|
65
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-f64540eb' },
|
66
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ac221fb1' },
|
67
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-fc0033e1' },
|
68
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-b6cff2ab' }
|
69
|
+
]
|
70
|
+
when 'ap-southeast-1'
|
71
|
+
[
|
72
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-68d8e93a' },
|
73
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-dc1c2b8e' },
|
74
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-84b392d6' },
|
75
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-96f1c1c4' },
|
76
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-b89093ea' },
|
77
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-acd9e8fe' },
|
78
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-3cbe956e' },
|
79
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-e8f1c1ba' }
|
80
|
+
]
|
81
|
+
when 'ap-northeast-1'
|
82
|
+
[
|
83
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-cbf90ecb' },
|
84
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-b1b458b1' },
|
85
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-d54a79d4' },
|
86
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-936d9d93' },
|
87
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-e69520e6' },
|
88
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-27f90e27' },
|
89
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-5cb8a65d' },
|
90
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-8d6d9d8d' }
|
91
|
+
]
|
92
|
+
when 'ap-southeast-2'
|
93
|
+
[
|
94
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-fd9cecc7' },
|
95
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-d3daace9' },
|
96
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-b90e6283' },
|
97
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-69631053' },
|
98
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-2d2d6b17' },
|
99
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ff9cecc5' },
|
100
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-ad0d7997' },
|
101
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-7163104b' }
|
102
|
+
]
|
103
|
+
when 'sa-east-1'
|
104
|
+
[
|
105
|
+
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-b52890a8' },
|
106
|
+
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-09e25b14' },
|
107
|
+
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-f102b6ec' },
|
108
|
+
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-4d883350' },
|
109
|
+
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-87f8779a' },
|
110
|
+
{ label: 'Amazon Linux AMI 2015.03 (PV', value: 'ami-bb2890a6' },
|
111
|
+
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-23912d3e' },
|
112
|
+
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-55883348' }
|
113
|
+
]
|
114
|
+
else
|
115
|
+
[]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def subnets
|
120
|
+
client.subnets.map do |s|
|
121
|
+
{
|
122
|
+
id: s.subnet_id, name: s.cidr_block, cidr: s.cidr_block, vpc_id: s.vpc_id,
|
123
|
+
label: s.cidr_block, value: s.subnet_id
|
124
|
+
}
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def availability_zones
|
129
|
+
client.describe_availability_zones.body['availabilityZoneInfo'].map do |az|
|
130
|
+
next unless client.region == az['regionName']
|
131
|
+
{ label: az['zoneName'], value: az['zoneName'] }
|
132
|
+
end.compact
|
133
|
+
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
def client
|
138
|
+
@client ||= begin
|
139
|
+
credentials = {
|
140
|
+
provider: 'AWS',
|
141
|
+
aws_access_key_id: settings[:access_id],
|
142
|
+
aws_secret_access_key: settings[:secret_key],
|
143
|
+
region: settings[:region]
|
144
|
+
}
|
145
|
+
Fog::Compute.new credentials
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module JellyfishAws
|
2
|
+
class RegisteredProvider < ActiveRecord::Base
|
3
|
+
class Aws < ::RegisteredProvider
|
4
|
+
def self.load_registered_providers
|
5
|
+
return unless super
|
6
|
+
|
7
|
+
transaction do
|
8
|
+
[
|
9
|
+
set('AWS', '1072ddc9-e04f-4d43-929b-8866ce7e6d3a')
|
10
|
+
].each { |s| create! s.merge!(type: 'JellyfishAws::RegisteredProvider::Aws') }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def provider_class
|
15
|
+
'JellyfishAws::Provider::Aws'.constantize
|
16
|
+
end
|
17
|
+
|
18
|
+
def description
|
19
|
+
'Amazon Web Services'
|
20
|
+
end
|
21
|
+
|
22
|
+
def tags
|
23
|
+
['aws']
|
24
|
+
end
|
25
|
+
|
26
|
+
def questions
|
27
|
+
[
|
28
|
+
{ name: :access_id, value_type: :string, field: :text, label: 'Access ID', required: true },
|
29
|
+
{ name: :secret_key, value_type: :password, field: :password, label: 'Secret Key', required: :if_new },
|
30
|
+
{ name: :region, value_type: :string, field: :aws_regions, required: true }
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module JellyfishAws
|
2
|
+
class Service < ActiveRecord::Base
|
3
|
+
class Ec2 < ::Service::Compute
|
4
|
+
def actions
|
5
|
+
actions = super.merge :terminate
|
6
|
+
|
7
|
+
# determine if action is available
|
8
|
+
|
9
|
+
actions
|
10
|
+
end
|
11
|
+
|
12
|
+
def provision
|
13
|
+
=begin
|
14
|
+
create key_pair name: service.uuid
|
15
|
+
create security group (one per project) name: project-{id}
|
16
|
+
create vpc (one per project) name: project-{id}
|
17
|
+
=end
|
18
|
+
end
|
19
|
+
|
20
|
+
def start
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def stop
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def terminate
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def client
|
35
|
+
@client ||= provider.settings
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class NamespaceClasses < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Provider.where(type: 'Provider::Aws').update_all(type: 'JellyfishAws::Provider::Aws')
|
4
|
+
Service..where(type: 'Service::Ec2').update_all(type: 'JellyfishAws::Service::Ec2')
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
raise ActiveRecord::IrreversibleMigration
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jellyfish-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Stack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -120,12 +120,13 @@ files:
|
|
120
120
|
- Rakefile
|
121
121
|
- app/controllers/jellyfish_aws/application_controller.rb
|
122
122
|
- app/controllers/jellyfish_aws/providers_controller.rb
|
123
|
-
- app/models/product_type/ec2.rb
|
124
|
-
- app/models/provider/aws.rb
|
125
|
-
- app/models/registered_provider/aws.rb
|
126
|
-
- app/models/service/ec2.rb
|
123
|
+
- app/models/jellyfish_aws/product_type/ec2.rb
|
124
|
+
- app/models/jellyfish_aws/provider/aws.rb
|
125
|
+
- app/models/jellyfish_aws/registered_provider/aws.rb
|
126
|
+
- app/models/jellyfish_aws/service/ec2.rb
|
127
127
|
- app/policies/aws_policy.rb
|
128
128
|
- config/routes.rb
|
129
|
+
- db/migrate/20150917174153_namespace_classes.rb
|
129
130
|
- lib/jellyfish-aws.rb
|
130
131
|
- lib/jellyfish_aws.rb
|
131
132
|
- lib/jellyfish_aws/engine.rb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
class ProductType < ActiveRecord::Base
|
2
|
-
class Ec2 < ProductType
|
3
|
-
def self.load_product_types
|
4
|
-
return unless super
|
5
|
-
|
6
|
-
transaction do
|
7
|
-
[
|
8
|
-
set('EC2 Instance', 'd16d5017-6d6b-4775-958f-535f68b4cf04', provider_type: 'Provider::Aws')
|
9
|
-
].each do |s|
|
10
|
-
create! s.merge!(type: 'ProductType::Ec2')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def description
|
16
|
-
'Amazon Web Services Elastic Compute Cloud Instance'
|
17
|
-
end
|
18
|
-
|
19
|
-
def tags
|
20
|
-
['ec2', 'server']
|
21
|
-
end
|
22
|
-
|
23
|
-
def product_questions
|
24
|
-
[
|
25
|
-
{ name: :flavor_id, value_type: :string, field: :aws_ec2_flavors, required: true },
|
26
|
-
{ name: :image_id, value_type: :string, field: :aws_ec2_images, required: true },
|
27
|
-
{ name: :subnet_id, value_type: :string, field: :aws_subnets, required: true }
|
28
|
-
]
|
29
|
-
end
|
30
|
-
|
31
|
-
def order_questions
|
32
|
-
[
|
33
|
-
{ name: :zone_id, value_type: :string, field: :aws_zones, required: true }
|
34
|
-
]
|
35
|
-
end
|
36
|
-
|
37
|
-
def service_class
|
38
|
-
'Service::Ec2'.constantize
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/app/models/provider/aws.rb
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
class Provider < ActiveRecord::Base
|
2
|
-
class Aws < Provider
|
3
|
-
def ec2_flavors
|
4
|
-
client.flavors.map do |f|
|
5
|
-
{
|
6
|
-
id: f.id, name: f.name, bits: f.bits, cores: f.cores, ram: f.ram,
|
7
|
-
label: [f.name, f.id].join(' - '), value: f.id
|
8
|
-
}
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def ec2_images
|
13
|
-
case settings[:region]
|
14
|
-
when 'us-east-1'
|
15
|
-
[
|
16
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-1ecae776' },
|
17
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-12663b7a' },
|
18
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-aeb532c6' },
|
19
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-d05e75b8' },
|
20
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-f70cdd9c' },
|
21
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-1ccae774' },
|
22
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-c08fcba8' },
|
23
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-d85e75b0' }
|
24
|
-
]
|
25
|
-
when 'us-west-1'
|
26
|
-
[
|
27
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-e7527ed7' },
|
28
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-4dbf9e7d' },
|
29
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-d7450be7' },
|
30
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-5189a661' },
|
31
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-c3b3b1f3' },
|
32
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ff527ecf' },
|
33
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-5df2ab6d' },
|
34
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-6989a659' }
|
35
|
-
]
|
36
|
-
when 'us-west-1'
|
37
|
-
[
|
38
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-d114f295' },
|
39
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-a540a5e1' },
|
40
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-b95b4ffc' },
|
41
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-df6a8b9b' },
|
42
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-3bee1c7f' },
|
43
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-d514f291' },
|
44
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-fe8891bb' },
|
45
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-d16a8b95' }
|
46
|
-
]
|
47
|
-
when 'eu-west-1'
|
48
|
-
[
|
49
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-a10897d6' },
|
50
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-25158352' },
|
51
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-e801af9f' },
|
52
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-47a23a30' },
|
53
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-68347d1f' },
|
54
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-bf0897c8' },
|
55
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-17c44860' },
|
56
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-5da23a2a' }
|
57
|
-
]
|
58
|
-
when 'eu-central-1'
|
59
|
-
[
|
60
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-a8221fb5' },
|
61
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-dafdcfc7' },
|
62
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-a22610bf' },
|
63
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-accff2b1' },
|
64
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-f64540eb' },
|
65
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ac221fb1' },
|
66
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-fc0033e1' },
|
67
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-b6cff2ab' }
|
68
|
-
]
|
69
|
-
when 'ap-southeast-1'
|
70
|
-
[
|
71
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-68d8e93a' },
|
72
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-dc1c2b8e' },
|
73
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-84b392d6' },
|
74
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-96f1c1c4' },
|
75
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-b89093ea' },
|
76
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-acd9e8fe' },
|
77
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-3cbe956e' },
|
78
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-e8f1c1ba' }
|
79
|
-
]
|
80
|
-
when 'ap-northeast-1'
|
81
|
-
[
|
82
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-cbf90ecb' },
|
83
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-b1b458b1' },
|
84
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-d54a79d4' },
|
85
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-936d9d93' },
|
86
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-e69520e6' },
|
87
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-27f90e27' },
|
88
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-5cb8a65d' },
|
89
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-8d6d9d8d' }
|
90
|
-
]
|
91
|
-
when 'ap-southeast-2'
|
92
|
-
[
|
93
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-fd9cecc7' },
|
94
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-d3daace9' },
|
95
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-b90e6283' },
|
96
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-69631053' },
|
97
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-2d2d6b17' },
|
98
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV)', value: 'ami-ff9cecc5' },
|
99
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-ad0d7997' },
|
100
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-7163104b' }
|
101
|
-
]
|
102
|
-
when 'sa-east-1'
|
103
|
-
[
|
104
|
-
{ label: 'Amazon Linux AMI 2015.03 (HVM), SSD Volume Type', value: 'ami-b52890a8' },
|
105
|
-
{ label: 'Red Hat Enterprise Linux 7.1 (HVM), SSD Volume Type', value: 'ami-09e25b14' },
|
106
|
-
{ label: 'SUSE Linux Enterprise Server 12 (HVM), SSD Volume Type', value: 'ami-f102b6ec' },
|
107
|
-
{ label: 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type', value: 'ami-4d883350' },
|
108
|
-
{ label: 'Microsoft Windows Server 2012 R2 Base', value: 'ami-87f8779a' },
|
109
|
-
{ label: 'Amazon Linux AMI 2015.03 (PV', value: 'ami-bb2890a6' },
|
110
|
-
{ label: 'SUSE Linux Enterprise Server 11 SP3 (PV), SSD Volume Type', value: 'ami-23912d3e' },
|
111
|
-
{ label: 'Ubuntu Server 14.04 LTS (PV), SSD Volume Type', value: 'ami-55883348' }
|
112
|
-
]
|
113
|
-
else
|
114
|
-
[]
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def subnets
|
119
|
-
client.subnets.map do |s|
|
120
|
-
{
|
121
|
-
id: s.subnet_id, name: s.cidr_block, cidr: s.cidr_block, vpc_id: s.vpc_id,
|
122
|
-
label: s.cidr_block, value: s.subnet_id
|
123
|
-
}
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def availability_zones
|
128
|
-
client.describe_availability_zones.body['availabilityZoneInfo'].map do |az|
|
129
|
-
next unless client.region == az['regionName']
|
130
|
-
{ label: az['zoneName'], value: az['zoneName'] }
|
131
|
-
end.compact
|
132
|
-
end
|
133
|
-
|
134
|
-
private
|
135
|
-
|
136
|
-
def client
|
137
|
-
@client ||= begin
|
138
|
-
credentials = {
|
139
|
-
provider: 'AWS',
|
140
|
-
aws_access_key_id: settings[:access_id],
|
141
|
-
aws_secret_access_key: settings[:secret_key],
|
142
|
-
region: settings[:region]
|
143
|
-
}
|
144
|
-
Fog::Compute.new credentials
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
class RegisteredProvider < ActiveRecord::Base
|
2
|
-
class Aws < RegisteredProvider
|
3
|
-
def self.load_registered_providers
|
4
|
-
return unless super
|
5
|
-
|
6
|
-
transaction do
|
7
|
-
[
|
8
|
-
set('AWS', '1072ddc9-e04f-4d43-929b-8866ce7e6d3a')
|
9
|
-
].each { |s| create! s.merge!(type: 'RegisteredProvider::Aws') }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def provider_class
|
14
|
-
'Provider::Aws'.constantize
|
15
|
-
end
|
16
|
-
|
17
|
-
def description
|
18
|
-
'Amazon Web Services'
|
19
|
-
end
|
20
|
-
|
21
|
-
def tags
|
22
|
-
['aws']
|
23
|
-
end
|
24
|
-
|
25
|
-
def questions
|
26
|
-
[
|
27
|
-
{ name: :access_id, value_type: :string, field: :text, label: 'Access ID', required: true },
|
28
|
-
{ name: :secret_key, value_type: :password, field: :password, label: 'Secret Key', required: :if_new },
|
29
|
-
{ name: :region, value_type: :string, field: :aws_regions, required: true }
|
30
|
-
]
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/app/models/service/ec2.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
class Service < ActiveRecord::Base
|
2
|
-
class Ec2 < Service::Compute
|
3
|
-
def actions
|
4
|
-
actions = super.merge :terminate
|
5
|
-
|
6
|
-
# determine if action is available
|
7
|
-
|
8
|
-
actions
|
9
|
-
end
|
10
|
-
|
11
|
-
def provision
|
12
|
-
=begin
|
13
|
-
create key_pair name: service.uuid
|
14
|
-
create security group (one per project) name: project-{id}
|
15
|
-
create vpc (one per project) name: project-{id}
|
16
|
-
=end
|
17
|
-
end
|
18
|
-
|
19
|
-
def start
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def stop
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def terminate
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def client
|
34
|
-
@client ||= provider.settings
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|