ropenstack 1.2.1 → 2.0.0
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/.gitignore +1 -0
- data/README.md +2 -1
- data/doc/Ropenstack.html +151 -0
- data/doc/Ropenstack/Cinder.html +197 -0
- data/doc/Ropenstack/Glance.html +292 -0
- data/doc/Ropenstack/Keystone.html +737 -0
- data/doc/Ropenstack/MalformedRequestError.html +142 -0
- data/doc/Ropenstack/NotFoundError.html +142 -0
- data/doc/Ropenstack/Nova.html +562 -0
- data/doc/Ropenstack/OpenstackService.html +199 -0
- data/doc/Ropenstack/Quantum.html +830 -0
- data/doc/Ropenstack/Rest.html +483 -0
- data/doc/Ropenstack/RopenstackError.html +143 -0
- data/doc/Ropenstack/TimeoutError.html +142 -0
- data/doc/Ropenstack/UnauthorisedError.html +142 -0
- data/doc/created.rid +10 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +93 -0
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +543 -0
- data/doc/table_of_contents.html +200 -0
- data/lib/ropenstack.rb +18 -0
- data/lib/ropenstack/blockStorage.rb +25 -0
- data/lib/ropenstack/blockStorage/v1.rb +67 -0
- data/lib/ropenstack/blockStorage/v2.rb +11 -0
- data/lib/ropenstack/common/error.rb +12 -0
- data/lib/ropenstack/common/openstackservice.rb +28 -0
- data/lib/ropenstack/common/rest.rb +138 -0
- data/lib/ropenstack/compute.rb +164 -0
- data/lib/ropenstack/compute/v2.rb +11 -0
- data/lib/ropenstack/compute/v2/extensions.rb +14 -0
- data/lib/ropenstack/compute/v2/extensions/admin.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/agents.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/aggregates.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/certificates.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/cloudpipe.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/console.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/coverage.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/defaultsecuritygroup.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/diagnostics.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/extraspecs.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/fixedips.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/flavors.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/hosts.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/hypervisors.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/images.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/instanceactions.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/interfaces.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/keypairs.rb +20 -0
- data/lib/ropenstack/compute/v2/extensions/limits.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/migrations.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/networks.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/quotasets.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/securitygroups.rb +40 -0
- data/lib/ropenstack/compute/v2/extensions/servergroups.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/serverpassword.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/services.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/shelvedservers.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/usage.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/virtualinterfaces.rb +0 -0
- data/lib/ropenstack/compute/v2/extensions/volumes.rb +20 -0
- data/lib/ropenstack/compute/v3.rb +5 -0
- data/lib/ropenstack/database.rb +24 -0
- data/lib/ropenstack/database/v1.rb +113 -0
- data/lib/ropenstack/identity.rb +28 -0
- data/lib/ropenstack/identity/v2.rb +178 -0
- data/lib/ropenstack/identity/v3.rb +13 -0
- data/lib/ropenstack/image.rb +25 -0
- data/lib/ropenstack/image/v1.rb +107 -0
- data/lib/ropenstack/image/v2.rb +134 -0
- data/lib/ropenstack/networking.rb +160 -0
- data/lib/ropenstack/networking/v2.rb +5 -0
- data/lib/ropenstack/networking/v2/extensions.rb +9 -0
- data/lib/ropenstack/networking/v2/extensions/l3.rb +111 -0
- data/lib/ropenstack/networking/v2/extensions/lbaas.rb +5 -0
- data/lib/ropenstack/networking/v2/extensions/metering.rb +5 -0
- data/lib/ropenstack/networking/v2/extensions/quotas.rb +5 -0
- data/lib/ropenstack/networking/v2/extensions/securitygroups.rb +5 -0
- data/lib/ropenstack/objectStorage.rb +60 -0
- data/lib/ropenstack/orchestration.rb +23 -0
- data/lib/ropenstack/orchestration/v1.rb +162 -0
- data/lib/ropenstack/telemetry.rb +23 -0
- data/lib/ropenstack/telemetry/v2.rb +68 -0
- data/ropenstack.gemspec +13 -0
- metadata +112 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
module Ropenstack
|
|
2
|
+
=begin
|
|
3
|
+
* Name: Networking
|
|
4
|
+
* Description: An implementation of the Networking V2.0 API Client in Ruby
|
|
5
|
+
* Authors: Sam 'Tehsmash' Betts, John Davidge
|
|
6
|
+
* Date: 01/15/2013
|
|
7
|
+
=end
|
|
8
|
+
class Networking < OpenstackService
|
|
9
|
+
require 'ropenstack/networking/v2'
|
|
10
|
+
|
|
11
|
+
## Extensions
|
|
12
|
+
include Version2::Extensions::L3
|
|
13
|
+
include Version2::Extensions::LBaaS
|
|
14
|
+
include Version2::Extensions::Metering
|
|
15
|
+
include Version2::Extensions::Quotas
|
|
16
|
+
include Version2::Extensions::SecurityGroups
|
|
17
|
+
|
|
18
|
+
## Networks
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Get a list of a tenants networks
|
|
22
|
+
#
|
|
23
|
+
# :call-seq:
|
|
24
|
+
# networks(id) => A single network with the id matching the parameter
|
|
25
|
+
# networks => All networks visible to the tenant making the request
|
|
26
|
+
##
|
|
27
|
+
def networks(id = nil)
|
|
28
|
+
endpoint = "networks"
|
|
29
|
+
unless id.nil?
|
|
30
|
+
endpoint = endpoint + "/" + id
|
|
31
|
+
end
|
|
32
|
+
return get_request(address(endpoint), @token)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
# Create a new network on Openstack given a name and tenant id.
|
|
37
|
+
##
|
|
38
|
+
def create_network(name, tenant, admin_state_up = true)
|
|
39
|
+
data = {
|
|
40
|
+
'network' => {
|
|
41
|
+
'name' => name,
|
|
42
|
+
'tenant_id' => tenant,
|
|
43
|
+
'admin_state_up' => admin_state_up
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return post_request(address("networks"), data, @token)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
# Delete a network given a network id.
|
|
51
|
+
##
|
|
52
|
+
def delete_network(network)
|
|
53
|
+
return delete_request(address("networks/" + network), @token)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
## Subnets
|
|
57
|
+
|
|
58
|
+
##
|
|
59
|
+
# Get a list of subnets
|
|
60
|
+
##
|
|
61
|
+
def subnets
|
|
62
|
+
return get_request(address("subnets"), @token)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Create a new ipv4 subnet in a network, given a network id, and
|
|
67
|
+
# a IP range in CIDR format.
|
|
68
|
+
##
|
|
69
|
+
def create_subnet(network, cidr)
|
|
70
|
+
data = {
|
|
71
|
+
'subnet' => {
|
|
72
|
+
'network_id' => network,
|
|
73
|
+
'ip_version' => 4,
|
|
74
|
+
'cidr' => cidr
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return post_request(address("subnets"), data, @token)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Delete a subnet given a subnet id
|
|
82
|
+
##
|
|
83
|
+
def delete_subnet(subnet)
|
|
84
|
+
return delete_request(address("subnets/" + subnet), @token)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
## Ports
|
|
88
|
+
|
|
89
|
+
##
|
|
90
|
+
# Get a list of ports
|
|
91
|
+
##
|
|
92
|
+
def ports
|
|
93
|
+
return get_request(address("ports"), @token)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
##
|
|
97
|
+
# Get a list of ports specific to a device_id
|
|
98
|
+
##
|
|
99
|
+
def device_ports(device_id)
|
|
100
|
+
return get_request(address("ports?device_id=#{device_id}"), @token)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
##
|
|
104
|
+
# Create a new port given network and device ids, optional
|
|
105
|
+
# parameter subnet id allows for scoping the port to a single subnet.
|
|
106
|
+
##
|
|
107
|
+
def create_port(network, subnet = nil, device = nil, device_owner = nil)
|
|
108
|
+
data = {
|
|
109
|
+
'port' => {
|
|
110
|
+
'network_id' => network,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
unless device_owner.nil?
|
|
114
|
+
data['port']['device_owner'] = device_owner
|
|
115
|
+
end
|
|
116
|
+
unless device.nil?
|
|
117
|
+
data['port']['device_id'] = device
|
|
118
|
+
end
|
|
119
|
+
unless subnet.nil?
|
|
120
|
+
data['port']['fixed_ips'] = [{'subnet_id' => subnet}]
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
puts data
|
|
124
|
+
|
|
125
|
+
return post_request(address("ports"), data, @token)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
##
|
|
129
|
+
# Update a specific ports fixed_ips, including subnet and ip data.
|
|
130
|
+
##
|
|
131
|
+
def update_port(port, fixed_ips)
|
|
132
|
+
data = { 'port' => { 'fixed_ips' => fixed_ips } }
|
|
133
|
+
return put_request(address("ports/"+port), data, @token)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
##
|
|
137
|
+
# Weird function for adding a port to multiple subnets if nessessary.
|
|
138
|
+
##
|
|
139
|
+
def move_port_to_subnets(port_id, subnet_ids)
|
|
140
|
+
id_list = Array.new()
|
|
141
|
+
subnet_ids.each do |id|
|
|
142
|
+
id_list << { "subnet_id" => id }
|
|
143
|
+
end
|
|
144
|
+
return update_port(port_id, id_list)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
##
|
|
148
|
+
# Delete a port given a port id.
|
|
149
|
+
##
|
|
150
|
+
def delete_port(port)
|
|
151
|
+
return delete_request(address("ports/" + port), @token)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
private
|
|
155
|
+
|
|
156
|
+
def address(endpoint)
|
|
157
|
+
super("/v2.0/#{endpoint}")
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module Ropenstack
|
|
2
|
+
module Networking::Version2::Extensions
|
|
3
|
+
require 'ropenstack/networking/v2/extensions/l3'
|
|
4
|
+
require 'ropenstack/networking/v2/extensions/lbaas'
|
|
5
|
+
require 'ropenstack/networking/v2/extensions/metering'
|
|
6
|
+
require 'ropenstack/networking/v2/extensions/quotas'
|
|
7
|
+
require 'ropenstack/networking/v2/extensions/securitygroups'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
module Ropenstack::Networking::Version2::Extensions
|
|
2
|
+
module L3
|
|
3
|
+
##
|
|
4
|
+
# Get a list of a tenants routers
|
|
5
|
+
#
|
|
6
|
+
# :call-seq:
|
|
7
|
+
# routers(id) => A single router with the id matching the parameter
|
|
8
|
+
# routers => All routers visible to the tenant making the request
|
|
9
|
+
##
|
|
10
|
+
def routers(id = nil)
|
|
11
|
+
endpoint = "routers"
|
|
12
|
+
unless id.nil?
|
|
13
|
+
endpoint = endpoint + "/" + id
|
|
14
|
+
end
|
|
15
|
+
return get_request(address(endpoint), @token)
|
|
16
|
+
end
|
|
17
|
+
##
|
|
18
|
+
# Create a new router with a given name.
|
|
19
|
+
##
|
|
20
|
+
def create_router(name, admin_state_up = true)
|
|
21
|
+
data = {
|
|
22
|
+
'router' =>{
|
|
23
|
+
'name' => name,
|
|
24
|
+
'admin_state_up' => admin_state_up,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return post_request(address("routers"), data, @token)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
##
|
|
31
|
+
# Delete a router given a routers id.
|
|
32
|
+
##
|
|
33
|
+
def delete_router(router)
|
|
34
|
+
return delete_request(address("routers/" + router), @token)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# Connect a router to a subnet, given router id and subnet id.
|
|
39
|
+
##
|
|
40
|
+
def add_router_interface(router, subnet)
|
|
41
|
+
data = { 'subnet_id' => subnet }
|
|
42
|
+
return put_request(address("routers/"+router+"/add_router_interface"), data, @token)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Delete a connection between a subnet and router given either port
|
|
47
|
+
# or subnet ids.
|
|
48
|
+
#
|
|
49
|
+
# :call-seq:
|
|
50
|
+
# delete_router_interface(router_id, subnet_id, "subnet")
|
|
51
|
+
# delete_router_interface(router_id, port_id, "port")
|
|
52
|
+
##
|
|
53
|
+
def delete_router_interface(router, id, type)
|
|
54
|
+
data = case type
|
|
55
|
+
when 'port' then { 'port_id' => id }
|
|
56
|
+
when 'subnet' then { 'subnet_id' => id }
|
|
57
|
+
else raise "Invalid Interface Type"
|
|
58
|
+
end
|
|
59
|
+
return put_request(address("routers/" + router + "/remove_router_interface"), data, @token)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# Enable external connectivity through this router by connecting it to
|
|
64
|
+
# an "external network"
|
|
65
|
+
##
|
|
66
|
+
def add_router_gateway(router, network_id)
|
|
67
|
+
data = { 'router' => {'external_gateway_info' => { 'network_id' => network_id }}}
|
|
68
|
+
return put_request(address("routers/"+router), data, @token)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
##
|
|
72
|
+
# Clear a routers external gateway information given a router id.
|
|
73
|
+
##
|
|
74
|
+
def delete_router_gateway(router)
|
|
75
|
+
data = { 'router' => {'external_gateway_info' => nil}}
|
|
76
|
+
return put_request(address('routers/' + router), data, @token)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
##
|
|
80
|
+
# Get a full list of floating ips for the tenant
|
|
81
|
+
##
|
|
82
|
+
def floating_ips
|
|
83
|
+
return get_request(address("floatingips"), @token)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def create_floating_ip(network, port = nil)
|
|
87
|
+
data = {
|
|
88
|
+
'floatingip' => {
|
|
89
|
+
'floating_network_id' => network
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
unless port.nil?
|
|
93
|
+
data['floatingip']['port_id'] = port
|
|
94
|
+
end
|
|
95
|
+
return post_request(address('floatingips'), data, @token)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def delete_floating_ip(id)
|
|
99
|
+
return delete_request(address("floatingips/#{id}"), @token)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def update_floating_ip(id, port)
|
|
103
|
+
data = {
|
|
104
|
+
'floatingip' => {
|
|
105
|
+
'port_id' => port
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return put_request(address("floatingips/#{id}"), data, @token)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Ropenstack
|
|
2
|
+
##
|
|
3
|
+
# * Name: ObjectStorage
|
|
4
|
+
# * Description: Implementation of the Block Storage API Client in Ruby.
|
|
5
|
+
# * Author: Sam 'Tehsmash' Betts
|
|
6
|
+
# * Date: 01/15/2013
|
|
7
|
+
##
|
|
8
|
+
class ObjectStorage < OpenstackService
|
|
9
|
+
## Accounts
|
|
10
|
+
def account(id, head)
|
|
11
|
+
if head
|
|
12
|
+
get_request(address(id), @token)
|
|
13
|
+
else
|
|
14
|
+
head_request(address(id), @token)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def create_account()
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
## Containers
|
|
22
|
+
def container(account, container, head)
|
|
23
|
+
if head
|
|
24
|
+
get_request(address(account + "/" + container), @token)
|
|
25
|
+
else
|
|
26
|
+
head_request(address(account + "/" + container), @token)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def create_container(account, container)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete_container(account, container)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update_container(account, container)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
## Objects
|
|
40
|
+
def object(account, container, object)
|
|
41
|
+
get_request(address(account + "/" + container + "/" + object), @token)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def object_metadata(account, container, object)
|
|
45
|
+
head_request(address(account + "/" + container + "/" + object), @token)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def create_object(account, container, object)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def copy_object(account, container, object)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def delete_object(account, container, object)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def create_object_metadata(account, container, object)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'ropenstack/common/rest'
|
|
2
|
+
|
|
3
|
+
module Ropenstack
|
|
4
|
+
##
|
|
5
|
+
# * Name: Orchestration
|
|
6
|
+
# * Description: Implementation of the Orchestration API Client in Ruby
|
|
7
|
+
# * Author: Sam 'Tehsmash' Betts, John Davidge
|
|
8
|
+
# * Date: 30/06/2014
|
|
9
|
+
##
|
|
10
|
+
class Orchestration < OpenstackService
|
|
11
|
+
# Pull in sub-modules
|
|
12
|
+
require 'ropenstack/orchestration/v1'
|
|
13
|
+
|
|
14
|
+
def intialize(location, token, type)
|
|
15
|
+
super(location, token)
|
|
16
|
+
case type
|
|
17
|
+
when "orchestration" then extend Version1
|
|
18
|
+
else
|
|
19
|
+
raise Ropenstack::RopenstackError, "Invalid type passed to Orchestration"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
module Ropenstack
|
|
2
|
+
##
|
|
3
|
+
# * Name: OrchestrationVersion1
|
|
4
|
+
# * Description: Implementation of the Orchestration V1.0 API Client in Ruby
|
|
5
|
+
# * Author: Sam 'Tehsmash' Betts, John Davidge
|
|
6
|
+
# * Date: 30/06/2014
|
|
7
|
+
##
|
|
8
|
+
module Orchestration::Version1
|
|
9
|
+
def stacks(name, id)
|
|
10
|
+
if name.nil?
|
|
11
|
+
get_request(address("/stacks"), @token)
|
|
12
|
+
elsif id.nil?
|
|
13
|
+
get_request(address("/stacks/"+name), @token)
|
|
14
|
+
else
|
|
15
|
+
get_request(address("/stacks/"+name+"/"+id), @token)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def stack_create(name, template, isURL, environmment, files, parameters, timeout, disable, adoptData, preview)
|
|
20
|
+
data = {
|
|
21
|
+
:stack_name => name,
|
|
22
|
+
:environment => environment,
|
|
23
|
+
:timeout_mins => timeout,
|
|
24
|
+
:files => files,
|
|
25
|
+
:parameters => parameters,
|
|
26
|
+
:disable => disable
|
|
27
|
+
}
|
|
28
|
+
if isURL
|
|
29
|
+
data[:template_url] = template
|
|
30
|
+
else
|
|
31
|
+
data[:template] = template
|
|
32
|
+
end
|
|
33
|
+
unless adoptData.nil?
|
|
34
|
+
data[:adopt_stack_data] = adoptData
|
|
35
|
+
end
|
|
36
|
+
post_request(address("/stacks"), data, @token)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def stack_update(name, id)
|
|
40
|
+
put_request(address("/stack/"+name+"/"+id+"/action"), {:resume => nil}, @token)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def stack_delete(name, id)
|
|
44
|
+
delete_request(address("/stack/"+name+"/"+id), @token)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def stack_adandon(name, id, preview)
|
|
48
|
+
if preview
|
|
49
|
+
get_request(address("/stack/" + name + "/"+ id + "/abandon"), @token)
|
|
50
|
+
else
|
|
51
|
+
delete_request(address("/stack/" + name + "/"+ id + "/abandon"), @token)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def stack_action(name, id, action)
|
|
56
|
+
case action
|
|
57
|
+
when "SUSPEND"
|
|
58
|
+
post_request(address("/stack/"+name+"/"+id+"/action"), {:suspend => nil}, @token)
|
|
59
|
+
when "RESUME"
|
|
60
|
+
post_request(address("/stack/"+name+"/"+id+"/action"), {:resume => nil}, @token)
|
|
61
|
+
else
|
|
62
|
+
raise Ropenstack::RopenstackError, "Invalid Action Passed"
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def resources(stack, id = nil, name = nil, meta = false)
|
|
67
|
+
if id.nil?
|
|
68
|
+
get_request(address("/stacks/"+stack+"/resources"), @token)
|
|
69
|
+
elsif name.nil?
|
|
70
|
+
get_request(address("/stacks/"+stack+"/"+id+"/resources"), @token)
|
|
71
|
+
else
|
|
72
|
+
if meta
|
|
73
|
+
get_request(address("/stacks/"+stack+"/"+id+"/resources/"+name+"/metadata"), @token)
|
|
74
|
+
else
|
|
75
|
+
get_request(address("/stacks/"+stack+"/"+id+"/resources/"+name), @token)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def resource_types(name = nil)
|
|
81
|
+
if name.nil?
|
|
82
|
+
get_request(address("/resource_types"), @token)
|
|
83
|
+
else
|
|
84
|
+
get_request(address("/resource_types/"+name), @token)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def resource_type_template(name)
|
|
89
|
+
get_request(address("/resource_types/"+name+"/template"), @token)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def events(stack, id = nil, resource = nil, event = nil)
|
|
93
|
+
if id.nil?
|
|
94
|
+
get_request(address("/stacks/"+stack+"/events"), @token)
|
|
95
|
+
elsif resource.nil?
|
|
96
|
+
get_request(address("/stacks/"+stack+"/"+id+"/events"), @token)
|
|
97
|
+
elsif event.nil?
|
|
98
|
+
get_request(address("/stacks/"+stack+"/"+id+"/resources/"+resource+"/events"), @token)
|
|
99
|
+
else
|
|
100
|
+
get_request(address("/stacks/"+stack+"/"+id+"/resources/"+resource+"/events/"+event), @token)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def stack_template(name, id)
|
|
105
|
+
get_request(address("/stacks/" + name + "/" + id), @token)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def validate_template(template, isURL)
|
|
109
|
+
data = {}
|
|
110
|
+
if isURL
|
|
111
|
+
data[:template_url] = template
|
|
112
|
+
else
|
|
113
|
+
data[:template] = template
|
|
114
|
+
end
|
|
115
|
+
post_request(address("/validate"), data, @token)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def build_info
|
|
119
|
+
get_request(address("/build_info"), @token)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def software_configs(id)
|
|
123
|
+
get_request(address("/software_configs/" + id), @token)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# TODO
|
|
127
|
+
def create_software_config
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def delete_software_config(id)
|
|
131
|
+
delete_request(address("/software_configs/" + id), @token)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def software_deployments(id = nil)
|
|
135
|
+
if id.nil?
|
|
136
|
+
get_request(address("/software_deployments"), @token)
|
|
137
|
+
else
|
|
138
|
+
get_request(address("/software_deployments/" + id), @token)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def server_software_deployment(server)
|
|
143
|
+
get_request(address("/software_deployments/metadata/"+server), @token)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# TODO
|
|
147
|
+
def create_software_deployment
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# TODO
|
|
151
|
+
def update_software_deployment(id)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def delete_software_deployment(id)
|
|
155
|
+
delete_request(address("/software_deployments/" + id), @token)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def version
|
|
159
|
+
"V1"
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|