fog-softlayer 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +0 -1
- data/CHANGELOG.md +25 -9
- data/CONTRIBUTING.md +13 -25
- data/CONTRIBUTORS.md +1 -1
- data/Rakefile +3 -3
- data/examples/compute.md +114 -3
- data/examples/network.md +285 -0
- data/examples/tags.md +76 -1
- data/fog-softlayer.gemspec +2 -3
- data/lib/fog/softlayer.rb +2 -0
- data/lib/fog/softlayer/compute.rb +16 -73
- data/lib/fog/softlayer/core.rb +105 -1
- data/lib/fog/softlayer/models/compute/flavor.rb +1 -0
- data/lib/fog/softlayer/models/compute/flavors.rb +1 -0
- data/lib/fog/softlayer/models/compute/image.rb +1 -0
- data/lib/fog/softlayer/models/compute/images.rb +1 -0
- data/lib/fog/softlayer/models/compute/server.rb +71 -12
- data/lib/fog/softlayer/models/compute/servers.rb +9 -5
- data/lib/fog/softlayer/models/compute/tag.rb +5 -6
- data/lib/fog/softlayer/models/compute/tags.rb +1 -0
- data/lib/fog/softlayer/models/network/datacenter.rb +52 -0
- data/lib/fog/softlayer/models/network/datacenters.rb +42 -0
- data/lib/fog/softlayer/models/network/ip.rb +67 -0
- data/lib/fog/softlayer/models/network/ips.rb +39 -0
- data/lib/fog/softlayer/models/network/network.rb +121 -0
- data/lib/fog/softlayer/models/network/networks.rb +47 -0
- data/lib/fog/softlayer/models/network/subnet.rb +62 -0
- data/lib/fog/softlayer/models/network/subnets.rb +33 -0
- data/lib/fog/softlayer/models/network/tag.rb +54 -0
- data/lib/fog/softlayer/models/network/tags.rb +40 -0
- data/lib/fog/softlayer/models/storage/directories.rb +7 -0
- data/lib/fog/softlayer/models/storage/directory.rb +7 -0
- data/lib/fog/softlayer/models/storage/file.rb +7 -0
- data/lib/fog/softlayer/models/storage/files.rb +7 -0
- data/lib/fog/softlayer/network.rb +139 -0
- data/lib/fog/softlayer/requests/compute/create_bare_metal_server.rb +1 -1
- data/lib/fog/softlayer/requests/compute/get_vms.rb +1 -1
- data/lib/fog/softlayer/requests/network/create_network.rb +488 -0
- data/lib/fog/softlayer/requests/network/create_network_tags.rb +50 -0
- data/lib/fog/softlayer/requests/network/delete_network.rb +37 -0
- data/lib/fog/softlayer/requests/network/delete_network_tags.rb +46 -0
- data/lib/fog/softlayer/requests/network/get_datacenter_routers.rb +41 -0
- data/lib/fog/softlayer/requests/network/get_datacenters.rb +30 -0
- data/lib/fog/softlayer/requests/network/get_ip_address.rb +28 -0
- data/lib/fog/softlayer/requests/network/get_network.rb +34 -0
- data/lib/fog/softlayer/requests/network/get_network_tags.rb +47 -0
- data/lib/fog/softlayer/requests/network/get_private_vlan_price_code.rb +27 -0
- data/lib/fog/softlayer/requests/network/get_public_vlan_price_code.rb +27 -0
- data/lib/fog/softlayer/requests/network/get_references_by_tag_name.rb +42 -0
- data/lib/fog/softlayer/requests/network/get_subnet.rb +28 -0
- data/lib/fog/softlayer/requests/network/get_subnet_package_id.rb +29 -0
- data/lib/fog/softlayer/requests/network/get_subnet_price_code.rb +30 -0
- data/lib/fog/softlayer/requests/network/list_networks.rb +30 -0
- data/lib/fog/softlayer/requests/network/list_subnets.rb +28 -0
- data/lib/fog/softlayer/storage.rb +7 -0
- data/lib/fog/softlayer/version.rb +2 -1
- data/tests/compute/flavors_helper.rb +1 -0
- data/tests/compute/server_helper.rb +1 -0
- data/tests/compute/servers_helper.rb +1 -0
- data/tests/helper.rb +7 -0
- data/tests/helpers/collection_helper.rb +7 -0
- data/tests/helpers/compute/flavors_helper.rb +7 -0
- data/tests/helpers/compute/server_helper.rb +7 -0
- data/tests/helpers/compute/servers_helper.rb +7 -0
- data/tests/helpers/formats_helper.rb +7 -0
- data/tests/helpers/formats_helper_tests.rb +7 -0
- data/tests/helpers/mock_helper.rb +7 -0
- data/tests/helpers/model_helper.rb +7 -0
- data/tests/helpers/responds_to_helper.rb +7 -0
- data/tests/helpers/schema_validator_tests.rb +7 -0
- data/tests/helpers/succeeds_helper.rb +7 -0
- data/tests/softlayer/compute/helper.rb +1 -0
- data/tests/softlayer/compute/schema.rb +1 -0
- data/tests/softlayer/models/compute/server_tests.rb +31 -4
- data/tests/softlayer/requests/compute/bmc_tests.rb +4 -3
- data/tests/softlayer/requests/compute/tag_tests.rb +1 -1
- data/tests/softlayer/requests/network/network_tests.rb +129 -0
- metadata +35 -25
@@ -0,0 +1,33 @@
|
|
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
|
+
require 'fog/core/collection'
|
9
|
+
require 'fog/softlayer/models/network/subnet'
|
10
|
+
|
11
|
+
module Fog
|
12
|
+
module Network
|
13
|
+
class Softlayer
|
14
|
+
class Subnets < Fog::Collection
|
15
|
+
attribute :filters
|
16
|
+
|
17
|
+
model Fog::Network::Softlayer::Subnet
|
18
|
+
|
19
|
+
def all
|
20
|
+
load(service.list_subnets.body)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(id)
|
24
|
+
if subnet = service.get_subnet(id).body
|
25
|
+
new(subnet)
|
26
|
+
end
|
27
|
+
rescue Fog::Network::Softlayer::NotFound
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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
|
+
require 'fog/core/model'
|
8
|
+
|
9
|
+
module Fog
|
10
|
+
module Network
|
11
|
+
class Softlayer
|
12
|
+
class Tag < Fog::Model
|
13
|
+
identity :id
|
14
|
+
|
15
|
+
attribute :name
|
16
|
+
attribute :referenceCount, :type => :integer
|
17
|
+
attribute :resource_id
|
18
|
+
attribute :internal, :type => :boolean
|
19
|
+
|
20
|
+
def initialize(attributes = {})
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
requires :name, :resource_id
|
26
|
+
service.delete_network_tags(self.resource_id, [self.name])
|
27
|
+
#load_network
|
28
|
+
#@network.delete_tags([self.name])
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
def references
|
33
|
+
@networks ||= service.request(:tag, "#{id}", :query => "objectMask=references;references.tagType").body['references'].map do |ref|
|
34
|
+
service.networks.get(ref['resourceTableId']) if ref['tagType']['keyName'] == 'NETWORK_VLAN'
|
35
|
+
end.compact
|
36
|
+
end
|
37
|
+
|
38
|
+
def save
|
39
|
+
requires :name, :resource_id
|
40
|
+
load_network
|
41
|
+
service.create_network_tags(self.resource_id, @network.tags << self.name)
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def load_network
|
48
|
+
requires :resource_id
|
49
|
+
@network ||= service.networks.get(self.resource_id)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
require 'fog/core/collection'
|
8
|
+
require 'fog/softlayer/models/network/tag'
|
9
|
+
|
10
|
+
module Fog
|
11
|
+
module Network
|
12
|
+
class Softlayer
|
13
|
+
class Tags < Fog::Collection
|
14
|
+
attribute :filters
|
15
|
+
|
16
|
+
model Fog::Network::Softlayer::Tag
|
17
|
+
|
18
|
+
def initialize(attributes)
|
19
|
+
self.filters ||= []
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def all(filters = filters)
|
24
|
+
raise ArgumentError, "Filters argument for #{self.class.name}##{__method__} must be Array." unless filters.is_a?(Array)
|
25
|
+
self.filters = filters
|
26
|
+
data = service.request(:account, :get_tags, :query => 'objectMask=mask[referenceCount]').body
|
27
|
+
data.select! { |tag| filters.include?(tag) } unless filters.empty?
|
28
|
+
load(data)
|
29
|
+
end
|
30
|
+
|
31
|
+
def get(id)
|
32
|
+
return nil if id.nil? || id == ""
|
33
|
+
response = service.request(:tag, id)
|
34
|
+
data = response.body
|
35
|
+
new.merge_attributes(data)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,139 @@
|
|
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
|
+
require 'fog/softlayer/core'
|
9
|
+
|
10
|
+
module Fog
|
11
|
+
module Network
|
12
|
+
class Softlayer < Fog::Service
|
13
|
+
|
14
|
+
requires :softlayer_username, :softlayer_api_key
|
15
|
+
|
16
|
+
|
17
|
+
## MODELS
|
18
|
+
#
|
19
|
+
model_path 'fog/softlayer/models/network'
|
20
|
+
model :datacenter
|
21
|
+
collection :datacenters
|
22
|
+
model :network
|
23
|
+
collection :networks
|
24
|
+
#model :port
|
25
|
+
#collection :ports
|
26
|
+
model :subnet
|
27
|
+
collection :subnets
|
28
|
+
model :ip
|
29
|
+
collection :ips
|
30
|
+
model :tag
|
31
|
+
collection :tags
|
32
|
+
#model :router
|
33
|
+
#collection :routers
|
34
|
+
|
35
|
+
|
36
|
+
## REQUESTS
|
37
|
+
#
|
38
|
+
request_path 'fog/softlayer/requests/network'
|
39
|
+
|
40
|
+
request :list_networks
|
41
|
+
request :create_network
|
42
|
+
request :delete_network
|
43
|
+
request :get_network
|
44
|
+
#request :update_network
|
45
|
+
|
46
|
+
request :get_private_vlan_price_code
|
47
|
+
request :get_public_vlan_price_code
|
48
|
+
request :get_subnet_package_id
|
49
|
+
request :get_subnet_price_code
|
50
|
+
request :get_datacenters
|
51
|
+
request :get_datacenter_routers
|
52
|
+
request :get_references_by_tag_name
|
53
|
+
|
54
|
+
|
55
|
+
request :create_network_tags
|
56
|
+
request :delete_network_tags
|
57
|
+
request :get_network_tags
|
58
|
+
|
59
|
+
#request :list_ports
|
60
|
+
#request :create_port
|
61
|
+
#request :delete_port
|
62
|
+
#request :get_port
|
63
|
+
#request :update_port
|
64
|
+
|
65
|
+
request :list_subnets
|
66
|
+
#request :create_subnet
|
67
|
+
#request :delete_subnet
|
68
|
+
request :get_subnet
|
69
|
+
#request :update_subnet
|
70
|
+
|
71
|
+
#request :list_ip_addresses
|
72
|
+
#request :create_ip_addresse
|
73
|
+
#request :delete_ip_addresse
|
74
|
+
request :get_ip_address
|
75
|
+
#request :associate_ip_address
|
76
|
+
#request :disassociate_ip_address
|
77
|
+
|
78
|
+
class Mock
|
79
|
+
#Fog::Mock.random_ip,
|
80
|
+
|
81
|
+
def self.reset
|
82
|
+
@data = nil
|
83
|
+
end
|
84
|
+
|
85
|
+
def initialize(options={})
|
86
|
+
@softlayer_api_key = options[:softlayer_api_key]
|
87
|
+
@softlayer_username = options[:softlayer_username]
|
88
|
+
|
89
|
+
@networks = []
|
90
|
+
@datacenters = [
|
91
|
+
{"id"=>265592, "longName"=>"Amsterdam 1", "name"=>"ams01"},
|
92
|
+
{"id"=>358698, "longName"=>"Ashburn, VA 3", "name"=>"wdc03"},
|
93
|
+
{"id"=>3, "longName"=>"Dallas 1", "name"=>"dal01"},
|
94
|
+
{"id"=>154770, "longName"=>"Dallas 2", "name"=>"dal02"},
|
95
|
+
{"id"=>167092, "longName"=>"Dallas 4", "name"=>"dal04"},
|
96
|
+
{"id"=>138124, "longName"=>"Dallas 5", "name"=>"dal05"},
|
97
|
+
{"id"=>154820, "longName"=>"Dallas 6", "name"=>"dal06"},
|
98
|
+
{"id"=>142776, "longName"=>"Dallas 7", "name"=>"dal07"},
|
99
|
+
{"id"=>352494, "longName"=>"Hong Kong 2", "name"=>"hkg02"},
|
100
|
+
{"id"=>142775, "longName"=>"Houston 2", "name"=>"hou02"},
|
101
|
+
{"id"=>358694, "longName"=>"London 2", "name"=>"lon02"},
|
102
|
+
{"id"=>168642, "longName"=>"San Jose 1", "name"=>"sjc01"},
|
103
|
+
{"id"=>18171, "longName"=>"Seattle", "name"=>"sea01"},
|
104
|
+
{"id"=>224092, "longName"=>"Singapore 1", "name"=>"sng01"},
|
105
|
+
{"id"=>448994, "longName"=>"Toronto 1", "name"=>"tor01"},
|
106
|
+
{"id"=>37473, "longName"=>"Washington, DC 1", "name"=>"wdc01"}
|
107
|
+
]
|
108
|
+
@tags = []
|
109
|
+
end
|
110
|
+
|
111
|
+
def credentials
|
112
|
+
{ :provider => 'softlayer',
|
113
|
+
:softlayer_username => @softlayer_username,
|
114
|
+
:softlayer_api_key => @softlayer_api_key
|
115
|
+
}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class Real
|
120
|
+
include Fog::Softlayer::Slapi
|
121
|
+
|
122
|
+
def initialize(options={})
|
123
|
+
@softlayer_api_key = options[:softlayer_api_key]
|
124
|
+
@softlayer_username = options[:softlayer_username]
|
125
|
+
end
|
126
|
+
|
127
|
+
def request(service, path, options = {})
|
128
|
+
options = {:username => @softlayer_username, :api_key => @softlayer_api_key}.merge(options)
|
129
|
+
Fog::Softlayer::Slapi.slapi_request(service, path, options)
|
130
|
+
end
|
131
|
+
|
132
|
+
def list_networks
|
133
|
+
self.list_networks
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -39,7 +39,7 @@ module Fog
|
|
39
39
|
|
40
40
|
begin
|
41
41
|
Fog::Softlayer.valid_request?(required, opts) or raise MissingRequiredParameter
|
42
|
-
response.status =
|
42
|
+
response.status = 201
|
43
43
|
# a real response comes back with lots of nil values like this too, it takes 1 - 2 hours for a real BMC server to provision
|
44
44
|
response.body = {
|
45
45
|
'accountId' => Fog::Softlayer.mock_account_id,
|
@@ -20,7 +20,7 @@ module Fog
|
|
20
20
|
|
21
21
|
class Real
|
22
22
|
def get_vms
|
23
|
-
request(:account, :get_virtual_guests, :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password]')
|
23
|
+
request(:account, :get_virtual_guests, :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password,primaryNetworkComponent.networkVlan]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,488 @@
|
|
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
|
+
def create_network(order)
|
14
|
+
raise ArgumentError, "Order argument for #{self.class.name}##{__method__} must be Hash." unless order.is_a?(Hash)
|
15
|
+
# TODO: make this better, this will never fail...
|
16
|
+
@networks << {
|
17
|
+
'accountId' => Fog::Softlayer.mock_account_id,
|
18
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
19
|
+
'modifyDate' => Time.now.iso8601,
|
20
|
+
'name' => order['name'],
|
21
|
+
'networkVrfId' => nil,
|
22
|
+
'primarySubnetId' => Fog::Mock.random_numbers(6).to_i,
|
23
|
+
'vlanNumber' => Fog::Mock.random_numbers(4).to_i,
|
24
|
+
'networkSpace' => 'PRIVATE',
|
25
|
+
'primaryRouter' =>
|
26
|
+
{
|
27
|
+
'bareMetalInstanceFlag' => 0,
|
28
|
+
'domain' => 'softlayer.com',
|
29
|
+
'fullyQualifiedDomainName' => order['router'] << '.softlayer.com',
|
30
|
+
'hostname' => order['router'],
|
31
|
+
'id' => order['routerId'],
|
32
|
+
'notes' => '',
|
33
|
+
'serviceProviderId' => 1,
|
34
|
+
'serviceProviderResourceId' => Fog::Mock.random_numbers(6).to_i,
|
35
|
+
'datacenter' => {'id' => order['location'], 'longName' => 'Lilliput 4', 'name' => 'llp04'},
|
36
|
+
'primaryIpAddress' => Fog::Mock.random_ip
|
37
|
+
},
|
38
|
+
'subnets' =>
|
39
|
+
[
|
40
|
+
{
|
41
|
+
'broadcastAddress' => Fog::Mock.random_ip,
|
42
|
+
'cidr' => 30,
|
43
|
+
'gateway' => Fog::Mock.random_ip,
|
44
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
45
|
+
'isCustomerOwned' => false,
|
46
|
+
'isCustomerRoutable' => false,
|
47
|
+
'modifyDate' => Time.now.iso8601,
|
48
|
+
'netmask' => '255.255.255.0',
|
49
|
+
'networkIdentifier' => Fog::Mock.random_ip,
|
50
|
+
'networkVlanId' => Fog::Mock.random_numbers(6).to_i,
|
51
|
+
'sortOrder' => '4',
|
52
|
+
'subnetType' => 'PRIMARY',
|
53
|
+
'totalIpAddresses' => 4,
|
54
|
+
'usableIpAddressCount' => 1,
|
55
|
+
'version' => 4
|
56
|
+
}
|
57
|
+
],
|
58
|
+
'tagReferences' => [],
|
59
|
+
'type' =>
|
60
|
+
{
|
61
|
+
'description' => 'Standard network VLAN',
|
62
|
+
'id' => 1,
|
63
|
+
'keyName' => 'STANDARD',
|
64
|
+
'name' => 'Standard'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
response = Excon::Response.new
|
69
|
+
response.status = 200
|
70
|
+
response.body = {
|
71
|
+
'orderDate' => Time.now.iso8601,
|
72
|
+
'orderDetails' =>
|
73
|
+
{
|
74
|
+
'bigDataOrderFlag' => false,
|
75
|
+
'billingInformation' =>
|
76
|
+
{
|
77
|
+
'billingAddressLine1' => '42 Haviture Way.',
|
78
|
+
'billingCity' => 'Glover',
|
79
|
+
'billingCountryCode' => 'US',
|
80
|
+
'billingEmail' => 'donotreply@softlayer.com',
|
81
|
+
'billingNameCompany' => 'SLayer\'s Inc.',
|
82
|
+
'billingNameFirst' => 'Mr.',
|
83
|
+
'billingNameLast' => 'Rogers',
|
84
|
+
'billingPhoneVoice' => '123.456.7890',
|
85
|
+
'billingPostalCode' => '90210',
|
86
|
+
'billingState' => 'VT',
|
87
|
+
'cardExpirationMonth' => nil,
|
88
|
+
'cardExpirationYear' => nil,
|
89
|
+
'taxExempt' => 0
|
90
|
+
},
|
91
|
+
'billingOrderItemId' => nil,
|
92
|
+
'containerSplHash' => '00000000000000000000000000000000',
|
93
|
+
'currencyShortName' => 'USD',
|
94
|
+
'extendedHardwareTesting' => nil,
|
95
|
+
'imageTemplateId' => nil,
|
96
|
+
'isManagedOrder' => 0,
|
97
|
+
'itemCategoryQuestionAnswers' => [],
|
98
|
+
'location' => Fog::Mock.random_numbers(6).to_i,
|
99
|
+
'locationObject' =>
|
100
|
+
{
|
101
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
102
|
+
'longName' => 'Amsterdam 1',
|
103
|
+
'name' => 'ams01',
|
104
|
+
'activePresaleEvents' => []},
|
105
|
+
'packageId' => 0,
|
106
|
+
'paymentType' => 'PAYPAL',
|
107
|
+
'postTaxRecurring' => '0',
|
108
|
+
'postTaxRecurringHourly' => '0',
|
109
|
+
'postTaxRecurringMonthly' => '0',
|
110
|
+
'postTaxSetup' => '0',
|
111
|
+
'preTaxRecurring' => '0',
|
112
|
+
'preTaxRecurringHourly' => '0',
|
113
|
+
'preTaxRecurringMonthly' => '0',
|
114
|
+
'preTaxSetup' => '0',
|
115
|
+
'presetId' => nil,
|
116
|
+
'prices' =>
|
117
|
+
[
|
118
|
+
{
|
119
|
+
'currentPriceFlag' => nil,
|
120
|
+
'hourlyRecurringFee' => '0',
|
121
|
+
'id' => Fog::Mock.random_numbers(4).to_i,
|
122
|
+
'itemId' => Fog::Mock.random_numbers(4).to_i,
|
123
|
+
'laborFee' => '0',
|
124
|
+
'onSaleFlag' => nil,
|
125
|
+
'oneTimeFee' => '0',
|
126
|
+
'oneTimeFeeTax' => '0',
|
127
|
+
'proratedRecurringFee' => '0',
|
128
|
+
'proratedRecurringFeeTax' => '0',
|
129
|
+
'quantity' => nil,
|
130
|
+
'recurringFee' => '0',
|
131
|
+
'recurringFeeTax' => '0',
|
132
|
+
'setupFee' => '0',
|
133
|
+
'sort' => 0,
|
134
|
+
'categories' =>
|
135
|
+
[
|
136
|
+
{
|
137
|
+
'categoryCode' => 'network_vlan',
|
138
|
+
'id' => 113,
|
139
|
+
'name' => 'Network Vlan',
|
140
|
+
'quantityLimit' => 0}],
|
141
|
+
'item' =>
|
142
|
+
{
|
143
|
+
'capacity' => '0',
|
144
|
+
'description' => 'Private Network Vlan',
|
145
|
+
'id' => Fog::Mock.random_numbers(4).to_i,
|
146
|
+
'softwareDescriptionId' => nil,
|
147
|
+
'units' => 'N/A',
|
148
|
+
'upgradeItemId' => nil,
|
149
|
+
'bundle' => [],
|
150
|
+
'itemCategory' =>
|
151
|
+
{
|
152
|
+
'categoryCode' => 'network_vlan',
|
153
|
+
'id' => 113,
|
154
|
+
'name' => 'Network Vlan',
|
155
|
+
'quantityLimit' => 0}}},
|
156
|
+
{
|
157
|
+
'currentPriceFlag' => nil,
|
158
|
+
'hourlyRecurringFee' => '0',
|
159
|
+
'id' => Fog::Mock.random_numbers(4).to_i,
|
160
|
+
'itemId' => 577,
|
161
|
+
'laborFee' => '0',
|
162
|
+
'onSaleFlag' => nil,
|
163
|
+
'oneTimeFee' => '0',
|
164
|
+
'oneTimeFeeTax' => '0',
|
165
|
+
'proratedRecurringFee' => '0',
|
166
|
+
'proratedRecurringFeeTax' => '0',
|
167
|
+
'quantity' => nil,
|
168
|
+
'recurringFee' => '0',
|
169
|
+
'recurringFeeTax' => '0',
|
170
|
+
'setupFee' => '0',
|
171
|
+
'sort' => 0,
|
172
|
+
'categories' =>
|
173
|
+
[
|
174
|
+
{
|
175
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
176
|
+
'id' => 53,
|
177
|
+
'name' => 'Public Secondary Static IP Addresses',
|
178
|
+
'quantityLimit' => 0}],
|
179
|
+
'item' =>
|
180
|
+
{
|
181
|
+
'capacity' => '4',
|
182
|
+
'description' => '4 Static Public IP Addresses',
|
183
|
+
'id' => 577,
|
184
|
+
'softwareDescriptionId' => nil,
|
185
|
+
'upgradeItemId' => nil,
|
186
|
+
'bundle' => [],
|
187
|
+
'itemCategory' =>
|
188
|
+
{
|
189
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
190
|
+
'id' => 53,
|
191
|
+
'name' => 'Public Secondary Static IP Addresses',
|
192
|
+
'quantityLimit' => 0
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
],
|
197
|
+
'primaryDiskPartitionId' => nil,
|
198
|
+
'privateCloudOrderFlag' => false,
|
199
|
+
'properties' => [],
|
200
|
+
'proratedInitialCharge' => '0',
|
201
|
+
'proratedOrderTotal' => '0',
|
202
|
+
'quantity' => 1,
|
203
|
+
'resourceGroupId' => nil,
|
204
|
+
'resourceGroupTemplateId' => nil,
|
205
|
+
'sendQuoteEmailFlag' => nil,
|
206
|
+
'serverCoreCount' => nil,
|
207
|
+
'sourceVirtualGuestId' => nil,
|
208
|
+
'sshKeys' => [],
|
209
|
+
'stepId' => nil,
|
210
|
+
'storageGroups' => [],
|
211
|
+
'totalRecurringTax' => '0',
|
212
|
+
'totalSetupTax' => '0',
|
213
|
+
'useHourlyPricing' => false,
|
214
|
+
'id' => nil,
|
215
|
+
'name' => 'foobar',
|
216
|
+
'router' =>
|
217
|
+
{
|
218
|
+
'bareMetalInstanceFlag' => 0,
|
219
|
+
'domain' => 'softlayer.com',
|
220
|
+
'fullyQualifiedDomainName' => order['router'] << '.softlayer.com',
|
221
|
+
'hostname' => order['router'],
|
222
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
223
|
+
'notes' => '',
|
224
|
+
'serviceProviderId' => 1,
|
225
|
+
'serviceProviderResourceId' => Fog::Mock.random_numbers(6).to_i,
|
226
|
+
'datacenter' => {'id' => order['location'], 'longName' => 'Lilliput 4', 'name' => 'llp04'}
|
227
|
+
},
|
228
|
+
'routerId' => order['routerId'],
|
229
|
+
'vlanNumber' => nil
|
230
|
+
},
|
231
|
+
'orderId' => Fog::Mock.random_numbers(7).to_i,
|
232
|
+
'placedOrder' =>
|
233
|
+
{
|
234
|
+
'accountId' => Fog::Mock.random_numbers(6).to_i,
|
235
|
+
'createDate' => Time.now.iso8601,
|
236
|
+
'id' => Fog::Mock.random_numbers(7).to_i,
|
237
|
+
'impersonatingUserRecordId' => nil,
|
238
|
+
'modifyDate' => nil,
|
239
|
+
'orderQuoteId' => nil,
|
240
|
+
'orderTypeId' => 4,
|
241
|
+
'presaleEventId' => nil,
|
242
|
+
'privateCloudOrderFlag' => false,
|
243
|
+
'status' => 'PENDING_AUTO_APPROVAL',
|
244
|
+
'userRecordId' => Fog::Mock.random_numbers(6).to_i,
|
245
|
+
'account' =>
|
246
|
+
{
|
247
|
+
'accountStatusId' => Fog::Mock.random_numbers(4).to_i,
|
248
|
+
'address1' => '4849 Alpha Rd.',
|
249
|
+
'allowedPptpVpnQuantity' => 1,
|
250
|
+
'brandId' => 2,
|
251
|
+
'city' => 'Dallas',
|
252
|
+
'claimedTaxExemptTxFlag' => false,
|
253
|
+
'companyName' => 'SoftLayer Internal - Development Community',
|
254
|
+
'country' => 'US',
|
255
|
+
'createDate' => Time.now.iso8601,
|
256
|
+
'email' => 'pjackson@softlayer.com',
|
257
|
+
'firstName' => 'Phil',
|
258
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
259
|
+
'isReseller' => 0,
|
260
|
+
'lastName' => 'Jackson',
|
261
|
+
'lateFeeProtectionFlag' => nil,
|
262
|
+
'modifyDate' => Time.now.iso8601,
|
263
|
+
'officePhone' => '281.714.3156',
|
264
|
+
'postalCode' => '75244',
|
265
|
+
'state' => 'TX',
|
266
|
+
'statusDate' => nil,
|
267
|
+
'hardwareCount' => 7,
|
268
|
+
'canOrderAdditionalVlansFlag' => true,
|
269
|
+
'hasPendingOrder' => 3},
|
270
|
+
'items' =>
|
271
|
+
[
|
272
|
+
{
|
273
|
+
'categoryCode' => 'network_vlan',
|
274
|
+
'description' => 'Private Network Vlan',
|
275
|
+
'id' => Fog::Mock.random_numbers(8).to_i,
|
276
|
+
'itemId' => Fog::Mock.random_numbers(4).to_i,
|
277
|
+
'itemPriceId' => '2019',
|
278
|
+
'laborFee' => '0',
|
279
|
+
'laborFeeTaxRate' => '.066',
|
280
|
+
'oneTimeFee' => '0',
|
281
|
+
'oneTimeFeeTaxRate' => '.066',
|
282
|
+
'parentId' => nil,
|
283
|
+
'promoCodeId' => nil,
|
284
|
+
'quantity' => nil,
|
285
|
+
'recurringFee' => '0',
|
286
|
+
'setupFee' => '0',
|
287
|
+
'setupFeeDeferralMonths' => 12,
|
288
|
+
'setupFeeTaxRate' => '.066',
|
289
|
+
'bundledItems' => [],
|
290
|
+
'category' =>
|
291
|
+
{
|
292
|
+
'categoryCode' => 'network_vlan',
|
293
|
+
'id' => 113,
|
294
|
+
'name' => 'Network Vlan',
|
295
|
+
'quantityLimit' => 0},
|
296
|
+
'children' =>
|
297
|
+
[
|
298
|
+
{
|
299
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
300
|
+
'description' => '4 Static Public IP Addresses',
|
301
|
+
'id' => Fog::Mock.random_numbers(8).to_i,
|
302
|
+
'itemId' => 577,
|
303
|
+
'itemPriceId' => '1084',
|
304
|
+
'laborFee' => '0',
|
305
|
+
'laborFeeTaxRate' => '.066',
|
306
|
+
'oneTimeFee' => '0',
|
307
|
+
'oneTimeFeeTaxRate' => '.066',
|
308
|
+
'parentId' => Fog::Mock.random_numbers(8).to_i,
|
309
|
+
'promoCodeId' => nil,
|
310
|
+
'quantity' => nil,
|
311
|
+
'recurringFee' => '0',
|
312
|
+
'setupFee' => '0',
|
313
|
+
'setupFeeDeferralMonths' => 12,
|
314
|
+
'setupFeeTaxRate' => '.066',
|
315
|
+
'bundledItems' => [],
|
316
|
+
'category' =>
|
317
|
+
{
|
318
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
319
|
+
'id' => 53,
|
320
|
+
'name' => 'Public Secondary Static IP Addresses',
|
321
|
+
'quantityLimit' => 0},
|
322
|
+
'children' => [],
|
323
|
+
'order' => nil,
|
324
|
+
'storageGroups' => []
|
325
|
+
}
|
326
|
+
],
|
327
|
+
'location' => {'id' => Fog::Mock.random_numbers(6).to_i, 'longName' => 'Amsterdam 1', 'name' => 'ams01'},
|
328
|
+
'order' => nil,
|
329
|
+
'storageGroups' => []},
|
330
|
+
{
|
331
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
332
|
+
'description' => '4 Static Public IP Addresses',
|
333
|
+
'id' => Fog::Mock.random_numbers(8).to_i,
|
334
|
+
'itemId' => 577,
|
335
|
+
'itemPriceId' => '1084',
|
336
|
+
'laborFee' => '0',
|
337
|
+
'laborFeeTaxRate' => '.066',
|
338
|
+
'oneTimeFee' => '0',
|
339
|
+
'oneTimeFeeTaxRate' => '.066',
|
340
|
+
'parentId' => Fog::Mock.random_numbers(8).to_i,
|
341
|
+
'promoCodeId' => nil,
|
342
|
+
'quantity' => nil,
|
343
|
+
'recurringFee' => '0',
|
344
|
+
'setupFee' => '0',
|
345
|
+
'setupFeeDeferralMonths' => 12,
|
346
|
+
'setupFeeTaxRate' => '.066',
|
347
|
+
'bundledItems' => [],
|
348
|
+
'category' =>
|
349
|
+
{
|
350
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
351
|
+
'id' => 53,
|
352
|
+
'name' => 'Public Secondary Static IP Addresses',
|
353
|
+
'quantityLimit' => 0},
|
354
|
+
'children' => [],
|
355
|
+
'order' => nil,
|
356
|
+
'storageGroups' => []
|
357
|
+
}
|
358
|
+
],
|
359
|
+
'orderTopLevelItems' =>
|
360
|
+
[
|
361
|
+
{
|
362
|
+
'categoryCode' => 'network_vlan',
|
363
|
+
'description' => 'Private Network Vlan',
|
364
|
+
'id' => Fog::Mock.random_numbers(8).to_i,
|
365
|
+
'itemId' => Fog::Mock.random_numbers(4).to_i,
|
366
|
+
'itemPriceId' => '2019',
|
367
|
+
'laborFee' => '0',
|
368
|
+
'laborFeeTaxRate' => '.066',
|
369
|
+
'oneTimeFee' => '0',
|
370
|
+
'oneTimeFeeTaxRate' => '.066',
|
371
|
+
'parentId' => nil,
|
372
|
+
'promoCodeId' => nil,
|
373
|
+
'quantity' => nil,
|
374
|
+
'recurringFee' => '0',
|
375
|
+
'setupFee' => '0',
|
376
|
+
'setupFeeDeferralMonths' => 12,
|
377
|
+
'setupFeeTaxRate' => '.066',
|
378
|
+
'bundledItems' => [],
|
379
|
+
'category' =>
|
380
|
+
{
|
381
|
+
'categoryCode' => 'network_vlan',
|
382
|
+
'id' => 113,
|
383
|
+
'name' => 'Network Vlan',
|
384
|
+
'quantityLimit' => 0},
|
385
|
+
'children' =>
|
386
|
+
[
|
387
|
+
{
|
388
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
389
|
+
'description' => '4 Static Public IP Addresses',
|
390
|
+
'id' => Fog::Mock.random_numbers(8).to_i,
|
391
|
+
'itemId' => 577,
|
392
|
+
'itemPriceId' => '1084',
|
393
|
+
'laborFee' => '0',
|
394
|
+
'laborFeeTaxRate' => '.066',
|
395
|
+
'oneTimeFee' => '0',
|
396
|
+
'oneTimeFeeTaxRate' => '.066',
|
397
|
+
'parentId' => Fog::Mock.random_numbers(8).to_i,
|
398
|
+
'promoCodeId' => nil,
|
399
|
+
'quantity' => nil,
|
400
|
+
'recurringFee' => '0',
|
401
|
+
'setupFee' => '0',
|
402
|
+
'setupFeeDeferralMonths' => 12,
|
403
|
+
'setupFeeTaxRate' => '.066',
|
404
|
+
'bundledItems' => [],
|
405
|
+
'category' =>
|
406
|
+
{
|
407
|
+
'categoryCode' => 'static_sec_ip_addresses',
|
408
|
+
'id' => 53,
|
409
|
+
'name' => 'Public Secondary Static IP Addresses',
|
410
|
+
'quantityLimit' => 0},
|
411
|
+
'children' => [],
|
412
|
+
'order' => nil,
|
413
|
+
'storageGroups' => []
|
414
|
+
}
|
415
|
+
],
|
416
|
+
'location' => {'id' => 265592, 'longName' => 'Amsterdam 1', 'name' => 'ams01'},
|
417
|
+
'order' => nil,
|
418
|
+
'storageGroups' => []
|
419
|
+
}
|
420
|
+
],
|
421
|
+
'userRecord' =>
|
422
|
+
{
|
423
|
+
'accountId' => Fog::Mock.random_numbers(6).to_i,
|
424
|
+
'address1' => '315 Capitol Street',
|
425
|
+
'authenticationToken' =>
|
426
|
+
{
|
427
|
+
'hash' => 'd83e82b1c9a04befe6ac48368d9b61f3',
|
428
|
+
'user' => nil,
|
429
|
+
'userId' => 184064
|
430
|
+
},
|
431
|
+
'city' => 'Houston',
|
432
|
+
'companyName' => 'SLayer\'s Inc.',
|
433
|
+
'country' => 'US',
|
434
|
+
'createDate' => Time.now.iso8601,
|
435
|
+
'daylightSavingsTimeFlag' => true,
|
436
|
+
'denyAllResourceAccessOnCreateFlag' => false,
|
437
|
+
'displayName' => 'PulseL',
|
438
|
+
'email' => 'noreply@softlayer.com',
|
439
|
+
'firstName' => 'Mr.',
|
440
|
+
'forumPasswordHash' => '000000000000000000000000000000000000000000',
|
441
|
+
'id' => Fog::Mock.random_numbers(6).to_i,
|
442
|
+
'lastName' => 'Rogers',
|
443
|
+
'localeId' => 1,
|
444
|
+
'modifyDate' => Time.now.iso8601,
|
445
|
+
'parentId' => Fog::Mock.random_numbers(6).to_i,
|
446
|
+
'passwordExpireDate' => nil,
|
447
|
+
'permissionSystemVersion' => 2,
|
448
|
+
'postalCode' => '77002',
|
449
|
+
'pptpVpnAllowedFlag' => false,
|
450
|
+
'savedId' => Fog::Mock.random_numbers(6).to_i,
|
451
|
+
'secondaryLoginManagementFlag' => nil,
|
452
|
+
'secondaryLoginRequiredFlag' => nil,
|
453
|
+
'secondaryPasswordModifyDate' => Time.now.iso8601,
|
454
|
+
'secondaryPasswordTimeoutDays' => 0,
|
455
|
+
'sslVpnAllowedFlag' => false,
|
456
|
+
'state' => 'TX',
|
457
|
+
'statusDate' => nil,
|
458
|
+
'timezoneId' => 113,
|
459
|
+
'userStatusId' => Fog::Mock.random_numbers(4).to_i,
|
460
|
+
'username' => 'sl307608-meldridge',
|
461
|
+
'vpnManualConfig' => false,
|
462
|
+
'hasFullHardwareAccessFlag' => true,
|
463
|
+
'timezone' =>
|
464
|
+
{
|
465
|
+
'id' => 113,
|
466
|
+
'longName' => '(GMT-06:00) America/Chicago - CST',
|
467
|
+
'name' => 'America/Chicago',
|
468
|
+
'offset' => '-0600',
|
469
|
+
'shortName' => 'CST'
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
}
|
474
|
+
response
|
475
|
+
|
476
|
+
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
class Real
|
481
|
+
def create_network(order)
|
482
|
+
raise ArgumentError, "Order argument for #{self.class.name}##{__method__} must be Hash." unless order.is_a?(Hash)
|
483
|
+
self.request(:product_order, :place_order, :body => order, :http_method => :post)
|
484
|
+
end
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|