rest_connection 0.0.23 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/Rakefile +5 -4
- data/VERSION +1 -1
- data/git_hooks/post-commit.disabled +4 -0
- data/git_hooks/post-merge.disabled +4 -0
- data/git_hooks/pre-commit +53 -0
- data/lib/rest_connection.rb +75 -12
- data/lib/rest_connection/patches.rb +106 -0
- data/lib/rest_connection/rightscale/account.rb +27 -0
- data/lib/rest_connection/rightscale/alert_spec.rb +2 -2
- data/lib/rest_connection/rightscale/audit_entry.rb +5 -5
- data/lib/rest_connection/rightscale/child_account.rb +27 -0
- data/lib/rest_connection/rightscale/cloud.rb +26 -0
- data/lib/rest_connection/rightscale/credential.rb +1 -1
- data/lib/rest_connection/rightscale/deployment.rb +33 -7
- data/lib/rest_connection/rightscale/ec2_ebs_snapshot.rb +3 -1
- data/lib/rest_connection/rightscale/ec2_ebs_volume.rb +3 -1
- data/lib/rest_connection/rightscale/ec2_elastic_ip.rb +1 -1
- data/lib/rest_connection/rightscale/ec2_security_group.rb +2 -2
- data/lib/rest_connection/rightscale/ec2_server_array.rb +7 -5
- data/lib/rest_connection/rightscale/ec2_ssh_key.rb +11 -2
- data/lib/rest_connection/rightscale/ec2_ssh_key_internal.rb +2 -2
- data/lib/rest_connection/rightscale/executable.rb +4 -4
- data/lib/rest_connection/rightscale/instance.rb +5 -3
- data/lib/rest_connection/rightscale/instance_type.rb +31 -0
- data/lib/rest_connection/rightscale/macro.rb +19 -0
- data/lib/rest_connection/rightscale/mc_datacenter.rb +53 -0
- data/lib/rest_connection/rightscale/mc_deployment.rb +60 -0
- data/lib/rest_connection/rightscale/mc_image.rb +42 -0
- data/lib/rest_connection/rightscale/mc_instance.rb +170 -0
- data/lib/rest_connection/rightscale/mc_instance_type.rb +47 -0
- data/lib/rest_connection/rightscale/mc_multi_cloud_image.rb +58 -0
- data/lib/rest_connection/rightscale/mc_multi_cloud_image_setting.rb +46 -0
- data/lib/rest_connection/rightscale/mc_security_group.rb +42 -0
- data/lib/rest_connection/rightscale/mc_server.rb +250 -6
- data/lib/rest_connection/rightscale/mc_server_array.rb +44 -0
- data/lib/rest_connection/rightscale/mc_server_template.rb +53 -0
- data/lib/rest_connection/rightscale/mc_ssh_key.rb +50 -0
- data/lib/rest_connection/rightscale/mc_tag.rb +69 -0
- data/lib/rest_connection/rightscale/mc_volume.rb +53 -0
- data/lib/rest_connection/rightscale/mc_volume_attachment.rb +48 -0
- data/lib/rest_connection/rightscale/mc_volume_snapshot.rb +55 -0
- data/lib/rest_connection/rightscale/mc_volume_type.rb +47 -0
- data/lib/rest_connection/rightscale/monitoring_metric.rb +35 -0
- data/lib/rest_connection/rightscale/multi_cloud_image.rb +16 -2
- data/lib/rest_connection/rightscale/multi_cloud_image_cloud_setting_internal.rb +2 -2
- data/lib/rest_connection/rightscale/multi_cloud_image_internal.rb +25 -1
- data/lib/rest_connection/rightscale/permission.rb +27 -0
- data/lib/rest_connection/rightscale/right_script.rb +4 -4
- data/lib/rest_connection/rightscale/right_script_internal.rb +4 -4
- data/lib/rest_connection/rightscale/rightscale_api_base.rb +69 -20
- data/lib/rest_connection/rightscale/rightscale_api_gateway.rb +198 -13
- data/lib/rest_connection/rightscale/rightscale_api_internal.rb +3 -3
- data/lib/rest_connection/rightscale/rightscale_api_mc_input.rb +32 -0
- data/lib/rest_connection/rightscale/rightscale_api_mc_taggable.rb +57 -0
- data/lib/rest_connection/rightscale/rightscale_api_resources.rb +32 -2
- data/lib/rest_connection/rightscale/rightscale_api_taggable.rb +116 -0
- data/lib/rest_connection/rightscale/rs_internal.rb +6 -6
- data/lib/rest_connection/rightscale/s3_bucket.rb +36 -0
- data/lib/rest_connection/rightscale/server.rb +186 -37
- data/lib/rest_connection/rightscale/server_interface.rb +264 -0
- data/lib/rest_connection/rightscale/server_internal.rb +3 -3
- data/lib/rest_connection/rightscale/server_template.rb +15 -4
- data/lib/rest_connection/rightscale/server_template_internal.rb +4 -4
- data/lib/rest_connection/rightscale/status.rb +2 -2
- data/lib/rest_connection/rightscale/tag.rb +2 -2
- data/lib/rest_connection/rightscale/task.rb +47 -0
- data/lib/rest_connection/rightscale/user.rb +27 -0
- data/lib/rest_connection/ssh_hax.rb +42 -40
- data/rest_connection.gemspec +5 -5
- data/spec/mcserver_spec.rb +17 -0
- data/spec/multi.rb +16 -0
- metadata +65 -12
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
#
|
17
|
+
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
+
#
|
19
|
+
|
20
|
+
#
|
21
|
+
# ChildAccount Resource requires 'enterprise_manager' role and 'enterprise_master' account setting
|
22
|
+
#
|
23
|
+
|
24
|
+
class ChildAccount
|
25
|
+
include RightScale::Api::Gateway
|
26
|
+
extend RightScale::Api::GatewayExtend
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
#
|
17
|
+
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
+
#
|
19
|
+
class Cloud
|
20
|
+
include RightScale::Api::Gateway
|
21
|
+
extend RightScale::Api::GatewayExtend
|
22
|
+
|
23
|
+
def cloud_id
|
24
|
+
self.href.split("/").last
|
25
|
+
end
|
26
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -13,9 +13,30 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
class Deployment
|
16
|
+
class Deployment
|
17
17
|
include RightScale::Api::Base
|
18
18
|
extend RightScale::Api::BaseExtend
|
19
|
+
include RightScale::Api::Taggable
|
20
|
+
extend RightScale::Api::TaggableExtend
|
21
|
+
|
22
|
+
def reload
|
23
|
+
uri = URI.parse(self.href)
|
24
|
+
@params ? @params.merge!(connection.get(uri.path)) : @params = connection.get(uri.path)
|
25
|
+
@params['cloud_id'] = cloud_id
|
26
|
+
@params
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.create(opts)
|
30
|
+
location = connection.post(self.resource_plural_name, self.resource_singular_name.to_sym => opts)
|
31
|
+
newrecord = self.new('href' => location)
|
32
|
+
newrecord.reload
|
33
|
+
newrecord
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_inputs(hash = {})
|
37
|
+
deploy_href = URI.parse(self.href)
|
38
|
+
connection.put(deploy_href.path, :deployment => {:parameters => hash })
|
39
|
+
end
|
19
40
|
|
20
41
|
def set_input(name, value)
|
21
42
|
deploy_href = URI.parse(self.href)
|
@@ -23,11 +44,8 @@ class Deployment
|
|
23
44
|
end
|
24
45
|
|
25
46
|
def servers_no_reload
|
26
|
-
|
27
|
-
@params['servers'].
|
28
|
-
server_list << Server.new(s)
|
29
|
-
end
|
30
|
-
return server_list
|
47
|
+
connection.logger("WARNING: No Servers in the Deployment!") if @params['servers'].empty?
|
48
|
+
@params['servers'].map { |s| ServerInterface.new(self.cloud_id, s, self.rs_id) }
|
31
49
|
end
|
32
50
|
|
33
51
|
def servers
|
@@ -45,4 +63,12 @@ class Deployment
|
|
45
63
|
deploy_href = URI.parse(self.href)
|
46
64
|
Deployment.new(:href => connection.post(deploy_href.path + "/duplicate"))
|
47
65
|
end
|
66
|
+
|
67
|
+
def destroy(wait_for_servers = nil)
|
68
|
+
deploy_href = URI.parse(self.href)
|
69
|
+
if wait_for_servers
|
70
|
+
servers_no_reload.each { |s| s.wait_for_state("stopped") }
|
71
|
+
end
|
72
|
+
connection.delete(deploy_href.path)
|
73
|
+
end
|
48
74
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -17,4 +17,6 @@
|
|
17
17
|
class Ec2EbsSnapshot
|
18
18
|
include RightScale::Api::Base
|
19
19
|
extend RightScale::Api::BaseExtend
|
20
|
+
include RightScale::Api::Taggable
|
21
|
+
extend RightScale::Api::TaggableExtend
|
20
22
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -17,6 +17,8 @@
|
|
17
17
|
class Ec2EbsVolume
|
18
18
|
include RightScale::Api::Base
|
19
19
|
extend RightScale::Api::BaseExtend
|
20
|
+
include RightScale::Api::Taggable
|
21
|
+
extend RightScale::Api::TaggableExtend
|
20
22
|
|
21
23
|
def attach(params)
|
22
24
|
connection.post('component_ec2_ebs_volumes.js' , :component_ec2_ebs_volume => params)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
class Ec2SecurityGroup
|
16
|
+
class Ec2SecurityGroup
|
17
17
|
include RightScale::Api::Base
|
18
18
|
extend RightScale::Api::BaseExtend
|
19
19
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -13,9 +13,11 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
class Ec2ServerArray
|
16
|
+
class Ec2ServerArray
|
17
17
|
include RightScale::Api::Base
|
18
18
|
extend RightScale::Api::BaseExtend
|
19
|
+
include RightScale::Api::Taggable
|
20
|
+
extend RightScale::Api::TaggableExtend
|
19
21
|
|
20
22
|
# Example:
|
21
23
|
# right_script = @server_template.executables.first
|
@@ -23,7 +25,7 @@ class Ec2ServerArray
|
|
23
25
|
def run_script_on_all(script, server_template_hrefs, inputs=nil)
|
24
26
|
serv_href = URI.parse(self.href)
|
25
27
|
options = Hash.new
|
26
|
-
options[:ec2_server_array] = Hash.new
|
28
|
+
options[:ec2_server_array] = Hash.new
|
27
29
|
options[:ec2_server_array][:right_script_href] = script.href
|
28
30
|
options[:ec2_server_array][:parameters] = inputs unless inputs.nil?
|
29
31
|
options[:ec2_server_array][:server_template_hrefs] = server_template_hrefs
|
@@ -36,8 +38,8 @@ class Ec2ServerArray
|
|
36
38
|
connection.get("#{serv_href.path}/instances")
|
37
39
|
rescue
|
38
40
|
[] # raise an error on self.href which we want, it'll just rescue on rackspace and return an empty array.
|
39
|
-
end
|
40
|
-
|
41
|
+
end
|
42
|
+
|
41
43
|
def terminate_all
|
42
44
|
serv_href = URI.parse(self.href)
|
43
45
|
connection.post("#{serv_href.path}/terminate_all")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -13,7 +13,16 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
class Ec2SshKey
|
16
|
+
class Ec2SshKey
|
17
17
|
include RightScale::Api::Base
|
18
18
|
extend RightScale::Api::BaseExtend
|
19
|
+
|
20
|
+
def self.create(opts)
|
21
|
+
create_opts = { self.resource_singular_name.to_sym => opts }
|
22
|
+
create_opts['cloud_id'] = opts['cloud_id'] if opts['cloud_id']
|
23
|
+
location = connection.post(self.resource_plural_name, create_opts)
|
24
|
+
newrecord = self.new('href' => location)
|
25
|
+
newrecord.reload
|
26
|
+
newrecord
|
27
|
+
end
|
19
28
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
|
-
class Ec2SshKeyInternal
|
16
|
+
class Ec2SshKeyInternal
|
17
17
|
include RightScale::Api::Base
|
18
18
|
extend RightScale::Api::BaseExtend
|
19
19
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Executable
|
1
|
+
class Executable
|
2
2
|
include RightScale::Api::Base
|
3
3
|
extend RightScale::Api::BaseExtend
|
4
4
|
|
@@ -9,8 +9,8 @@ class Executable
|
|
9
9
|
# { :recipe =>
|
10
10
|
# :position => 12,
|
11
11
|
# :apply => "operational",
|
12
|
-
# :right_script => { "href" => "http://blah",
|
13
|
-
# "name" => "blah"
|
12
|
+
# :right_script => { "href" => "http://blah",
|
13
|
+
# "name" => "blah"
|
14
14
|
# ...
|
15
15
|
# }
|
16
16
|
|
@@ -37,7 +37,7 @@ class Executable
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def href
|
40
|
-
if right_script?
|
40
|
+
if right_script?
|
41
41
|
return right_script.href
|
42
42
|
else
|
43
43
|
#recipes do not have hrefs, only names
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is part of RestConnection
|
1
|
+
# This file is part of RestConnection
|
2
2
|
#
|
3
3
|
# RestConnection is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -16,12 +16,14 @@
|
|
16
16
|
# This is an instance facing api and can only be used with
|
17
17
|
# an authentication URL normally found in the instance's userdata called
|
18
18
|
# RS_API_URL
|
19
|
-
class Instance
|
19
|
+
class Instance
|
20
20
|
include RightScale::Api::Base
|
21
21
|
extend RightScale::Api::BaseExtend
|
22
|
+
include RightScale::Api::Taggable
|
23
|
+
extend RightScale::Api::TaggableExtend
|
22
24
|
#def create_ebs_volume_from_snap(snap_aws_id)
|
23
25
|
# connection.post('create_ebs_volume.js', :aws_id => snap_aws_id )
|
24
|
-
#end
|
26
|
+
#end
|
25
27
|
|
26
28
|
def attach_ebs_volume(params)
|
27
29
|
connection.put('attach_ebs_volume.js', params)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
#
|
17
|
+
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
+
#
|
19
|
+
class InstanceType
|
20
|
+
include RightScale::Api::Gateway
|
21
|
+
extend RightScale::Api::GatewayExtend
|
22
|
+
|
23
|
+
def self.parse_args(cloud_id)
|
24
|
+
"clouds/#{cloud_id}/"
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
inst_href = URI.parse(self.href)
|
29
|
+
@params.merge! connection.get(inst_href.path, 'view' => "default")
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
#
|
16
|
+
class Macro
|
17
|
+
include RightScale::Api::Base
|
18
|
+
extend RightScale::Api::BaseExtend
|
19
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
#
|
17
|
+
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
+
#
|
19
|
+
class McDatacenter
|
20
|
+
include RightScale::Api::Gateway
|
21
|
+
extend RightScale::Api::GatewayExtend
|
22
|
+
|
23
|
+
def resource_plural_name
|
24
|
+
"datacenters"
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_singular_name
|
28
|
+
"datacenter"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.resource_plural_name
|
32
|
+
"datacenters"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.resource_singular_name
|
36
|
+
"datacenter"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.parse_args(cloud_id)
|
40
|
+
"clouds/#{cloud_id}/"
|
41
|
+
end
|
42
|
+
|
43
|
+
def show
|
44
|
+
inst_href = URI.parse(self.href)
|
45
|
+
@params.merge! connection.get(inst_href.path, 'view' => "full")
|
46
|
+
end
|
47
|
+
|
48
|
+
def save
|
49
|
+
inst_href = URI.parse(self.href)
|
50
|
+
connection.put(inst_href.path, @params)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# This file is part of RestConnection
|
2
|
+
#
|
3
|
+
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# RestConnection is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
#
|
17
|
+
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
+
#
|
19
|
+
class McDeployment
|
20
|
+
include RightScale::Api::Gateway
|
21
|
+
extend RightScale::Api::GatewayExtend
|
22
|
+
include RightScale::Api::McTaggable
|
23
|
+
extend RightScale::Api::McTaggableExtend
|
24
|
+
include RightScale::Api::McInput
|
25
|
+
|
26
|
+
def resource_plural_name
|
27
|
+
"deployments"
|
28
|
+
end
|
29
|
+
|
30
|
+
def resource_singular_name
|
31
|
+
"deployment"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.resource_plural_name
|
35
|
+
"deployments"
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.resource_singular_name
|
39
|
+
"deployment"
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create(opts)
|
43
|
+
location = connection.post(resource_plural_name, opts)
|
44
|
+
newrecord = self.new('href' => location)
|
45
|
+
newrecord.show
|
46
|
+
newrecord
|
47
|
+
end
|
48
|
+
|
49
|
+
def save
|
50
|
+
inst_href = URI.parse(self.href)
|
51
|
+
connection.put(inst_href.path, @params)
|
52
|
+
end
|
53
|
+
|
54
|
+
# TODO Add server method
|
55
|
+
|
56
|
+
def destroy
|
57
|
+
deploy_href = URI.parse(self.href)
|
58
|
+
connection.delete(deploy_href.path)
|
59
|
+
end
|
60
|
+
end
|