fog 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/Rakefile +2 -1
- data/changelog.txt +184 -0
- data/docs/cdn/index.markdown +69 -3
- data/fog.gemspec +2 -2
- data/lib/fog.rb +2 -1
- data/lib/fog/atmos/models/storage/file.rb +16 -14
- data/lib/fog/aws/auto_scaling.rb +55 -13
- data/lib/fog/aws/cdn.rb +69 -9
- data/lib/fog/aws/cloud_watch.rb +15 -1
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -4
- data/lib/fog/aws/models/cdn/distribution.rb +93 -0
- data/lib/fog/aws/models/cdn/distribution_helper.rb +64 -0
- data/lib/fog/aws/models/cdn/distributions.rb +32 -0
- data/lib/fog/aws/models/cdn/distributions_helper.rb +47 -0
- data/lib/fog/aws/models/cdn/invalidation.rb +64 -0
- data/lib/fog/aws/models/cdn/invalidations.rb +54 -0
- data/lib/fog/aws/models/cdn/streaming_distribution.rb +77 -0
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +32 -0
- data/lib/fog/aws/models/compute/server.rb +0 -23
- data/lib/fog/aws/models/compute/spot_request.rb +2 -24
- data/lib/fog/aws/models/rds/server.rb +18 -0
- data/lib/fog/aws/models/rds/subnet_group.rb +20 -0
- data/lib/fog/aws/models/rds/subnet_groups.rb +27 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +39 -13
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_notification_types.rb +43 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb +3 -3
- data/lib/fog/aws/parsers/auto_scaling/describe_notification_configurations.rb +42 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_scaling_process_types.rb +15 -2
- data/lib/fog/aws/parsers/auto_scaling/describe_tags.rb +46 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_termination_policy_types.rb +44 -0
- data/lib/fog/aws/parsers/cdn/get_invalidation.rb +32 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +1 -1
- data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +13 -2
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/base.rb +0 -2
- data/lib/fog/aws/parsers/elasticache/engine_defaults_parser.rb +1 -1
- data/lib/fog/aws/parsers/elasticache/event_list.rb +2 -0
- data/lib/fog/aws/parsers/rds/base.rb +32 -0
- data/lib/fog/aws/parsers/rds/create_db_subnet_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_subnet_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/event_list.rb +40 -0
- data/lib/fog/aws/parsers/rds/subnet_group_parser.rb +38 -0
- data/lib/fog/aws/parsers/rds/tag_list_parser.rb +35 -0
- data/lib/fog/aws/rds.rb +24 -7
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +36 -16
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +19 -12
- data/lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -3
- data/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb +21 -5
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/delete_tags.rb +63 -0
- data/lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +17 -13
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_notification_types.rb +55 -0
- data/lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb +6 -5
- data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +79 -0
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/describe_tags.rb +74 -0
- data/lib/fog/aws/requests/auto_scaling/describe_termination_policy_types.rb +53 -0
- data/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb +30 -11
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +4 -4
- data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +8 -5
- data/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/set_instance_health.rb +2 -2
- data/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +30 -18
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +31 -0
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +30 -0
- data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -0
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -0
- data/lib/fog/aws/requests/cdn/get_invalidation.rb +60 -0
- data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +41 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +26 -0
- data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +30 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +33 -0
- data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +44 -0
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +28 -0
- data/lib/fog/aws/requests/compute/create_image.rb +32 -5
- data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +2 -2
- data/lib/fog/aws/requests/compute/register_image.rb +1 -1
- data/lib/fog/aws/requests/elasticache/describe_events.rb +7 -4
- data/lib/fog/aws/requests/glacier/create_archive.rb +1 -1
- data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
- data/lib/fog/aws/requests/rds/add_tags_to_resource.rb +46 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +2 -0
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +58 -0
- data/lib/fog/aws/requests/rds/describe_db_subnet_groups.rb +63 -0
- data/lib/fog/aws/requests/rds/describe_events.rb +52 -0
- data/lib/fog/aws/requests/rds/list_tags_for_resource.rb +44 -0
- data/lib/fog/aws/requests/rds/remove_tags_from_resource.rb +44 -0
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/bluebox/models/compute/server.rb +0 -19
- data/lib/fog/bluebox/requests/compute/create_block.rb +8 -8
- data/lib/fog/brightbox/compute.rb +56 -7
- data/lib/fog/brightbox/models/compute/accounts.rb +29 -0
- data/lib/fog/brightbox/models/compute/api_client.rb +37 -0
- data/lib/fog/brightbox/models/compute/api_clients.rb +24 -0
- data/lib/fog/brightbox/models/compute/application.rb +27 -0
- data/lib/fog/brightbox/models/compute/applications.rb +28 -0
- data/lib/fog/brightbox/models/compute/server.rb +3 -1
- data/lib/fog/brightbox/models/compute/users.rb +1 -3
- data/lib/fog/brightbox/requests/compute/create_application.rb +13 -0
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +2 -2
- data/lib/fog/brightbox/requests/compute/destroy_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_account.rb +28 -4
- data/lib/fog/brightbox/requests/compute/get_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +19 -0
- data/lib/fog/brightbox/requests/compute/get_user.rb +28 -5
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +13 -0
- data/lib/fog/brightbox/requests/compute/list_applications.rb +13 -0
- data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +14 -0
- data/lib/fog/brightbox/requests/compute/update_account.rb +51 -3
- data/lib/fog/brightbox/requests/compute/update_application.rb +15 -0
- data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +4 -2
- data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +37 -0
- data/lib/fog/clodo/models/compute/server.rb +7 -44
- data/lib/fog/compute/models/server.rb +23 -2
- data/lib/fog/core/time.rb +2 -0
- data/lib/fog/core/wait_for.rb +0 -2
- data/lib/fog/ecloud/models/compute/servers.rb +3 -1
- data/lib/fog/ecloud/requests/compute/get_servers.rb +1 -1
- data/lib/fog/ecloud/requests/compute/get_tasks.rb +1 -1
- data/lib/fog/go_grid/models/compute/server.rb +0 -4
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/hp/models/compute/server.rb +1 -23
- data/lib/fog/hp/storage.rb +0 -1
- data/lib/fog/joyent/models/compute/server.rb +4 -0
- data/lib/fog/joyent/models/compute/servers.rb +4 -3
- data/lib/fog/libvirt/models/compute/server.rb +1 -27
- data/lib/fog/linode/models/compute/server.rb +0 -1
- data/lib/fog/local/models/storage/directory.rb +1 -1
- data/lib/fog/network.rb +26 -0
- data/lib/fog/ninefold/compute.rb +8 -0
- data/lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb +13 -0
- data/lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb +11 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb +15 -0
- data/lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb +14 -0
- data/lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb +12 -0
- data/lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb +15 -0
- data/lib/fog/ninefold/storage.rb +14 -112
- data/lib/fog/openstack.rb +4 -1
- data/lib/fog/openstack/compute.rb +20 -1
- data/lib/fog/openstack/identity.rb +67 -18
- data/lib/fog/openstack/image.rb +12 -4
- data/lib/fog/openstack/models/compute/security_group.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -23
- data/lib/fog/openstack/models/identity/tenants.rb +5 -3
- data/lib/fog/openstack/models/identity/users.rb +4 -1
- data/lib/fog/openstack/models/image/image.rb +6 -1
- data/lib/fog/openstack/models/network/network.rb +46 -0
- data/lib/fog/openstack/models/network/networks.rb +34 -0
- data/lib/fog/openstack/models/network/port.rb +52 -0
- data/lib/fog/openstack/models/network/ports.rb +34 -0
- data/lib/fog/openstack/models/network/subnet.rb +55 -0
- data/lib/fog/openstack/models/network/subnets.rb +34 -0
- data/lib/fog/openstack/network.rb +234 -0
- data/lib/fog/openstack/requests/compute/attach_volume.rb +10 -0
- data/lib/fog/openstack/requests/compute/create_security_group.rb +15 -11
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +17 -15
- data/lib/fog/openstack/requests/compute/create_server.rb +7 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +5 -0
- data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +4 -4
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +9 -9
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +3 -3
- data/lib/fog/openstack/requests/compute/list_volumes.rb +14 -14
- data/lib/fog/openstack/requests/identity/create_tenant.rb +3 -3
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/get_tenant.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_roles.rb +7 -0
- data/lib/fog/openstack/requests/image/create_image.rb +36 -38
- data/lib/fog/openstack/requests/image/delete_image.rb +0 -2
- data/lib/fog/openstack/requests/image/list_public_images.rb +7 -25
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +2 -41
- data/lib/fog/openstack/requests/image/update_image.rb +26 -21
- data/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
- data/lib/fog/openstack/requests/network/create_network.rb +44 -0
- data/lib/fog/openstack/requests/network/create_port.rb +52 -0
- data/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
- data/lib/fog/openstack/requests/network/delete_network.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_port.rb +30 -0
- data/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
- data/lib/fog/openstack/requests/network/get_network.rb +42 -0
- data/lib/fog/openstack/requests/network/get_port.rb +48 -0
- data/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
- data/lib/fog/openstack/requests/network/list_networks.rb +27 -0
- data/lib/fog/openstack/requests/network/list_ports.rb +27 -0
- data/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
- data/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
- data/lib/fog/openstack/requests/network/update_network.rb +41 -0
- data/lib/fog/openstack/requests/network/update_port.rb +44 -0
- data/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
- data/lib/fog/openstack/requests/volume/create_volume.rb +10 -10
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +16 -1
- data/lib/fog/openstack/requests/volume/get_snapshot_details.rb +6 -6
- data/lib/fog/openstack/requests/volume/get_volume_details.rb +10 -10
- data/lib/fog/openstack/requests/volume/list_volumes.rb +14 -14
- data/lib/fog/openstack/volume.rb +10 -0
- data/lib/fog/rackspace/models/compute/server.rb +1 -24
- data/lib/fog/rackspace/models/compute_v2/server.rb +4 -2
- data/lib/fog/rackspace/requests/compute_v2/create_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/server.rb +1 -5
- data/lib/fog/virtual_box/models/compute/server.rb +2 -44
- data/lib/fog/vmfusion/models/compute/server.rb +3 -36
- data/lib/fog/vsphere/models/compute/server.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -31
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +35 -7
- data/tests/aws/models/cdn/distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/distributions_tests.rb +15 -0
- data/tests/aws/models/cdn/invalidation_tests.rb +32 -0
- data/tests/aws/models/cdn/invalidations_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distribution_tests.rb +15 -0
- data/tests/aws/models/cdn/streaming_distributions_tests.rb +15 -0
- data/tests/aws/models/rds/tagging_tests.rb +20 -0
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +1 -11
- data/tests/aws/requests/auto_scaling/describe_types_tests.rb +102 -0
- data/tests/aws/requests/auto_scaling/helper.rb +47 -3
- data/tests/aws/requests/auto_scaling/notification_configuration_tests.rb +123 -0
- data/tests/aws/requests/auto_scaling/tag_tests.rb +62 -0
- data/tests/aws/requests/cdn/cdn_tests.rb +252 -0
- data/tests/aws/requests/compute/image_tests.rb +32 -1
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/describe_events.rb +16 -0
- data/tests/aws/requests/rds/helper.rb +26 -0
- data/tests/aws/requests/rds/subnet_groups_test.rb +48 -0
- data/tests/aws/requests/rds/tagging_tests.rb +78 -0
- data/tests/brightbox/requests/compute/account_tests.rb +24 -4
- data/tests/brightbox/requests/compute/application_test.rb +63 -0
- data/tests/brightbox/requests/compute/helper.rb +49 -1
- data/tests/helper.rb +4 -1
- data/tests/local/models/directory_tests.rb +16 -0
- data/tests/ninefold/requests/compute/helper.rb +53 -0
- data/tests/ninefold/requests/compute/load_balancer_tests.rb +66 -0
- data/tests/openstack/models/image/image_tests.rb +1 -0
- data/tests/openstack/models/network/network_tests.rb +24 -0
- data/tests/openstack/models/network/networks_tests.rb +21 -0
- data/tests/openstack/models/network/port_tests.rb +28 -0
- data/tests/openstack/models/network/ports_tests.rb +25 -0
- data/tests/openstack/models/network/subnet_tests.rb +30 -0
- data/tests/openstack/models/network/subnets_tests.rb +27 -0
- data/tests/openstack/requests/compute/image_tests.rb +3 -4
- data/tests/openstack/requests/compute/quota_tests.rb +2 -0
- data/tests/openstack/requests/compute/security_group_tests.rb +10 -10
- data/tests/openstack/requests/compute/server_tests.rb +3 -1
- data/tests/openstack/requests/compute/volume_tests.rb +11 -12
- data/tests/openstack/requests/identity/tenant_tests.rb +2 -1
- data/tests/openstack/requests/image/image_tests.rb +66 -45
- data/tests/openstack/requests/network/network_tests.rb +56 -0
- data/tests/openstack/requests/network/port_tests.rb +63 -0
- data/tests/openstack/requests/network/subnet_tests.rb +66 -0
- data/tests/rackspace/models/identity/user_tests.rb +1 -1
- data/tests/rackspace/models/identity/users_tests.rb +1 -1
- metadata +137 -13
- data/lib/fog/ninefold/models/storage/directories.rb +0 -48
- data/lib/fog/ninefold/models/storage/directory.rb +0 -53
- data/lib/fog/ninefold/models/storage/file.rb +0 -108
- data/lib/fog/ninefold/models/storage/files.rb +0 -73
- data/lib/fog/ninefold/requests/storage/delete_namespace.rb +0 -19
- data/lib/fog/ninefold/requests/storage/get_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/post_namespace.rb +0 -20
- data/lib/fog/ninefold/requests/storage/put_namespace.rb +0 -20
@@ -23,7 +23,6 @@ module Fog
|
|
23
23
|
attribute :template
|
24
24
|
|
25
25
|
attr_accessor :hostname, :password, :lb_applications, :lb_services, :lb_backends
|
26
|
-
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
27
26
|
|
28
27
|
def initialize(attributes={})
|
29
28
|
self.flavor_id ||= '94fd37a7-2606-47f7-84d5-9000deda52ae' # Block 1GB Virtual Server
|
@@ -57,28 +56,10 @@ module Fog
|
|
57
56
|
nil
|
58
57
|
end
|
59
58
|
|
60
|
-
def private_key_path
|
61
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
62
|
-
@private_key_path &&= File.expand_path(@private_key_path)
|
63
|
-
end
|
64
|
-
|
65
|
-
def private_key
|
66
|
-
@private_key ||= private_key_path && File.read(private_key_path)
|
67
|
-
end
|
68
|
-
|
69
59
|
def public_ip_address
|
70
60
|
ips.first
|
71
61
|
end
|
72
62
|
|
73
|
-
def public_key_path
|
74
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
75
|
-
@public_key_path &&= File.expand_path(@public_key_path)
|
76
|
-
end
|
77
|
-
|
78
|
-
def public_key
|
79
|
-
@public_key ||= public_key_path && File.read(public_key_path)
|
80
|
-
end
|
81
|
-
|
82
63
|
def ready?
|
83
64
|
self.state == 'running'
|
84
65
|
end
|
@@ -6,22 +6,22 @@ module Fog
|
|
6
6
|
# Create a new block
|
7
7
|
#
|
8
8
|
# ==== Parameters
|
9
|
-
# * product_id<~String>
|
10
|
-
# * template_id<~String>
|
11
|
-
# * location_id<~String>
|
9
|
+
# * product_id<~String> - ID of block product (size)
|
10
|
+
# * template_id<~String> - ID of block OS/build template
|
11
|
+
# * location_id<~String> - ID of deployment location
|
12
12
|
# * options<~Hash>:
|
13
|
-
# * password<~String>
|
13
|
+
# * password<~String> - Password for block
|
14
14
|
# or
|
15
|
-
# *
|
16
|
-
#
|
15
|
+
# * public_key<~String> - SSH public key
|
16
|
+
# * username<~String> - Defaults to deploy
|
17
17
|
#
|
18
18
|
# ==== Returns
|
19
19
|
# * response<~Excon::Response>:
|
20
20
|
# * body<~Hash>:
|
21
21
|
def create_block(product_id, template_id, location_id, options = {})
|
22
22
|
|
23
|
-
unless options.has_key?(
|
24
|
-
raise ArgumentError, 'Either password or
|
23
|
+
unless options.has_key?('password') || options.has_key?('public_key')
|
24
|
+
raise ArgumentError, 'Either password or public_key must be supplied'
|
25
25
|
end
|
26
26
|
|
27
27
|
query = {
|
@@ -7,11 +7,25 @@ module Fog
|
|
7
7
|
|
8
8
|
API_URL = "https://api.gb1.brightbox.com/"
|
9
9
|
|
10
|
+
# Client credentials
|
10
11
|
requires :brightbox_client_id, :brightbox_secret
|
11
|
-
|
12
|
+
|
13
|
+
# API endpoint settings
|
14
|
+
recognizes :brightbox_auth_url, :brightbox_api_url
|
15
|
+
|
16
|
+
# User credentials (still requires client details)
|
17
|
+
recognizes :brightbox_username, :brightbox_password, :brightbox_account
|
18
|
+
|
19
|
+
# Excon connection settings
|
20
|
+
recognizes :persistent
|
12
21
|
|
13
22
|
model_path 'fog/brightbox/models/compute'
|
14
|
-
|
23
|
+
collection :accounts
|
24
|
+
model :account
|
25
|
+
collection :applications
|
26
|
+
model :application
|
27
|
+
collection :api_clients
|
28
|
+
model :api_client
|
15
29
|
collection :servers
|
16
30
|
model :server
|
17
31
|
collection :server_groups
|
@@ -41,6 +55,7 @@ module Fog
|
|
41
55
|
request :apply_to_firewall_policy
|
42
56
|
request :remove_firewall_policy
|
43
57
|
request :create_api_client
|
58
|
+
request :create_application
|
44
59
|
request :create_cloud_ip
|
45
60
|
request :create_firewall_policy
|
46
61
|
request :create_firewall_rule
|
@@ -49,6 +64,7 @@ module Fog
|
|
49
64
|
request :create_server
|
50
65
|
request :create_server_group
|
51
66
|
request :destroy_api_client
|
67
|
+
request :destroy_application
|
52
68
|
request :destroy_cloud_ip
|
53
69
|
request :destroy_firewall_policy
|
54
70
|
request :destroy_firewall_rule
|
@@ -58,18 +74,23 @@ module Fog
|
|
58
74
|
request :destroy_server_group
|
59
75
|
request :get_account
|
60
76
|
request :get_api_client
|
77
|
+
request :get_application
|
78
|
+
request :get_authenticated_user
|
61
79
|
request :get_cloud_ip
|
62
80
|
request :get_firewall_policy
|
63
81
|
request :get_firewall_rule
|
64
82
|
request :get_image
|
65
83
|
request :get_interface
|
66
84
|
request :get_load_balancer
|
85
|
+
request :get_scoped_account
|
67
86
|
request :get_server
|
68
87
|
request :get_server_group
|
69
88
|
request :get_server_type
|
70
89
|
request :get_user
|
71
90
|
request :get_zone
|
91
|
+
request :list_accounts
|
72
92
|
request :list_api_clients
|
93
|
+
request :list_applications
|
73
94
|
request :list_cloud_ips
|
74
95
|
request :list_firewall_policies
|
75
96
|
request :list_images
|
@@ -86,6 +107,7 @@ module Fog
|
|
86
107
|
request :remove_servers_server_group
|
87
108
|
request :reset_ftp_password_account
|
88
109
|
request :reset_secret_api_client
|
110
|
+
request :reset_secret_application
|
89
111
|
request :shutdown_server
|
90
112
|
request :snapshot_server
|
91
113
|
request :start_server
|
@@ -93,10 +115,12 @@ module Fog
|
|
93
115
|
request :unmap_cloud_ip
|
94
116
|
request :update_account
|
95
117
|
request :update_api_client
|
118
|
+
request :update_application
|
96
119
|
request :update_cloud_ip
|
97
120
|
request :update_firewall_rule
|
98
121
|
request :update_image
|
99
122
|
request :update_load_balancer
|
123
|
+
request :update_scoped_account
|
100
124
|
request :update_server
|
101
125
|
request :update_server_group
|
102
126
|
request :update_user
|
@@ -145,22 +169,37 @@ module Fog
|
|
145
169
|
@connection_options = options[:connection_options] || {}
|
146
170
|
@brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id]
|
147
171
|
@brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret]
|
172
|
+
@brightbox_username = options[:brightbox_username] || Fog.credentials[:brightbox_username]
|
173
|
+
@brightbox_password = options[:brightbox_password] || Fog.credentials[:brightbox_password]
|
174
|
+
@brightbox_account = options[:brightbox_account] || Fog.credentials[:brightbox_account]
|
148
175
|
@persistent = options[:persistent] || false
|
149
176
|
@connection = Fog::Connection.new(@api_url, @persistent, @connection_options)
|
150
177
|
end
|
151
178
|
|
152
|
-
def request(method, url, expected_responses, options =
|
179
|
+
def request(method, url, expected_responses, options = {})
|
153
180
|
request_options = {
|
154
181
|
:method => method.to_s.upcase,
|
155
182
|
:path => url,
|
156
183
|
:expects => expected_responses
|
157
184
|
}
|
158
|
-
|
185
|
+
options[:account_id] = @brightbox_account if options[:account_id].nil? && @brightbox_account
|
186
|
+
request_options[:body] = Fog::JSON.encode(options) unless options.empty?
|
159
187
|
make_request(request_options)
|
160
188
|
end
|
161
189
|
|
190
|
+
# Returns the scoped account being used for requests
|
191
|
+
#
|
192
|
+
# API Clients:: This is the owning account
|
193
|
+
# User Apps:: This is the account specified by either +account_id+
|
194
|
+
# option on a connection or the +brightbox_account+
|
195
|
+
# setting in your configuration
|
196
|
+
#
|
197
|
+
# === Returns:
|
198
|
+
#
|
199
|
+
# <tt>Fog::Compute::Brightbox::Account</tt>
|
200
|
+
#
|
162
201
|
def account
|
163
|
-
Fog::Compute::Brightbox::Account.new(
|
202
|
+
Fog::Compute::Brightbox::Account.new(get_scoped_account)
|
164
203
|
end
|
165
204
|
|
166
205
|
private
|
@@ -168,7 +207,17 @@ module Fog
|
|
168
207
|
auth_url = options[:brightbox_auth_url] || @auth_url
|
169
208
|
|
170
209
|
connection = Fog::Connection.new(auth_url)
|
171
|
-
|
210
|
+
authentication_body_hash = if @brightbox_username && @brightbox_password
|
211
|
+
{
|
212
|
+
'client_id' => @brightbox_client_id,
|
213
|
+
'grant_type' => 'password',
|
214
|
+
'username' => @brightbox_username,
|
215
|
+
'password' => @brightbox_password
|
216
|
+
}
|
217
|
+
else
|
218
|
+
{'client_id' => @brightbox_client_id, 'grant_type' => 'none'}
|
219
|
+
end
|
220
|
+
@authentication_body = Fog::JSON.encode(authentication_body_hash)
|
172
221
|
|
173
222
|
response = connection.request({
|
174
223
|
:path => "/token",
|
@@ -209,7 +258,7 @@ module Fog
|
|
209
258
|
def select_default_image
|
210
259
|
return @default_image_id unless @default_image_id.nil?
|
211
260
|
|
212
|
-
all_images =
|
261
|
+
all_images = list_images
|
213
262
|
official_images = all_images.select {|img| img["official"] == true}
|
214
263
|
ubuntu_lts_images = official_images.select {|img| img["name"] =~ /Ubuntu.*LTS/}
|
215
264
|
ubuntu_lts_i686_images = ubuntu_lts_images.select {|img| img["arch"] == "i686"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/brightbox/models/compute/account'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class Brightbox
|
7
|
+
|
8
|
+
class Accounts < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::Compute::Brightbox::Account
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.list_accounts
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(identifier)
|
18
|
+
return nil if identifier.nil? || identifier == ""
|
19
|
+
data = connection.get_account(identifier)
|
20
|
+
new(data)
|
21
|
+
rescue Excon::Errors::NotFound
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Brightbox
|
4
|
+
class ApiClient < Fog::Model
|
5
|
+
identity :id
|
6
|
+
attribute :name
|
7
|
+
attribute :description
|
8
|
+
attribute :secret
|
9
|
+
attribute :revoked_at, :type => :time
|
10
|
+
attribute :account_id
|
11
|
+
|
12
|
+
def save
|
13
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
14
|
+
options = {
|
15
|
+
:name => name,
|
16
|
+
:description => description
|
17
|
+
}.delete_if {|k,v| v.nil? || v == "" }
|
18
|
+
data = connection.create_api_client(options)
|
19
|
+
merge_attributes(data)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy
|
24
|
+
requires :identity
|
25
|
+
connection.destroy_api_client(identity)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def reset_secret
|
30
|
+
requires :identity
|
31
|
+
connection.reset_secret_api_client(identity)
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "fog/core/collection"
|
2
|
+
require "fog/brightbox/models/compute/api_client"
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class Brightbox
|
7
|
+
class ApiClients < Fog::Collection
|
8
|
+
model Fog::Compute::Brightbox::ApiClient
|
9
|
+
|
10
|
+
def all
|
11
|
+
data = connection.list_api_clients
|
12
|
+
load(data)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(identifier = nil)
|
16
|
+
data = connection.get_api_client(identifier)
|
17
|
+
new(data)
|
18
|
+
rescue Excon::Errors::NotFound
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Brightbox
|
6
|
+
|
7
|
+
class Application < Fog::Model
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
attribute :url
|
11
|
+
attribute :name
|
12
|
+
attribute :secret
|
13
|
+
|
14
|
+
def save
|
15
|
+
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
16
|
+
options = {
|
17
|
+
:name => name
|
18
|
+
}.delete_if {|k,v| v.nil? || v == "" }
|
19
|
+
data = connection.create_application(options)
|
20
|
+
merge_attributes(data)
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/brightbox/models/compute/application'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class Brightbox
|
7
|
+
|
8
|
+
class Applications < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::Compute::Brightbox::Application
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.list_applications
|
14
|
+
load(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(identifier)
|
18
|
+
data = connection.get_application(identifier)
|
19
|
+
new(data)
|
20
|
+
rescue Excon::Errors::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -38,8 +38,10 @@ module Fog
|
|
38
38
|
attribute :server_type
|
39
39
|
|
40
40
|
def initialize(attributes={})
|
41
|
-
|
41
|
+
# Call super first to initialize the 'connection' object for our default image
|
42
42
|
super
|
43
|
+
# FIXME connection is actually <Fog::Compute::Brightbox::Real> not <Fog::Connection>
|
44
|
+
self.image_id ||= connection.default_image
|
43
45
|
end
|
44
46
|
|
45
47
|
def zone_id
|
@@ -14,14 +14,12 @@ module Fog
|
|
14
14
|
load(data)
|
15
15
|
end
|
16
16
|
|
17
|
-
def get(identifier)
|
18
|
-
return nil if identifier.nil? || identifier == ""
|
17
|
+
def get(identifier = nil)
|
19
18
|
data = connection.get_user(identifier)
|
20
19
|
new(data)
|
21
20
|
rescue Excon::Errors::NotFound
|
22
21
|
nil
|
23
22
|
end
|
24
|
-
|
25
23
|
end
|
26
24
|
|
27
25
|
end
|
@@ -2,12 +2,36 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# Requests details about an account from the API
|
6
|
+
#
|
7
|
+
# === Parameters:
|
8
|
+
#
|
9
|
+
# <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
|
10
|
+
#
|
11
|
+
# === Returns:
|
12
|
+
#
|
13
|
+
# <tt>Hash</tt>:: The JSON response parsed to a Hash
|
14
|
+
#
|
15
|
+
# === Notes:
|
16
|
+
#
|
17
|
+
# This also supports a deprecated form where if an identifier is not
|
18
|
+
# passed then the scoping account is returned instead. This should not
|
19
|
+
# be used in new code. Use #get_scoped_account instead.
|
20
|
+
#
|
21
|
+
# === Reference:
|
22
|
+
#
|
23
|
+
# https://api.gb1.brightbox.com/1.0/#account_get_account
|
24
|
+
#
|
25
|
+
def get_account(identifier = nil)
|
26
|
+
if identifier.nil? || identifier.empty?
|
27
|
+
Fog::Logger.deprecation("get_account() without a parameter is deprecated, use get_scoped_account instead [light_black](#{caller.first})[/]")
|
28
|
+
get_scoped_account
|
29
|
+
else
|
30
|
+
request("get", "/1.0/accounts/#{identifier}", [200])
|
31
|
+
end
|
8
32
|
end
|
9
33
|
|
10
34
|
end
|
11
35
|
end
|
12
36
|
end
|
13
|
-
end
|
37
|
+
end
|