fog-softlayer 0.4.2.pre → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CONTRIBUTORS.md +2 -0
- data/examples/compute.md +37 -1
- data/lib/fog/softlayer/compute.rb +8 -1
- data/lib/fog/softlayer/dns.rb +0 -1
- data/lib/fog/softlayer/ext/hash.rb +6 -0
- data/lib/fog/softlayer/ext/string.rb +20 -0
- data/lib/fog/softlayer/models/compute/flavor.rb +0 -2
- data/lib/fog/softlayer/models/compute/flavors.rb +0 -1
- data/lib/fog/softlayer/models/compute/image.rb +0 -2
- data/lib/fog/softlayer/models/compute/images.rb +0 -1
- data/lib/fog/softlayer/models/compute/key_pair.rb +0 -2
- data/lib/fog/softlayer/models/compute/key_pairs.rb +0 -1
- data/lib/fog/softlayer/models/compute/network_component.rb +0 -2
- data/lib/fog/softlayer/models/compute/network_components.rb +0 -1
- data/lib/fog/softlayer/models/compute/server.rb +10 -0
- data/lib/fog/softlayer/models/compute/servers.rb +25 -1
- data/lib/fog/softlayer/models/compute/tag.rb +0 -2
- data/lib/fog/softlayer/models/compute/tags.rb +0 -1
- data/lib/fog/softlayer/models/dns/domain.rb +1 -1
- data/lib/fog/softlayer/models/dns/domains.rb +1 -1
- data/lib/fog/softlayer/models/dns/record.rb +0 -1
- data/lib/fog/softlayer/models/dns/records.rb +1 -1
- data/lib/fog/softlayer/models/network/datacenter.rb +0 -2
- data/lib/fog/softlayer/models/network/datacenters.rb +0 -1
- data/lib/fog/softlayer/models/network/ip.rb +0 -2
- data/lib/fog/softlayer/models/network/ips.rb +0 -1
- data/lib/fog/softlayer/models/network/network.rb +0 -2
- data/lib/fog/softlayer/models/network/networks.rb +0 -1
- data/lib/fog/softlayer/models/network/subnet.rb +0 -2
- data/lib/fog/softlayer/models/network/subnets.rb +0 -1
- data/lib/fog/softlayer/models/network/tag.rb +0 -1
- data/lib/fog/softlayer/models/network/tags.rb +1 -1
- data/lib/fog/softlayer/models/product/item.rb +0 -1
- data/lib/fog/softlayer/models/product/items.rb +0 -1
- data/lib/fog/softlayer/models/product/package.rb +0 -1
- data/lib/fog/softlayer/models/product/packages.rb +0 -1
- data/lib/fog/softlayer/models/storage/directories.rb +0 -1
- data/lib/fog/softlayer/models/storage/directory.rb +0 -1
- data/lib/fog/softlayer/models/storage/file.rb +0 -2
- data/lib/fog/softlayer/models/storage/files.rb +0 -1
- data/lib/fog/softlayer/network.rb +0 -2
- data/lib/fog/softlayer/product.rb +0 -1
- data/lib/fog/softlayer/requests/compute/create_bare_metal_server.rb +1 -0
- data/lib/fog/softlayer/requests/compute/create_vms.rb +1 -0
- data/lib/fog/softlayer/requests/compute/get_bare_metal_active_tickets.rb +79 -0
- data/lib/fog/softlayer/requests/compute/get_bare_metal_create_options.rb +1116 -0
- data/lib/fog/softlayer/requests/compute/get_bare_metal_server_by_ip.rb +32 -0
- data/lib/fog/softlayer/requests/compute/get_bare_metal_users.rb +148 -0
- data/lib/fog/softlayer/requests/compute/get_virtual_guest_active_tickets.rb +79 -0
- data/lib/fog/softlayer/requests/compute/get_virtual_guest_by_ip.rb +32 -0
- data/lib/fog/softlayer/requests/compute/get_virtual_guest_create_options.rb +4060 -0
- data/lib/fog/softlayer/requests/compute/get_virtual_guest_users.rb +148 -0
- data/lib/fog/softlayer/slapi.rb +96 -0
- data/lib/fog/softlayer/storage.rb +1 -3
- data/lib/fog/softlayer/version.rb +1 -1
- data/lib/fog/softlayer.rb +69 -6
- data/tests/softlayer/requests/compute/bmc_tests.rb +38 -0
- data/tests/softlayer/requests/compute/vm_tests.rb +37 -0
- metadata +41 -32
- data/lib/fog/softlayer/core.rb +0 -176
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
module Fog
|
8
|
+
module Compute
|
9
|
+
class Softlayer
|
10
|
+
class Mock
|
11
|
+
def get_bare_metal_server_by_ip(ip_address)
|
12
|
+
response = Excon::Response.new
|
13
|
+
response.body = @bare_metal_servers.map {|vm| vm if vm['primaryIpAddress'] == ip_address.to_s }.compact.first || {}
|
14
|
+
response.status = response.body.empty? ? 404 : 200
|
15
|
+
if response.status == 404
|
16
|
+
response.body = {
|
17
|
+
"error"=>"Unable to find object with ip of '#{ip_address}'.",
|
18
|
+
"code"=>"SoftLayer_Exception_ObjectNotFound"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Real
|
26
|
+
def get_bare_metal_server_by_ip(ip_address)
|
27
|
+
request(:hardware_server, :findByIpAddress, :body => "#{ip_address}", :http_method => :POST, :query => 'objectMask=mask[datacenter,tagReferences,memory,provisionDate,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.softwareLicense.softwareDescription.referenceCode,sshKeys.id,privateNetworkOnlyFlag,userData,frontendNetworkComponents,backendNetworkComponents]')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
module Fog
|
8
|
+
module Compute
|
9
|
+
class Softlayer
|
10
|
+
class Mock
|
11
|
+
# Gets all Bare Metal users
|
12
|
+
# @param [Integer] id
|
13
|
+
# @return [Excon::Response]
|
14
|
+
def get_bare_metal_users(id)
|
15
|
+
response = Excon::Response.new
|
16
|
+
found = self.get_bare_metal_servers.body.map{|server| server['id']}.include?(id)
|
17
|
+
unless found
|
18
|
+
response.status = 404
|
19
|
+
response.body = {
|
20
|
+
"error" => "Unable to find object with id of '#{id}'.",
|
21
|
+
"code" => "SoftLayer_Exception_ObjectNotFound"
|
22
|
+
}
|
23
|
+
else
|
24
|
+
response.status = 200
|
25
|
+
response.body = get_users
|
26
|
+
end
|
27
|
+
response
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Real
|
32
|
+
def get_bare_metal_users(id)
|
33
|
+
request(:hardware_server, "#{id}/getUsers")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Fog
|
41
|
+
module Compute
|
42
|
+
class Softlayer
|
43
|
+
class Mock
|
44
|
+
def get_users
|
45
|
+
[
|
46
|
+
{
|
47
|
+
"accountId"=>000000,
|
48
|
+
"address1"=>"Your address",
|
49
|
+
"authenticationToken"=>
|
50
|
+
{
|
51
|
+
"hash"=>"06e849qqq25e5266753043484893344232",
|
52
|
+
"user"=>nil,
|
53
|
+
"userId"=>000000
|
54
|
+
},
|
55
|
+
"city"=>"Your City",
|
56
|
+
"companyName"=>"Your Company",
|
57
|
+
"country"=>"Your country",
|
58
|
+
"createDate"=>"2014-03-05T13:23:04-06:00",
|
59
|
+
"daylightSavingsTimeFlag"=>true,
|
60
|
+
"denyAllResourceAccessOnCreateFlag"=>false,
|
61
|
+
"displayName"=>"Your name",
|
62
|
+
"email"=>"youremail@example.com",
|
63
|
+
"firstName"=>"Your name",
|
64
|
+
"forumPasswordHash"=>"121kdsksdkvm323j4j3",
|
65
|
+
"id"=>000000,
|
66
|
+
"lastName"=>"Your last name",
|
67
|
+
"localeId"=>1,
|
68
|
+
"modifyDate"=>"2014-03-05T13:23:04-06:00",
|
69
|
+
"officePhone"=>"+55 00 111-111",
|
70
|
+
"parentId"=>nil,
|
71
|
+
"passwordExpireDate"=>nil,
|
72
|
+
"permissionSystemVersion"=>2,
|
73
|
+
"postalCode"=>"000000-000",
|
74
|
+
"pptpVpnAllowedFlag"=>false,
|
75
|
+
"savedId"=>"000000",
|
76
|
+
"secondaryLoginManagementFlag"=>nil,
|
77
|
+
"secondaryLoginRequiredFlag"=>nil,
|
78
|
+
"secondaryPasswordModifyDate"=>"2014-03-05T13:40:12-06:00",
|
79
|
+
"secondaryPasswordTimeoutDays"=>nil,
|
80
|
+
"sslVpnAllowedFlag"=>false,
|
81
|
+
"state"=>"OT",
|
82
|
+
"statusDate"=>"2014-03-05T13:23:04-06:00",
|
83
|
+
"timezoneId"=>114,
|
84
|
+
"userStatusId"=>1001,
|
85
|
+
"username"=>"Your username",
|
86
|
+
"vpnManualConfig"=>false,
|
87
|
+
"account"=>
|
88
|
+
{
|
89
|
+
"accountManagedResourcesFlag"=>false,
|
90
|
+
"accountStatusId"=>1001,
|
91
|
+
"address1"=>"Your address 1",
|
92
|
+
"address2"=>"Your address 2",
|
93
|
+
"allowedPptpVpnQuantity"=>1,
|
94
|
+
"brandId"=>2,
|
95
|
+
"city"=>"Your city",
|
96
|
+
"claimedTaxExemptTxFlag"=>false,
|
97
|
+
"companyName"=>"Your company",
|
98
|
+
"country"=>"Your country",
|
99
|
+
"createDate"=>"2014-03-05T13:23:04-06:00",
|
100
|
+
"email"=>"youremail@example.com",
|
101
|
+
"firstName"=>"Your name",
|
102
|
+
"id"=>000000,
|
103
|
+
"isReseller"=>1,
|
104
|
+
"lastName"=>"Your last name",
|
105
|
+
"lateFeeProtectionFlag"=>nil,
|
106
|
+
"modifyDate"=>"2014-04-29T15:22:55-05:00",
|
107
|
+
"officePhone"=>"+00 00 0000-0000",
|
108
|
+
"postalCode"=>"00000-000",
|
109
|
+
"state"=>"OT",
|
110
|
+
"statusDate"=>nil,
|
111
|
+
"masterUser"=>nil
|
112
|
+
},
|
113
|
+
"apiAuthenticationKeys"=>
|
114
|
+
[
|
115
|
+
{
|
116
|
+
"authenticationKey"=>"43k43dsmkf9994m3mdkm3k2mcdsk32",
|
117
|
+
"id"=>000000,
|
118
|
+
"timestampKey"=>302399304309,
|
119
|
+
"userId"=>000000
|
120
|
+
}
|
121
|
+
],
|
122
|
+
"locale"=>
|
123
|
+
{
|
124
|
+
"friendlyName"=>"English",
|
125
|
+
"id"=>1,
|
126
|
+
"languageTag"=>"en-US",
|
127
|
+
"name"=>"English"
|
128
|
+
},
|
129
|
+
"timezone"=>
|
130
|
+
{
|
131
|
+
"id"=>114,
|
132
|
+
"longName"=>"(GMT-06:00) America/Dallas - CST", "name"=>"America/Chicago",
|
133
|
+
"offset"=>"-0600",
|
134
|
+
"shortName"=>"CST"
|
135
|
+
},
|
136
|
+
"userStatus"=>
|
137
|
+
{
|
138
|
+
"id"=>1001,
|
139
|
+
"keyName"=>"ACTIVE",
|
140
|
+
"name"=>"Active"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
module Fog
|
8
|
+
module Compute
|
9
|
+
class Softlayer
|
10
|
+
class Mock
|
11
|
+
# Gets all Virtual Guest active tickets
|
12
|
+
# @param [Integer] id
|
13
|
+
# @return [Excon::Response]
|
14
|
+
def get_virtual_guest_active_tickets(id)
|
15
|
+
response = Excon::Response.new
|
16
|
+
found = self.get_vms.body.map{|server| server['id']}.include?(id)
|
17
|
+
unless found
|
18
|
+
response.status = 404
|
19
|
+
response.body = {
|
20
|
+
"error" => "Unable to find object with id of '#{id}'.",
|
21
|
+
"code" => "SoftLayer_Exception_ObjectNotFound"
|
22
|
+
}
|
23
|
+
else
|
24
|
+
response.status = 200
|
25
|
+
response.body = get_active_tickets
|
26
|
+
end
|
27
|
+
response
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Real
|
32
|
+
def get_virtual_guest_active_tickets(id)
|
33
|
+
request(:virtual_guest, "#{id.to_s}/getActiveTickets", :http_method => :GET)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Fog
|
41
|
+
module Compute
|
42
|
+
class Softlayer
|
43
|
+
class Mock
|
44
|
+
def get_active_tickets
|
45
|
+
[
|
46
|
+
{
|
47
|
+
"accountId"=>1,
|
48
|
+
"assignedUserId"=>1,
|
49
|
+
"billableFlag"=>nil,
|
50
|
+
"changeOwnerFlag"=>false,
|
51
|
+
"createDate"=>"2015-03-17T07:42:42-05:00",
|
52
|
+
"groupId"=>1,
|
53
|
+
"id"=>1,
|
54
|
+
"lastEditDate"=>"2015-03-17T07:42:43-05:00",
|
55
|
+
"lastEditType"=>"AUTO",
|
56
|
+
"locationId"=>nil,
|
57
|
+
"modifyDate"=>"2015-03-17T07:42:43-05:00",
|
58
|
+
"notifyUserOnUpdateFlag"=>true,
|
59
|
+
"originatingIpAddress"=>"10.10.10.10",
|
60
|
+
"priority"=>0,
|
61
|
+
"responsibleBrandId"=>1,
|
62
|
+
"serverAdministrationBillingAmount"=>nil,
|
63
|
+
"serverAdministrationBillingInvoiceId"=>nil,
|
64
|
+
"serverAdministrationFlag"=>0,
|
65
|
+
"serverAdministrationRefundInvoiceId"=>nil,
|
66
|
+
"serviceProviderId"=>1,
|
67
|
+
"serviceProviderResourceId"=>1,
|
68
|
+
"statusId"=>1,
|
69
|
+
"subjectId"=>1,
|
70
|
+
"title"=>"API Question - Testing API",
|
71
|
+
"totalUpdateCount"=>1,
|
72
|
+
"userEditableFlag"=>true
|
73
|
+
}
|
74
|
+
]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
module Fog
|
8
|
+
module Compute
|
9
|
+
class Softlayer
|
10
|
+
class Mock
|
11
|
+
def get_virtual_guest_by_ip(ip_address)
|
12
|
+
response = Excon::Response.new
|
13
|
+
response.body = @virtual_guests.map {|vm| vm if vm['primaryIpAddress'] == ip_address }.compact.first || {}
|
14
|
+
response.status = response.body.empty? ? 404 : 200
|
15
|
+
if response.status == 404
|
16
|
+
response.body = {
|
17
|
+
"error"=>"Unable to find object with ip of '#{ip_address}'.",
|
18
|
+
"code"=>"SoftLayer_Exception_ObjectNotFound"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Real
|
26
|
+
def get_virtual_guest_by_ip(ip_address)
|
27
|
+
request(:virtual_guest, :findByIpAddress, :body => "#{ip_address}", :http_method => :POST, :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.softwareLicense.softwareDescription.referenceCode,sshKeys.id,privateNetworkOnlyFlag,userData,frontendNetworkComponents,backendNetworkComponents]')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|