fog-softlayer 0.3.9 → 0.3.10
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +7 -0
- data/examples/global_ip_address.md +169 -0
- data/fog-softlayer.gemspec +1 -1
- data/lib/fog/softlayer/models/network/ip.rb +43 -8
- data/lib/fog/softlayer/models/network/ips.rb +40 -3
- data/lib/fog/softlayer/network.rb +64 -15
- data/lib/fog/softlayer/requests/network/delete_global_ip_address.rb +30 -0
- data/lib/fog/softlayer/requests/network/get_global_ip_address.rb +28 -0
- data/lib/fog/softlayer/requests/network/get_global_ip_records.rb +28 -0
- data/lib/fog/softlayer/requests/network/get_ip_address.rb +2 -2
- data/lib/fog/softlayer/requests/network/get_ip_addresses.rb +28 -0
- data/lib/fog/softlayer/requests/network/route_global_ip.rb +28 -0
- data/lib/fog/softlayer/requests/network/unroute_global_ip.rb +28 -0
- data/lib/fog/softlayer/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjk1ZTE3NWIzYTg1NjA2ZjhlNGEzNjA3ZGYzYjE5YWU1OTg5ZGEwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjQ0YjRhZGYwNDQ5NjI0ZGQxZWQwZDJiMjA4YjYxNmQ3MWZhOWU5MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDU0NzA2ZjAxNjVlNWYwMWM1YWMwZDAyMGRmMzNmZjdhY2NlYmU3Y2E5Mjlj
|
10
|
+
OWQ4OTc2M2M3MGY0NDEzZjU1NjEzZjdiMDU0MGM3NTQ1MTlhYjg1NDA1M2M4
|
11
|
+
NmJiNGRhOTRkYWViMzY0OWM4Njk3Nzg4YjdmNTczNjVhMThjMTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzMyODY1MWVmNjU3ZjcyYzJkN2IzMWM0ZGE3NzVlMWFmMzJlZmM2ZDgzYWE5
|
14
|
+
YzM0YWEyZjhmZGY4ZTVjZjRjMzVmNTFhYjg4MTBlMjk4Zjk5OGFjNzZjYjMz
|
15
|
+
YzMzNDg2ZGFkZjk4OTA3OTkzY2YxNTg2Yzg1ZDI1NGE0MGQzMzI=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.3.10 2014-07-22
|
2
|
+
* Added support for Global IP addresses
|
3
|
+
* Create.
|
4
|
+
* Destroy.
|
5
|
+
* Route.
|
6
|
+
* Unroute.
|
7
|
+
|
1
8
|
## 0.3.7 2014-07-11
|
2
9
|
* Added support for ssh key pairs.
|
3
10
|
* See [key_pairs.md](https://github.com/fog/fog-softlayer/blob/master/examples/key_pairs.md) for details.
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#### Global IP Address examples
|
2
|
+
|
3
|
+
These examples all assume you have `~/.fog` which contains the following:
|
4
|
+
|
5
|
+
|
6
|
+
```yaml
|
7
|
+
default:
|
8
|
+
softlayer_username: example-username
|
9
|
+
softlayer_api_key: 1a1a1a1a1a1a1a1a1a11a1a1a1a1a1a1a1a1a1
|
10
|
+
```
|
11
|
+
|
12
|
+
##### Create a connection to SoftLayer network
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'fog/softlayer'
|
16
|
+
@sl = Fog::Network[:softlayer]
|
17
|
+
```
|
18
|
+
|
19
|
+
Global IP addresses are accessed through the `Fog::Network::Softlayer::Ip` model. Unlike "normal" IP addresses they can be specifically created and destroyed (non-global IP addresses are created/destroyed via a subnet).
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
global_ips = @network.ips.select { |ip| ip.global? }
|
23
|
+
# => [ <Fog::Network::Softlayer::Ip
|
24
|
+
# id=123456789,
|
25
|
+
# subnet_id=123456,
|
26
|
+
# address="203.0.113.5",
|
27
|
+
# broadcast=false,
|
28
|
+
# gateway=false,
|
29
|
+
# network=false,
|
30
|
+
# reserved=false,
|
31
|
+
# global_id=1234,
|
32
|
+
# destination_ip=nil,
|
33
|
+
# note=nil,
|
34
|
+
# assigned_to=nil
|
35
|
+
# >,
|
36
|
+
# <Fog::Network::Softlayer::Ip
|
37
|
+
# id=123456790,
|
38
|
+
# subnet_id=123457,
|
39
|
+
# address="203.0.113.6",
|
40
|
+
# broadcast=false,
|
41
|
+
# gateway=false,
|
42
|
+
# network=false,
|
43
|
+
# reserved=false,
|
44
|
+
# global_id=1235,
|
45
|
+
# destination_ip= <Fog::Network::Softlayer::Ip
|
46
|
+
# id=123458,
|
47
|
+
# subnet_id=123456,
|
48
|
+
# address="203.0.113.7",
|
49
|
+
# broadcast=false,
|
50
|
+
# gateway=false,
|
51
|
+
# network=false,
|
52
|
+
# reserved=false,
|
53
|
+
# global_id=nil,
|
54
|
+
# destination_ip=nil,
|
55
|
+
# note=nil,
|
56
|
+
# assigned_to=nil
|
57
|
+
# >,
|
58
|
+
# note=nil,
|
59
|
+
# assigned_to=nil
|
60
|
+
# >
|
61
|
+
# ]
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
Route an unrouted global IP to a specific server:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
global_ip = @network.ips.select { |ip| ip.global? && !ip.routed? }.first
|
71
|
+
# => <Fog::Network::Softlayer::Ip
|
72
|
+
# id=123456789,
|
73
|
+
# subnet_id=123456,
|
74
|
+
# address="203.0.113.5",
|
75
|
+
# broadcast=false,
|
76
|
+
# gateway=false,
|
77
|
+
# network=false,
|
78
|
+
# reserved=false,
|
79
|
+
# global_id=1234,
|
80
|
+
# destination_ip=nil,
|
81
|
+
# note=nil,
|
82
|
+
# assigned_to=nil
|
83
|
+
# >
|
84
|
+
global_ip.routed? # => false
|
85
|
+
|
86
|
+
|
87
|
+
@compute = Fog::Compute[:softlayer]
|
88
|
+
dest_server = @compute.servers.tagged_with(['production', 'frontend', 'hkg']).first # => <Fog::Compute::Softlayer::Server>
|
89
|
+
dest_ip = @network.ips.by_address(dest_server.public_ip) # => <Fog::Network::Softlayer::Ip>
|
90
|
+
|
91
|
+
|
92
|
+
global_ip.route(dest_ip) # => true
|
93
|
+
|
94
|
+
global_ip.reload
|
95
|
+
# => <Fog::Network::Softlayer::Ip
|
96
|
+
# id=123456789,
|
97
|
+
# subnet_id=123456,
|
98
|
+
# address="203.0.113.5",
|
99
|
+
# broadcast=false,
|
100
|
+
# gateway=false,
|
101
|
+
# network=false,
|
102
|
+
# reserved=false,
|
103
|
+
# global_id=1234,
|
104
|
+
# destination_ip= <Fog::Network::Softlayer::Ip
|
105
|
+
# id=123458,
|
106
|
+
# subnet_id=123456,
|
107
|
+
# address="203.0.113.8",
|
108
|
+
# broadcast=false,
|
109
|
+
# gateway=false,
|
110
|
+
# network=false,
|
111
|
+
# reserved=false,
|
112
|
+
# global_id=nil,
|
113
|
+
# destination_ip=nil,
|
114
|
+
# note=nil,
|
115
|
+
# assigned_to=nil
|
116
|
+
# >,
|
117
|
+
# note=nil,
|
118
|
+
# assigned_to=nil
|
119
|
+
# >
|
120
|
+
|
121
|
+
global_ip.routed?
|
122
|
+
# => true
|
123
|
+
```
|
124
|
+
|
125
|
+
That same address to a different server:
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
global_ip = @network.ips.by_address('203.0.113.5')
|
129
|
+
global_ip.destination.address # => 203.0.113.8
|
130
|
+
|
131
|
+
london_server = @compute.servers.tagged_with(['production', 'frontend', 'lon']).first # => <Fog::Compute::Softlayer::Server>
|
132
|
+
dest_ip = @network.ips.by_address(london_server.public_ip) # => <Fog::Network::Softlayer::Ip>
|
133
|
+
|
134
|
+
global_ip.route(dest_ip) # => true
|
135
|
+
global_ip.reload # => <Fog::Network::Softlayer::Ip>
|
136
|
+
global_ip.destination.address # => 203.0.113.9
|
137
|
+
```
|
138
|
+
|
139
|
+
Unroute the same address:
|
140
|
+
```ruby
|
141
|
+
global_ip = @network.ips.by_address('203.0.113.5')
|
142
|
+
global_ip.routed? # => true
|
143
|
+
|
144
|
+
global_ip.unroute # => true
|
145
|
+
global_ip.reload # => <Fog::Network::Softlayer::Ip>
|
146
|
+
|
147
|
+
global_ip.routed? # => false
|
148
|
+
```
|
149
|
+
|
150
|
+
Create new IPv4:
|
151
|
+
*Note:* these methods are blocking and can take several seconds to respond.
|
152
|
+
```ruby
|
153
|
+
@network.create_new_global_ipv4 # => <Fog::Network::Softlayer::Ip>
|
154
|
+
```
|
155
|
+
|
156
|
+
Create new IPv6:
|
157
|
+
```ruby
|
158
|
+
@network.create_new_global_ipv6 # => <Fog::Network::Softlayer::Ip>
|
159
|
+
```
|
160
|
+
|
161
|
+
Destroy a global IP address:
|
162
|
+
```ruby
|
163
|
+
ip = @network.ips.by_address('203.0.113.5')
|
164
|
+
ip.global? # => true
|
165
|
+
ip.destroy # => true
|
166
|
+
```
|
167
|
+
|
168
|
+
|
169
|
+
|
data/fog-softlayer.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = %q{Module for the 'fog' gem to support SoftLayer Cloud}
|
13
13
|
spec.summary = %q{This library can be used as a module for `fog` or as standalone provider
|
14
14
|
to use the SoftLayer Cloud in applications}
|
15
|
-
spec.homepage = "https://github.com/
|
15
|
+
spec.homepage = "https://github.com/fog/fog-softlayer"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
@@ -13,12 +13,14 @@ module Fog
|
|
13
13
|
class Ip < Fog::Model
|
14
14
|
identity :id
|
15
15
|
|
16
|
-
attribute :subnet_id,
|
17
|
-
attribute :address,
|
16
|
+
attribute :subnet_id, :aliases => 'subnetId'
|
17
|
+
attribute :address, :aliases => 'ipAddress'
|
18
18
|
attribute :broadcast, :aliases => 'isBroadcast'
|
19
19
|
attribute :gateway, :aliases => 'isGateway'
|
20
20
|
attribute :network, :aliases => 'isNetwork'
|
21
21
|
attribute :reserved, :aliases => 'isReserved'
|
22
|
+
attribute :global_id
|
23
|
+
attribute :destination_ip, :aliases => 'destinationIpAddress'
|
22
24
|
attribute :note
|
23
25
|
attribute :assigned_to, :aliases => ['hardware', 'virtualGuest']
|
24
26
|
|
@@ -40,25 +42,58 @@ module Fog
|
|
40
42
|
self
|
41
43
|
end
|
42
44
|
|
45
|
+
def destination_ip=(ip)
|
46
|
+
if ip.is_a?(Hash)
|
47
|
+
attributes[:destination_ip] = Fog::Network::Softlayer::Ip.new(ip)
|
48
|
+
elsif ip.is_a?(Fog::Network::Softlayer::Ip) or ip.nil?
|
49
|
+
attributes[:destination_ip] = ip
|
50
|
+
else
|
51
|
+
raise ArgumentError, "Invalid argument type in #{self.class.name}##{__method__}."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
43
55
|
def destroy
|
44
|
-
|
45
|
-
|
56
|
+
raise "Only Global IP Addresses can be destroyed. Regular IP Addresses are part of Fog::Softlayer::Network::Subnet" unless global?
|
57
|
+
service.delete_global_ip_address(self.global_id).status == 200
|
46
58
|
end
|
47
59
|
|
48
60
|
def broadcast?
|
49
|
-
|
61
|
+
!!attributes[:broadcast]
|
50
62
|
end
|
51
63
|
|
52
64
|
def gateway?
|
53
|
-
|
65
|
+
!!attributes[:gateway]
|
66
|
+
end
|
67
|
+
|
68
|
+
def global?
|
69
|
+
!!attributes[:global_id]
|
54
70
|
end
|
55
71
|
|
56
72
|
def network?
|
57
|
-
|
73
|
+
!!attributes[:network]
|
58
74
|
end
|
59
75
|
|
60
76
|
def reserved?
|
61
|
-
|
77
|
+
!!attributes[:reserved]
|
78
|
+
end
|
79
|
+
|
80
|
+
def route(dest_ip)
|
81
|
+
requires :global_id
|
82
|
+
raise ArgumentError, "Invalid argument type in #{self.class.name}##{__method__}." unless dest_ip.is_a?(Fog::Network::Softlayer::Ip)
|
83
|
+
raise ArgumentError, "The destination IP may not be the network address of the destination subnet" if dest_ip.network?
|
84
|
+
raise ArgumentError, "The destination IP may not be the gateway address of the destination subnet" if dest_ip.gateway?
|
85
|
+
raise ArgumentError, "The destination IP may not be the broadcast address of the destination subnet" if dest_ip.broadcast?
|
86
|
+
raise ArgumentError, "The destination IP may not be another global IP address" if dest_ip.global?
|
87
|
+
service.route_global_ip(self.global_id, dest_ip.address).status == 200
|
88
|
+
end
|
89
|
+
|
90
|
+
def routed?
|
91
|
+
!!self.assigned_to or !!self.destination_ip
|
92
|
+
end
|
93
|
+
|
94
|
+
def unroute
|
95
|
+
requires :global_id
|
96
|
+
service.unroute_global_ip(self.global_id).status == 200
|
62
97
|
end
|
63
98
|
|
64
99
|
end
|
@@ -23,16 +23,53 @@ module Fog
|
|
23
23
|
|
24
24
|
def all(filters = filters)
|
25
25
|
self.filters = filters
|
26
|
-
|
26
|
+
ips = service.get_ip_addresses.body
|
27
|
+
|
28
|
+
ips.each_with_index do |ip,i|
|
29
|
+
if global_records.keys.include?(ip['id'])
|
30
|
+
ips[i] = parse_global_ip_record(service.get_global_ip_address(global_records[ip['id']]['id']).body)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
load(ips)
|
35
|
+
end
|
36
|
+
|
37
|
+
def by_address(address)
|
38
|
+
ip = service.get_ip_addresses.body.select do |ip|
|
39
|
+
ip['ipAddress'] == address
|
40
|
+
end.first
|
41
|
+
new(ip) if ip
|
27
42
|
end
|
28
43
|
|
29
44
|
def get(id)
|
30
|
-
if
|
31
|
-
|
45
|
+
if global_records.keys.include?(id)
|
46
|
+
response = service.get_global_ip_address(global_records[id]['id']).body
|
47
|
+
ip = parse_global_ip_record(response)
|
48
|
+
else
|
49
|
+
ip = service.get_ip_address(id).body
|
32
50
|
end
|
51
|
+
|
52
|
+
new(ip) if ip
|
53
|
+
|
33
54
|
rescue Fog::Network::Softlayer::NotFound
|
34
55
|
nil
|
35
56
|
end
|
57
|
+
|
58
|
+
def global_records
|
59
|
+
@records ||= {}
|
60
|
+
service.get_global_ip_records.body.each { |record| @records[record['ipAddressId']] = record } if @records.empty?
|
61
|
+
@records
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def parse_global_ip_record(record)
|
67
|
+
response = service.request(:network_subnet_ipaddress_global, record['id'], :query => 'objectMask=mask[ipAddress,destinationIpAddress]').body
|
68
|
+
parsed = response['ipAddress']
|
69
|
+
parsed['destinationIpAddress'] = response['destinationIpAddress']
|
70
|
+
parsed[:global_id] = record['id']
|
71
|
+
parsed
|
72
|
+
end
|
36
73
|
end
|
37
74
|
end
|
38
75
|
end
|
@@ -41,7 +41,6 @@ module Fog
|
|
41
41
|
request :create_network
|
42
42
|
request :delete_network
|
43
43
|
request :get_network
|
44
|
-
#request :update_network
|
45
44
|
|
46
45
|
request :get_private_vlan_price_code
|
47
46
|
request :get_public_vlan_price_code
|
@@ -56,24 +55,16 @@ module Fog
|
|
56
55
|
request :delete_network_tags
|
57
56
|
request :get_network_tags
|
58
57
|
|
59
|
-
#request :list_ports
|
60
|
-
#request :create_port
|
61
|
-
#request :delete_port
|
62
|
-
#request :get_port
|
63
|
-
#request :update_port
|
64
|
-
|
65
58
|
request :list_subnets
|
66
|
-
#request :create_subnet
|
67
|
-
#request :delete_subnet
|
68
59
|
request :get_subnet
|
69
|
-
#request :update_subnet
|
70
60
|
|
71
|
-
#request :list_ip_addresses
|
72
|
-
#request :create_ip_addresse
|
73
|
-
#request :delete_ip_addresse
|
74
61
|
request :get_ip_address
|
75
|
-
|
76
|
-
|
62
|
+
request :get_global_ip_address
|
63
|
+
request :get_ip_addresses
|
64
|
+
request :get_global_ip_records
|
65
|
+
request :route_global_ip
|
66
|
+
request :unroute_global_ip
|
67
|
+
request :delete_global_ip_address
|
77
68
|
|
78
69
|
class Mock
|
79
70
|
#Fog::Mock.random_ip,
|
@@ -129,10 +120,68 @@ module Fog
|
|
129
120
|
Fog::Softlayer::Slapi.slapi_request(service, path, options)
|
130
121
|
end
|
131
122
|
|
123
|
+
def create_new_global_ipv4
|
124
|
+
order = {
|
125
|
+
"complexType" => 'SoftLayer_Container_Product_Order_Network_Subnet',
|
126
|
+
"packageId" => 0, # everything that's not a Server is package 0 when using placeOrder
|
127
|
+
"prices" => [{"id"=>global_ipv4_price_code}],
|
128
|
+
"quantity" => 1
|
129
|
+
}
|
130
|
+
request(:product_order, :place_order, :body => order, :http_method => :POST).status == 200
|
131
|
+
end
|
132
|
+
|
133
|
+
def create_new_global_ipv6
|
134
|
+
order = {
|
135
|
+
"complexType" => 'SoftLayer_Container_Product_Order_Network_Subnet',
|
136
|
+
"packageId" => 0, # everything that's not a Server is package 0 when using placeOrder
|
137
|
+
"prices" => [{"id"=>global_ipv6_price_code}],
|
138
|
+
"quantity" => 1
|
139
|
+
}
|
140
|
+
request(:product_order, :place_order, :body => order, :http_method => :POST).status == 200
|
141
|
+
end
|
142
|
+
|
132
143
|
def list_networks
|
133
144
|
self.list_networks
|
134
145
|
end
|
135
146
|
|
147
|
+
private
|
148
|
+
|
149
|
+
##
|
150
|
+
# Queries the SoftLayer API and returns the "category code" required for ordering a Global IPv4 address.
|
151
|
+
# @return [Integer]
|
152
|
+
def global_ipv4_cat_code
|
153
|
+
request(:product_package, '0/get_configuration', :query => 'objectMask=mask[isRequired,itemCategory]').body.map do |item|
|
154
|
+
item['itemCategory']['id'] if item['itemCategory']['categoryCode'] == 'global_ipv4'
|
155
|
+
end.compact.first
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Queries the SoftLayer API and returns the "category code" required for ordering a Global IPv4 address.
|
160
|
+
# @return [Integer]
|
161
|
+
def global_ipv6_cat_code
|
162
|
+
request(:product_package, '0/get_configuration', :query => 'objectMask=mask[isRequired,itemCategory]').body.map do |item|
|
163
|
+
item['itemCategory']['id'] if item['itemCategory']['categoryCode'] == 'global_ipv6'
|
164
|
+
end.compact.first
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Queries the SoftLayer API and returns the "price code" required for ordering a Global IPv4 address.
|
169
|
+
# @return [Integer]
|
170
|
+
def global_ipv4_price_code
|
171
|
+
request(:product_package, '0/get_item_prices', :query => 'objectMask=mask[id,item.description,categories.id]').body.map do |item|
|
172
|
+
item['id'] if item['categories'][0]['id'] == global_ipv4_cat_code
|
173
|
+
end.compact.first
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# Queries the SoftLayer API and returns the "price code" required for ordering a Global IPv4 address.
|
178
|
+
# @return [Integer]
|
179
|
+
def global_ipv6_price_code
|
180
|
+
request(:product_package, '0/get_item_prices', :query => 'objectMask=mask[id,item.description,categories.id]').body.map do |item|
|
181
|
+
item['id'] if item['categories'][0]['id'] == global_ipv6_cat_code
|
182
|
+
end.compact.first
|
183
|
+
end
|
184
|
+
|
136
185
|
end
|
137
186
|
end
|
138
187
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def delete_global_ip_address(id)
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def delete_global_ip_address(id)
|
23
|
+
billing = self.request(:network_subnet_ipaddress_global, "#{id}/get_billing_item").body
|
24
|
+
billing.nil? and raise "Global IP Address with ID #{id} not found."
|
25
|
+
request(:billing_item, "#{billing['id']}/cancel_service")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def get_global_ip_address(id)
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def get_global_ip_address(id)
|
23
|
+
self.request(:network_subnet_ipaddress_global, id, :query => 'objectMask=mask[ipAddress,destinationIpAddress]')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def get_global_ip_records
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def get_global_ip_records
|
23
|
+
self.request(:account, :get_global_ip_records)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -19,8 +19,8 @@ module Fog
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Real
|
22
|
-
def get_ip_address(
|
23
|
-
self.request(:network_subnet_IpAddress,
|
22
|
+
def get_ip_address(id)
|
23
|
+
self.request(:network_subnet_IpAddress, id, :query => 'objectMask=mask[hardware.fullyQualifiedDomainName,hardware.id,virtualGuest.id,virtualGuest.fullyQualifiedDomainName,subnet.id]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def get_ip_addresses
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def get_ip_addresses
|
23
|
+
self.request(:account, :get_ip_addresses, :query => 'objectMask=mask[hardware.fullyQualifiedDomainName,hardware.id,virtualGuest.id,virtualGuest.fullyQualifiedDomainName,subnet.id]')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def route_global_ip(global_ip, destination_ip)
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def route_global_ip(global_ip_id, destination_ip_address)
|
23
|
+
self.request(:network_subnet_ipaddress_global, "#{global_ip_id}/route", :body => destination_ip_address, :http_method => :post)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
+
# © Copyright IBM Corporation 2014.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
module Fog
|
9
|
+
module Network
|
10
|
+
class Softlayer
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
|
14
|
+
def unroute_global_ip(global_ip_id)
|
15
|
+
# TODO: Implement.
|
16
|
+
raise Fog::Errors::MockNotImplemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Real
|
22
|
+
def unroute_global_ip(global_ip_id)
|
23
|
+
self.request(:network_subnet_ipaddress_global, "#{global_ip_id}/unroute")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-softlayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Eldridge
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- docs/fog-softlayer-CLA.pdf
|
201
201
|
- examples/compute.md
|
202
202
|
- examples/dns.md
|
203
|
+
- examples/global_ip_address.md
|
203
204
|
- examples/key_pairs.md
|
204
205
|
- examples/network.md
|
205
206
|
- examples/storage.md
|
@@ -276,11 +277,15 @@ files:
|
|
276
277
|
- lib/fog/softlayer/requests/dns/update_record.rb
|
277
278
|
- lib/fog/softlayer/requests/network/create_network.rb
|
278
279
|
- lib/fog/softlayer/requests/network/create_network_tags.rb
|
280
|
+
- lib/fog/softlayer/requests/network/delete_global_ip_address.rb
|
279
281
|
- lib/fog/softlayer/requests/network/delete_network.rb
|
280
282
|
- lib/fog/softlayer/requests/network/delete_network_tags.rb
|
281
283
|
- lib/fog/softlayer/requests/network/get_datacenter_routers.rb
|
282
284
|
- lib/fog/softlayer/requests/network/get_datacenters.rb
|
285
|
+
- lib/fog/softlayer/requests/network/get_global_ip_address.rb
|
286
|
+
- lib/fog/softlayer/requests/network/get_global_ip_records.rb
|
283
287
|
- lib/fog/softlayer/requests/network/get_ip_address.rb
|
288
|
+
- lib/fog/softlayer/requests/network/get_ip_addresses.rb
|
284
289
|
- lib/fog/softlayer/requests/network/get_network.rb
|
285
290
|
- lib/fog/softlayer/requests/network/get_network_tags.rb
|
286
291
|
- lib/fog/softlayer/requests/network/get_private_vlan_price_code.rb
|
@@ -291,6 +296,8 @@ files:
|
|
291
296
|
- lib/fog/softlayer/requests/network/get_subnet_price_code.rb
|
292
297
|
- lib/fog/softlayer/requests/network/list_networks.rb
|
293
298
|
- lib/fog/softlayer/requests/network/list_subnets.rb
|
299
|
+
- lib/fog/softlayer/requests/network/route_global_ip.rb
|
300
|
+
- lib/fog/softlayer/requests/network/unroute_global_ip.rb
|
294
301
|
- lib/fog/softlayer/requests/storage/copy_object.rb
|
295
302
|
- lib/fog/softlayer/requests/storage/delete_container.rb
|
296
303
|
- lib/fog/softlayer/requests/storage/delete_multiple_objects.rb
|
@@ -350,7 +357,7 @@ files:
|
|
350
357
|
- tests/softlayer/requests/storage/auth_tests.rb
|
351
358
|
- tests/softlayer/requests/storage/container_tests.rb
|
352
359
|
- tests/softlayer/requests/storage/object_tests.rb
|
353
|
-
homepage: https://github.com/
|
360
|
+
homepage: https://github.com/fog/fog-softlayer
|
354
361
|
licenses:
|
355
362
|
- MIT
|
356
363
|
metadata: {}
|