fog 0.3.34 → 0.4.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/Gemfile.lock +6 -6
- data/README.rdoc +26 -7
- data/Rakefile +7 -1
- data/examples/dns_tests.rb +76 -0
- data/examples/{storage.rb → storage_tests.rb} +15 -15
- data/fog.gemspec +4 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +19 -54
- data/lib/fog/aws/dns.rb +5 -1
- data/lib/fog/aws/models/compute/security_group.rb +128 -0
- data/lib/fog/aws/models/dns/record.rb +64 -0
- data/lib/fog/aws/models/dns/records.rb +47 -0
- data/lib/fog/aws/models/dns/zone.rb +53 -0
- data/lib/fog/aws/models/dns/zones.rb +33 -0
- data/lib/fog/aws/models/storage/file.rb +14 -2
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +1 -1
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +3 -1
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -0
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +0 -2
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -0
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +1 -0
- data/lib/fog/aws/requests/simpledb/list_domains.rb +3 -2
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -0
- data/lib/fog/brightbox/compute.rb +9 -0
- data/lib/fog/brightbox/models/compute/load_balancer.rb +50 -0
- data/lib/fog/brightbox/models/compute/load_balancers.rb +28 -0
- data/lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/create_load_balancer.rb +27 -0
- data/lib/fog/brightbox/requests/compute/destroy_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/get_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/list_load_balancers.rb +27 -0
- data/lib/fog/brightbox/requests/compute/remove_nodes_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/update_load_balancer.rb +29 -0
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/dns.rb +25 -0
- data/lib/fog/core/mock.rb +34 -0
- data/lib/fog/google/models/storage/file.rb +14 -2
- data/lib/fog/linode/dns.rb +4 -0
- data/lib/fog/linode/models/dns/record.rb +69 -0
- data/lib/fog/linode/models/dns/records.rb +37 -0
- data/lib/fog/linode/models/dns/zone.rb +84 -0
- data/lib/fog/linode/models/dns/zones.rb +29 -0
- data/lib/fog/linode/requests/dns/domain_create.rb +2 -3
- data/lib/fog/linode/requests/dns/domain_resource_create.rb +3 -4
- data/lib/fog/linode/requests/dns/domain_resource_list.rb +5 -2
- data/lib/fog/linode/requests/dns/domain_resource_update.rb +2 -2
- data/lib/fog/linode/requests/dns/domain_update.rb +2 -2
- data/lib/fog/rackspace/requests/compute/create_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute/create_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute/get_flavor_details.rb +19 -1
- data/lib/fog/rackspace/requests/compute/list_flavors.rb +14 -1
- data/lib/fog/rackspace/requests/compute/list_flavors_detail.rb +14 -1
- data/lib/fog/slicehost/bin.rb +1 -1
- data/lib/fog/slicehost/dns.rb +4 -0
- data/lib/fog/slicehost/models/dns/record.rb +66 -0
- data/lib/fog/slicehost/models/dns/records.rb +36 -0
- data/lib/fog/slicehost/models/dns/zone.rb +69 -0
- data/lib/fog/slicehost/models/dns/zones.rb +28 -0
- data/lib/fog/slicehost/requests/dns/create_record.rb +2 -3
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud.rb +1 -1
- data/lib/fog/zerigo/models/dns/record.rb +14 -3
- data/lib/fog/zerigo/models/dns/records.rb +1 -1
- data/lib/fog/zerigo/models/dns/zone.rb +7 -1
- data/lib/fog/zerigo/models/dns/zones.rb +1 -1
- data/spec/spec_helper.rb +0 -24
- data/tests/aws/requests/iam/helper.rb +15 -0
- data/tests/aws/requests/simpledb/attributes_tests.rb +75 -0
- data/tests/aws/requests/simpledb/domain_tests.rb +51 -0
- data/tests/aws/requests/simpledb/helper.rb +16 -0
- data/tests/compute/helper.rb +36 -0
- data/tests/compute/models/flavors_tests.rb +9 -0
- data/tests/compute/models/server_tests.rb +9 -0
- data/tests/compute/models/servers_tests.rb +9 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/address_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/availability_zone_tests.rb +0 -0
- data/tests/{aws → compute/requests/aws}/helper.rb +0 -12
- data/tests/{aws/requests/compute → compute/requests/aws}/image_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/instance_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/key_pair_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/region_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/security_group_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/snapshot_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/tag_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/volume_tests.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/block_tests.rb +0 -0
- data/tests/{bluebox → compute/requests/bluebox}/helper.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/product_tests.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/template_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/account_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/api_client_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/cloud_ip_tests.rb +15 -7
- data/tests/{brightbox → compute/requests/brightbox}/helper.rb +68 -22
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/image_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/interface_tests.rb +0 -0
- data/tests/compute/requests/brightbox/load_balancer_tests.rb +74 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/server_tests.rb +1 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/server_type_tests.rb +1 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/user_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/zone_tests.rb +1 -0
- data/tests/{go_grid/requests/compute → compute/requests/go_grid}/image_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/datacenter_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/distribution_tests.rb +0 -0
- data/tests/{linode → compute/requests/linode}/helper.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/linode_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/linodeplans_tests.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/address_tests.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/flavor_tests.rb +0 -0
- data/tests/{rackspace → compute/requests/rackspace}/helper.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/image_tests.rb +7 -9
- data/tests/compute/requests/rackspace/resize_tests.rb +33 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/server_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/backup_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/flavor_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/image_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/slice_tests.rb +0 -0
- data/tests/dns/helper.rb +19 -0
- data/tests/dns/models/record_tests.rb +25 -0
- data/tests/dns/models/records_tests.rb +25 -0
- data/tests/dns/models/zone_tests.rb +13 -0
- data/tests/dns/models/zones_tests.rb +13 -0
- data/tests/{aws/requests/dns → dns/requests/aws}/dns_tests.rb +0 -0
- data/tests/{linode/requests/dns → dns/requests/linode}/dns_tests.rb +0 -0
- data/tests/{slicehost/requests/dns_tests → dns/requests/slicehost}/dns_tests.rb +0 -0
- data/tests/{zerigo/requests/dns → dns/requests/zerigo}/dns_tests.rb +0 -0
- data/tests/helper.rb +1 -100
- data/tests/helpers/{collection_tests.rb → collection_helper.rb} +0 -0
- data/tests/helpers/compute/{flavors_tests.rb → flavors_helper.rb} +0 -0
- data/tests/helpers/compute/{server_tests.rb → server_helper.rb} +0 -0
- data/tests/helpers/compute/{servers_tests.rb → servers_helper.rb} +0 -0
- data/tests/helpers/formats_helper.rb +68 -0
- data/tests/{helper_tests.rb → helpers/formats_helper_tests.rb} +0 -0
- data/tests/helpers/{model_tests.rb → model_helper.rb} +0 -0
- data/tests/helpers/responds_to_helper.rb +13 -0
- data/tests/helpers/succeeds_helper.rb +12 -0
- data/tests/storage/helper.rb +16 -0
- data/tests/storage/models/directories_tests.rb +13 -0
- data/tests/storage/models/directory_test.rb +24 -0
- data/tests/storage/models/file_tests.rb +41 -0
- data/tests/storage/models/files_tests.rb +26 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/bucket_tests.rb +0 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/multipart_upload_tests.rb +0 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/object_tests.rb +0 -0
- data/tests/{google/requests/storage → storage/requests/google}/bucket_tests.rb +0 -0
- data/tests/{google/requests/storage → storage/requests/google}/object_tests.rb +0 -0
- data/tests/{rackspace/requests/storage → storage/requests/rackspace}/container_tests.rb +0 -0
- data/tests/{rackspace/requests/storage → storage/requests/rackspace}/object_tests.rb +0 -0
- metadata +195 -224
- data/examples/bluebox_create.rb +0 -33
- data/examples/dns_methods.rb +0 -389
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +0 -31
- data/spec/aws/requests/simpledb/create_domain_spec.rb +0 -29
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +0 -39
- data/spec/aws/requests/simpledb/delete_domain_spec.rb +0 -28
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +0 -52
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +0 -67
- data/spec/aws/requests/simpledb/list_domains_spec.rb +0 -30
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +0 -49
- data/spec/aws/requests/simpledb/select_spec.rb +0 -27
- data/tests/aws/models/compute/flavors_tests.rb +0 -5
- data/tests/aws/models/compute/server_tests.rb +0 -6
- data/tests/aws/models/compute/servers_tests.rb +0 -6
- data/tests/aws/models/storage/directories_tests.rb +0 -5
- data/tests/aws/models/storage/directory_tests.rb +0 -5
- data/tests/aws/models/storage/file_tests.rb +0 -5
- data/tests/aws/models/storage/files_tests.rb +0 -5
- data/tests/bluebox/models/compute/flavors_tests.rb +0 -5
- data/tests/bluebox/models/compute/server_tests.rb +0 -5
- data/tests/bluebox/models/compute/servers_tests.rb +0 -6
- data/tests/brightbox/models/compute/flavors_tests.rb +0 -5
- data/tests/brightbox/models/compute/server_tests.rb +0 -6
- data/tests/brightbox/models/compute/servers_tests.rb +0 -6
- data/tests/go_grid/helper.rb +0 -0
- data/tests/google/models/storage/directories_tests.rb +0 -5
- data/tests/google/models/storage/directory_tests.rb +0 -5
- data/tests/google/models/storage/file_tests.rb +0 -5
- data/tests/google/models/storage/files_tests.rb +0 -5
- data/tests/helpers/storage/directories_tests.rb +0 -7
- data/tests/helpers/storage/directory_tests.rb +0 -18
- data/tests/helpers/storage/file_tests.rb +0 -27
- data/tests/helpers/storage/files_tests.rb +0 -13
- data/tests/local/models/storage/directories_tests.rb +0 -5
- data/tests/local/models/storage/directory_tests.rb +0 -5
- data/tests/local/models/storage/file_tests.rb +0 -5
- data/tests/local/models/storage/files_tests.rb +0 -5
- data/tests/rackspace/models/compute/flavors_tests.rb +0 -5
- data/tests/rackspace/models/compute/server_tests.rb +0 -6
- data/tests/rackspace/models/compute/servers_tests.rb +0 -6
- data/tests/rackspace/models/storage/directories_tests.rb +0 -5
- data/tests/rackspace/models/storage/directory_tests.rb +0 -5
- data/tests/rackspace/models/storage/file_tests.rb +0 -5
- data/tests/rackspace/models/storage/files_tests.rb +0 -5
- data/tests/rackspace/requests/compute/resize_tests.rb +0 -47
- data/tests/slicehost/helper.rb +0 -1
- data/tests/slicehost/models/compute/flavors_tests.rb +0 -5
- data/tests/slicehost/models/compute/server_tests.rb +0 -6
- data/tests/slicehost/models/compute/servers_tests.rb +0 -6
- data/tests/zerigo/helper.rb +0 -0
@@ -22,8 +22,9 @@ module Fog
|
|
22
22
|
# * 'RequestId'
|
23
23
|
def list_domains(options = {})
|
24
24
|
request({
|
25
|
-
'Action'
|
26
|
-
:
|
25
|
+
'Action' => 'ListDomains',
|
26
|
+
:idempotent => true,
|
27
|
+
:parser => Fog::Parsers::AWS::SimpleDB::ListDomains.new(@nil_string)
|
27
28
|
}.merge!(options))
|
28
29
|
end
|
29
30
|
|
@@ -30,8 +30,8 @@ module Fog
|
|
30
30
|
request({
|
31
31
|
'Action' => 'PutAttributes',
|
32
32
|
'DomainName' => domain_name,
|
33
|
-
|
34
|
-
|
33
|
+
'ItemName' => item_name,
|
34
|
+
:parser => Fog::Parsers::AWS::SimpleDB::Basic.new(@nil_string)
|
35
35
|
}.merge!(encode_attributes(attributes, options[:replace], options[:expect])))
|
36
36
|
end
|
37
37
|
|
@@ -15,6 +15,8 @@ module Fog
|
|
15
15
|
model :flavor
|
16
16
|
collection :images
|
17
17
|
model :image
|
18
|
+
collection :load_balancers
|
19
|
+
model :load_balancer
|
18
20
|
collection :zones
|
19
21
|
model :zone
|
20
22
|
collection :cloud_ips
|
@@ -23,19 +25,23 @@ module Fog
|
|
23
25
|
model :user
|
24
26
|
|
25
27
|
request_path 'fog/brightbox/requests/compute'
|
28
|
+
request :add_nodes_load_balancer
|
26
29
|
request :create_api_client
|
27
30
|
request :create_cloud_ip
|
28
31
|
request :create_image
|
32
|
+
request :create_load_balancer
|
29
33
|
request :create_server
|
30
34
|
request :destroy_api_client
|
31
35
|
request :destroy_cloud_ip
|
32
36
|
request :destroy_image
|
37
|
+
request :destroy_load_balancer
|
33
38
|
request :destroy_server
|
34
39
|
request :get_account
|
35
40
|
request :get_api_client
|
36
41
|
request :get_cloud_ip
|
37
42
|
request :get_image
|
38
43
|
request :get_interface
|
44
|
+
request :get_load_balancer
|
39
45
|
request :get_server
|
40
46
|
request :get_server_type
|
41
47
|
request :get_user
|
@@ -43,11 +49,13 @@ module Fog
|
|
43
49
|
request :list_api_clients
|
44
50
|
request :list_cloud_ips
|
45
51
|
request :list_images
|
52
|
+
request :list_load_balancers
|
46
53
|
request :list_server_types
|
47
54
|
request :list_servers
|
48
55
|
request :list_users
|
49
56
|
request :list_zones
|
50
57
|
request :map_cloud_ip
|
58
|
+
request :remove_nodes_load_balancer
|
51
59
|
request :reset_ftp_password_account
|
52
60
|
request :resize_server
|
53
61
|
request :shutdown_server
|
@@ -58,6 +66,7 @@ module Fog
|
|
58
66
|
request :update_account
|
59
67
|
request :update_api_client
|
60
68
|
request :update_image
|
69
|
+
request :update_load_balancer
|
61
70
|
request :update_server
|
62
71
|
request :update_user
|
63
72
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Brightbox
|
5
|
+
class Compute
|
6
|
+
|
7
|
+
class LoadBalancer < Fog::Model
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
attribute :url
|
12
|
+
attribute :name
|
13
|
+
attribute :status
|
14
|
+
attribute :resource_type
|
15
|
+
|
16
|
+
attribute :nodes
|
17
|
+
attribute :policy
|
18
|
+
attribute :healthcheck
|
19
|
+
attribute :listeners
|
20
|
+
attribute :account
|
21
|
+
|
22
|
+
def ready?
|
23
|
+
status == 'active'
|
24
|
+
end
|
25
|
+
|
26
|
+
def save
|
27
|
+
requires :nodes, :listeners, :healthcheck
|
28
|
+
options = {
|
29
|
+
:nodes => nodes,
|
30
|
+
:listeners => listeners,
|
31
|
+
:healthcheck => healthcheck,
|
32
|
+
:policy => policy,
|
33
|
+
:name => name
|
34
|
+
}.delete_if {|k,v| v.nil? || v == "" }
|
35
|
+
data = connection.create_load_balancer(options)
|
36
|
+
merge_attributes(data)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
requires :identity
|
42
|
+
connection.destroy_load_balancer(identity)
|
43
|
+
true
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/brightbox/models/compute/load_balancer'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Brightbox
|
6
|
+
class Compute
|
7
|
+
|
8
|
+
class LoadBalancers < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::Brightbox::Compute::LoadBalancer
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.list_load_balancers
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(identifier)
|
18
|
+
data = connection.get_load_balancer(identifier)
|
19
|
+
new(data)
|
20
|
+
rescue Excon::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def add_nodes_load_balancer(identifier, options = {})
|
7
|
+
return nil if identifier.nil? || identifier == ""
|
8
|
+
request(
|
9
|
+
:expects => [202],
|
10
|
+
:method => 'POST',
|
11
|
+
:path => "/1.0/load_balancers/#{identifier}/add_nodes",
|
12
|
+
:headers => {"Content-Type" => "application/json"},
|
13
|
+
:body => options.to_json
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
def add_nodes_load_balancer(identifier, options = {})
|
22
|
+
Fog::Mock.not_implemented
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def create_load_balancer(options = {})
|
7
|
+
request(
|
8
|
+
:expects => [202],
|
9
|
+
:method => 'POST',
|
10
|
+
:path => "/1.0/load_balancers",
|
11
|
+
:headers => {"Content-Type" => "application/json"},
|
12
|
+
:body => options.to_json
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def create_load_balancer(options = {})
|
21
|
+
Fog::Mock.not_implemented
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def destroy_load_balancer(identifier, options = {})
|
7
|
+
return nil if identifier.nil? || identifier == ""
|
8
|
+
request(
|
9
|
+
:expects => [202],
|
10
|
+
:method => 'DELETE',
|
11
|
+
:path => "/1.0/load_balancers/#{identifier}",
|
12
|
+
:headers => {"Content-Type" => "application/json"},
|
13
|
+
:body => options.to_json
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
def destroy_load_balancer(identifier, options = {})
|
22
|
+
Fog::Mock.not_implemented
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def get_load_balancer(identifier, options = {})
|
7
|
+
return nil if identifier.nil? || identifier == ""
|
8
|
+
request(
|
9
|
+
:expects => [200],
|
10
|
+
:method => 'GET',
|
11
|
+
:path => "/1.0/load_balancers/#{identifier}",
|
12
|
+
:headers => {"Content-Type" => "application/json"},
|
13
|
+
:body => options.to_json
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
def get_load_balancer(identifier, options = {})
|
22
|
+
Fog::Mock.not_implemented
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def list_load_balancers(options = {})
|
7
|
+
request(
|
8
|
+
:expects => [200],
|
9
|
+
:method => 'GET',
|
10
|
+
:path => "/1.0/load_balancers",
|
11
|
+
:headers => {"Content-Type" => "application/json"},
|
12
|
+
:body => options.to_json
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def list_load_balancers(options = {})
|
21
|
+
Fog::Mock.not_implemented
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def remove_nodes_load_balancer(identifier, options = {})
|
7
|
+
return nil if identifier.nil? || identifier == ""
|
8
|
+
request(
|
9
|
+
:expects => [202],
|
10
|
+
:method => 'POST',
|
11
|
+
:path => "/1.0/load_balancers/#{identifier}/remove_nodes",
|
12
|
+
:headers => {"Content-Type" => "application/json"},
|
13
|
+
:body => options.to_json
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
|
21
|
+
def remove_nodes_load_balancer(identifier, options = {})
|
22
|
+
Fog::Mock.not_implemented
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
def update_load_balancer(identifier, options = {})
|
7
|
+
return nil if identifier.nil? || identifier == ""
|
8
|
+
return nil if options.empty? || options.nil?
|
9
|
+
request(
|
10
|
+
:expects => [202],
|
11
|
+
:method => 'PUT',
|
12
|
+
:path => "/1.0/load_balancers/#{identifier}",
|
13
|
+
:headers => {"Content-Type" => "application/json"},
|
14
|
+
:body => options.to_json
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
class Mock
|
21
|
+
|
22
|
+
def update_load_balancer(identifier, options = {})
|
23
|
+
Fog::Mock.not_implemented
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/fog/core.rb
CHANGED
data/lib/fog/core/dns.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
class DNS
|
3
|
+
|
4
|
+
def self.new(attributes)
|
5
|
+
attributes = attributes.dup # prevent delete from having side effects
|
6
|
+
case provider = attributes.delete(:provider)
|
7
|
+
when 'AWS'
|
8
|
+
require 'fog/aws'
|
9
|
+
Fog::AWS::DNS.new(attributes)
|
10
|
+
when 'Linode'
|
11
|
+
require 'fog/linode'
|
12
|
+
Fog::Linode::DNS.new(attributes)
|
13
|
+
when 'Slicehost'
|
14
|
+
require 'fog/slicehost'
|
15
|
+
Fog::Slicehost::DNS.new(attributes)
|
16
|
+
when 'Zerigo'
|
17
|
+
require 'fog/zerigo'
|
18
|
+
Fog::Zerigo::DNS.new(attributes)
|
19
|
+
else
|
20
|
+
raise ArgumentError.new("#{provider} is not a recognized storage provider")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/fog/core/mock.rb
CHANGED
@@ -15,6 +15,7 @@ module Fog
|
|
15
15
|
end
|
16
16
|
|
17
17
|
module Mock
|
18
|
+
|
18
19
|
@delay = 1
|
19
20
|
def self.delay
|
20
21
|
@delay
|
@@ -29,6 +30,39 @@ module Fog
|
|
29
30
|
raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
|
30
31
|
end
|
31
32
|
|
33
|
+
def self.random_base64(length)
|
34
|
+
random_selection(
|
35
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
36
|
+
length
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.random_hex(length)
|
41
|
+
max = ('f' * length).to_i(16)
|
42
|
+
rand(max).to_s(16).rjust(length, '0')
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.random_letters(length)
|
46
|
+
random_selection(
|
47
|
+
'abcdefghijklmnopqrstuvwxyz',
|
48
|
+
length
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.random_numbers(length)
|
53
|
+
max = ('9' * length).to_i
|
54
|
+
rand(max).to_s
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.random_selection(characters, length)
|
58
|
+
selection = ''
|
59
|
+
length.times do
|
60
|
+
position = rand(characters.length)
|
61
|
+
selection << characters[position..position]
|
62
|
+
end
|
63
|
+
selection
|
64
|
+
end
|
65
|
+
|
32
66
|
end
|
33
67
|
|
34
68
|
end
|