hpcloud 2.0.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/CHANGELOG +127 -0
- data/LICENSE +1 -0
- data/README.rdoc +59 -0
- data/bin/hpcloud +11 -0
- data/completion/hpcloud +372 -0
- data/lib/hpcloud/accounts.rb +288 -0
- data/lib/hpcloud/acl.rb +112 -0
- data/lib/hpcloud/acl_cmd.rb +81 -0
- data/lib/hpcloud/address_helper.rb +63 -0
- data/lib/hpcloud/addresses.rb +42 -0
- data/lib/hpcloud/auth_cache.rb +128 -0
- data/lib/hpcloud/base_helper.rb +56 -0
- data/lib/hpcloud/checker.rb +104 -0
- data/lib/hpcloud/cli.rb +170 -0
- data/lib/hpcloud/cli_status.rb +80 -0
- data/lib/hpcloud/columns.rb +46 -0
- data/lib/hpcloud/commands/account/catalog.rb +57 -0
- data/lib/hpcloud/commands/account/copy.rb +44 -0
- data/lib/hpcloud/commands/account/edit.rb +204 -0
- data/lib/hpcloud/commands/account/remove.rb +53 -0
- data/lib/hpcloud/commands/account/setup.rb +40 -0
- data/lib/hpcloud/commands/account/tenants.rb +43 -0
- data/lib/hpcloud/commands/account/use.rb +46 -0
- data/lib/hpcloud/commands/account/verify.rb +55 -0
- data/lib/hpcloud/commands/account.rb +67 -0
- data/lib/hpcloud/commands/acl/grant.rb +59 -0
- data/lib/hpcloud/commands/acl/revoke.rb +52 -0
- data/lib/hpcloud/commands/acl.rb +63 -0
- data/lib/hpcloud/commands/addresses/add.rb +67 -0
- data/lib/hpcloud/commands/addresses/associate.rb +63 -0
- data/lib/hpcloud/commands/addresses/disassociate.rb +58 -0
- data/lib/hpcloud/commands/addresses/remove.rb +57 -0
- data/lib/hpcloud/commands/addresses.rb +63 -0
- data/lib/hpcloud/commands/cdn_containers/add.rb +56 -0
- data/lib/hpcloud/commands/cdn_containers/get.rb +70 -0
- data/lib/hpcloud/commands/cdn_containers/location.rb +61 -0
- data/lib/hpcloud/commands/cdn_containers/remove.rb +55 -0
- data/lib/hpcloud/commands/cdn_containers/set.rb +63 -0
- data/lib/hpcloud/commands/cdn_containers.rb +72 -0
- data/lib/hpcloud/commands/complete.rb +60 -0
- data/lib/hpcloud/commands/config/set.rb +63 -0
- data/lib/hpcloud/commands/config.rb +46 -0
- data/lib/hpcloud/commands/containers/add.rb +67 -0
- data/lib/hpcloud/commands/containers/remove.rb +63 -0
- data/lib/hpcloud/commands/containers/sync.rb +59 -0
- data/lib/hpcloud/commands/containers.rb +24 -0
- data/lib/hpcloud/commands/copy.rb +78 -0
- data/lib/hpcloud/commands/dns/add.rb +56 -0
- data/lib/hpcloud/commands/dns/records/add.rb +50 -0
- data/lib/hpcloud/commands/dns/records/remove.rb +53 -0
- data/lib/hpcloud/commands/dns/records/update.rb +50 -0
- data/lib/hpcloud/commands/dns/records.rb +57 -0
- data/lib/hpcloud/commands/dns/remove.rb +57 -0
- data/lib/hpcloud/commands/dns/servers.rb +57 -0
- data/lib/hpcloud/commands/dns/update.rb +58 -0
- data/lib/hpcloud/commands/dns.rb +65 -0
- data/lib/hpcloud/commands/flavors.rb +59 -0
- data/lib/hpcloud/commands/get.rb +58 -0
- data/lib/hpcloud/commands/images/add.rb +54 -0
- data/lib/hpcloud/commands/images/metadata/add.rb +54 -0
- data/lib/hpcloud/commands/images/metadata/remove.rb +56 -0
- data/lib/hpcloud/commands/images/metadata.rb +54 -0
- data/lib/hpcloud/commands/images/remove.rb +58 -0
- data/lib/hpcloud/commands/images.rb +67 -0
- data/lib/hpcloud/commands/info.rb +41 -0
- data/lib/hpcloud/commands/keypairs/add.rb +73 -0
- data/lib/hpcloud/commands/keypairs/import.rb +62 -0
- data/lib/hpcloud/commands/keypairs/private/add.rb +44 -0
- data/lib/hpcloud/commands/keypairs/private/location.rb +50 -0
- data/lib/hpcloud/commands/keypairs/private/remove.rb +52 -0
- data/lib/hpcloud/commands/keypairs/private.rb +47 -0
- data/lib/hpcloud/commands/keypairs/public_key.rb +51 -0
- data/lib/hpcloud/commands/keypairs/remove.rb +58 -0
- data/lib/hpcloud/commands/keypairs.rb +64 -0
- data/lib/hpcloud/commands/lb/add.rb +92 -0
- data/lib/hpcloud/commands/lb/algorithms.rb +55 -0
- data/lib/hpcloud/commands/lb/limits.rb +55 -0
- data/lib/hpcloud/commands/lb/nodes/add.rb +47 -0
- data/lib/hpcloud/commands/lb/nodes/remove.rb +54 -0
- data/lib/hpcloud/commands/lb/nodes/update.rb +47 -0
- data/lib/hpcloud/commands/lb/nodes.rb +55 -0
- data/lib/hpcloud/commands/lb/protocols.rb +55 -0
- data/lib/hpcloud/commands/lb/remove.rb +54 -0
- data/lib/hpcloud/commands/lb/update.rb +46 -0
- data/lib/hpcloud/commands/lb/versions.rb +55 -0
- data/lib/hpcloud/commands/lb/virtualips.rb +51 -0
- data/lib/hpcloud/commands/lb.rb +73 -0
- data/lib/hpcloud/commands/list.rb +114 -0
- data/lib/hpcloud/commands/location.rb +56 -0
- data/lib/hpcloud/commands/metadata/set.rb +61 -0
- data/lib/hpcloud/commands/metadata.rb +60 -0
- data/lib/hpcloud/commands/migrate.rb +61 -0
- data/lib/hpcloud/commands/move.rb +73 -0
- data/lib/hpcloud/commands/networks/add.rb +55 -0
- data/lib/hpcloud/commands/networks/remove.rb +57 -0
- data/lib/hpcloud/commands/networks/update.rb +54 -0
- data/lib/hpcloud/commands/networks.rb +63 -0
- data/lib/hpcloud/commands/ports/add.rb +81 -0
- data/lib/hpcloud/commands/ports/remove.rb +57 -0
- data/lib/hpcloud/commands/ports/update.rb +67 -0
- data/lib/hpcloud/commands/ports.rb +63 -0
- data/lib/hpcloud/commands/remove.rb +75 -0
- data/lib/hpcloud/commands/routers/add.rb +67 -0
- data/lib/hpcloud/commands/routers/interface/add.rb +59 -0
- data/lib/hpcloud/commands/routers/interface/remove.rb +66 -0
- data/lib/hpcloud/commands/routers/remove.rb +54 -0
- data/lib/hpcloud/commands/routers/update.rb +66 -0
- data/lib/hpcloud/commands/routers.rb +66 -0
- data/lib/hpcloud/commands/securitygroups/add.rb +52 -0
- data/lib/hpcloud/commands/securitygroups/remove.rb +57 -0
- data/lib/hpcloud/commands/securitygroups/rules/add.rb +126 -0
- data/lib/hpcloud/commands/securitygroups/rules/remove.rb +51 -0
- data/lib/hpcloud/commands/securitygroups/rules.rb +56 -0
- data/lib/hpcloud/commands/securitygroups.rb +62 -0
- data/lib/hpcloud/commands/servers/add.rb +100 -0
- data/lib/hpcloud/commands/servers/console.rb +81 -0
- data/lib/hpcloud/commands/servers/limits.rb +46 -0
- data/lib/hpcloud/commands/servers/metadata/add.rb +56 -0
- data/lib/hpcloud/commands/servers/metadata/remove.rb +57 -0
- data/lib/hpcloud/commands/servers/metadata.rb +56 -0
- data/lib/hpcloud/commands/servers/password.rb +47 -0
- data/lib/hpcloud/commands/servers/ratelimits.rb +46 -0
- data/lib/hpcloud/commands/servers/reboot.rb +61 -0
- data/lib/hpcloud/commands/servers/rebuild.rb +59 -0
- data/lib/hpcloud/commands/servers/remove.rb +58 -0
- data/lib/hpcloud/commands/servers/securitygroups/add.rb +47 -0
- data/lib/hpcloud/commands/servers/securitygroups/remove.rb +47 -0
- data/lib/hpcloud/commands/servers/ssh.rb +92 -0
- data/lib/hpcloud/commands/servers.rb +92 -0
- data/lib/hpcloud/commands/snapshots/add.rb +62 -0
- data/lib/hpcloud/commands/snapshots/remove.rb +58 -0
- data/lib/hpcloud/commands/snapshots.rb +62 -0
- data/lib/hpcloud/commands/subnets/add.rb +78 -0
- data/lib/hpcloud/commands/subnets/remove.rb +57 -0
- data/lib/hpcloud/commands/subnets/update.rb +70 -0
- data/lib/hpcloud/commands/subnets.rb +63 -0
- data/lib/hpcloud/commands/tempurl.rb +62 -0
- data/lib/hpcloud/commands/volumes/add.rb +88 -0
- data/lib/hpcloud/commands/volumes/attach.rb +59 -0
- data/lib/hpcloud/commands/volumes/detach.rb +57 -0
- data/lib/hpcloud/commands/volumes/metadata/add.rb +54 -0
- data/lib/hpcloud/commands/volumes/metadata.rb +55 -0
- data/lib/hpcloud/commands/volumes/remove.rb +57 -0
- data/lib/hpcloud/commands/volumes/server.rb +64 -0
- data/lib/hpcloud/commands/volumes.rb +65 -0
- data/lib/hpcloud/config.rb +205 -0
- data/lib/hpcloud/connection.rb +290 -0
- data/lib/hpcloud/container_resource.rb +175 -0
- data/lib/hpcloud/database_helper.rb +70 -0
- data/lib/hpcloud/databases.rb +38 -0
- data/lib/hpcloud/dns_helper.rb +125 -0
- data/lib/hpcloud/dnss.rb +38 -0
- data/lib/hpcloud/error_response.rb +89 -0
- data/lib/hpcloud/exceptions/base.rb +35 -0
- data/lib/hpcloud/exceptions/general.rb +34 -0
- data/lib/hpcloud/exceptions/not_found.rb +34 -0
- data/lib/hpcloud/flavors.rb +40 -0
- data/lib/hpcloud/floating_ip_helper.rb +114 -0
- data/lib/hpcloud/floating_ips.rb +42 -0
- data/lib/hpcloud/fog_collection.rb +124 -0
- data/lib/hpcloud/image_helper.rb +111 -0
- data/lib/hpcloud/images.rb +43 -0
- data/lib/hpcloud/keypair_helper.rb +109 -0
- data/lib/hpcloud/keypairs.rb +41 -0
- data/lib/hpcloud/lb_algorithms.rb +37 -0
- data/lib/hpcloud/lb_limits.rb +37 -0
- data/lib/hpcloud/lb_nodes.rb +42 -0
- data/lib/hpcloud/lb_protocols.rb +37 -0
- data/lib/hpcloud/lb_versions.rb +37 -0
- data/lib/hpcloud/lb_virtualips.rb +42 -0
- data/lib/hpcloud/lbs.rb +38 -0
- data/lib/hpcloud/local_resource.rb +183 -0
- data/lib/hpcloud/log.rb +55 -0
- data/lib/hpcloud/metadata.rb +118 -0
- data/lib/hpcloud/monkey.rb +22 -0
- data/lib/hpcloud/network_helper.rb +88 -0
- data/lib/hpcloud/networks.rb +47 -0
- data/lib/hpcloud/object_store.rb +66 -0
- data/lib/hpcloud/port_helper.rb +150 -0
- data/lib/hpcloud/ports.rb +38 -0
- data/lib/hpcloud/progress.rb +53 -0
- data/lib/hpcloud/remote_resource.rb +512 -0
- data/lib/hpcloud/resource.rb +264 -0
- data/lib/hpcloud/resource_factory.rb +110 -0
- data/lib/hpcloud/routers.rb +56 -0
- data/lib/hpcloud/rule_helper.rb +70 -0
- data/lib/hpcloud/rules.rb +41 -0
- data/lib/hpcloud/security_group_helper.rb +59 -0
- data/lib/hpcloud/security_groups.rb +37 -0
- data/lib/hpcloud/server_helper.rb +318 -0
- data/lib/hpcloud/servers.rb +47 -0
- data/lib/hpcloud/shared_resource.rb +172 -0
- data/lib/hpcloud/snapshot_helper.rb +78 -0
- data/lib/hpcloud/snapshots.rb +38 -0
- data/lib/hpcloud/subnet_helper.rb +170 -0
- data/lib/hpcloud/subnets.rb +38 -0
- data/lib/hpcloud/tableizer.rb +77 -0
- data/lib/hpcloud/thor_ext/thor.rb +54 -0
- data/lib/hpcloud/time_parser.rb +47 -0
- data/lib/hpcloud/version.rb +27 -0
- data/lib/hpcloud/volume_attachment.rb +58 -0
- data/lib/hpcloud/volume_attachments.rb +58 -0
- data/lib/hpcloud/volume_helper.rb +119 -0
- data/lib/hpcloud/volumes.rb +38 -0
- data/lib/hpcloud.rb +112 -0
- data/lib/monkey/hp/lb.rb +188 -0
- data/lib/monkey/hp/models/lb/algorithm.rb +32 -0
- data/lib/monkey/hp/models/lb/algorithms.rb +46 -0
- data/lib/monkey/hp/models/lb/limit.rb +38 -0
- data/lib/monkey/hp/models/lb/limits.rb +50 -0
- data/lib/monkey/hp/models/lb/load_balancer.rb +70 -0
- data/lib/monkey/hp/models/lb/load_balancers.rb +46 -0
- data/lib/monkey/hp/models/lb/node.rb +69 -0
- data/lib/monkey/hp/models/lb/nodes.rb +47 -0
- data/lib/monkey/hp/models/lb/protocol.rb +33 -0
- data/lib/monkey/hp/models/lb/protocols.rb +46 -0
- data/lib/monkey/hp/models/lb/version.rb +34 -0
- data/lib/monkey/hp/models/lb/versions.rb +47 -0
- data/lib/monkey/hp/models/lb/virtual_ip.rb +37 -0
- data/lib/monkey/hp/models/lb/virtual_ips.rb +47 -0
- data/lib/monkey/hp/requests/lb/create_load_balancer.rb +64 -0
- data/lib/monkey/hp/requests/lb/create_load_balancer_node.rb +58 -0
- data/lib/monkey/hp/requests/lb/delete_load_balancer.rb +54 -0
- data/lib/monkey/hp/requests/lb/delete_load_balancer_node.rb +60 -0
- data/lib/monkey/hp/requests/lb/get_load_balancer.rb +88 -0
- data/lib/monkey/hp/requests/lb/get_load_balancer_node.rb +60 -0
- data/lib/monkey/hp/requests/lb/get_version.rb +68 -0
- data/lib/monkey/hp/requests/lb/get_virtual_ips.rb +48 -0
- data/lib/monkey/hp/requests/lb/list_algorithms.rb +51 -0
- data/lib/monkey/hp/requests/lb/list_limits.rb +60 -0
- data/lib/monkey/hp/requests/lb/list_load_balancer_nodes.rb +79 -0
- data/lib/monkey/hp/requests/lb/list_load_balancer_virtual_ips.rb +76 -0
- data/lib/monkey/hp/requests/lb/list_load_balancers.rb +69 -0
- data/lib/monkey/hp/requests/lb/list_protocols.rb +51 -0
- data/lib/monkey/hp/requests/lb/list_versions.rb +51 -0
- data/lib/monkey/hp/requests/lb/update_load_balancer.rb +46 -0
- data/lib/monkey/hp/requests/lb/update_load_balancer_node.rb +50 -0
- metadata +368 -0
data/lib/hpcloud.rb
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require "bundler/setup" # Comment out for delivery
|
|
23
|
+
require 'fog'
|
|
24
|
+
|
|
25
|
+
require 'hpcloud/version'
|
|
26
|
+
require 'hpcloud/error_response'
|
|
27
|
+
require 'hpcloud/cli_status'
|
|
28
|
+
require 'hpcloud/monkey'
|
|
29
|
+
require 'hpcloud/columns'
|
|
30
|
+
require 'hpcloud/log'
|
|
31
|
+
|
|
32
|
+
require 'hpcloud/base_helper'
|
|
33
|
+
require 'hpcloud/address_helper'
|
|
34
|
+
require 'hpcloud/database_helper'
|
|
35
|
+
require 'hpcloud/dns_helper'
|
|
36
|
+
require 'hpcloud/floating_ip_helper'
|
|
37
|
+
require 'hpcloud/image_helper'
|
|
38
|
+
require 'hpcloud/keypair_helper'
|
|
39
|
+
require 'hpcloud/network_helper'
|
|
40
|
+
require 'hpcloud/port_helper'
|
|
41
|
+
require 'hpcloud/rule_helper'
|
|
42
|
+
require 'hpcloud/security_group_helper'
|
|
43
|
+
require 'hpcloud/server_helper'
|
|
44
|
+
require 'hpcloud/snapshot_helper'
|
|
45
|
+
require 'hpcloud/subnet_helper'
|
|
46
|
+
require 'hpcloud/volume_helper'
|
|
47
|
+
|
|
48
|
+
require 'hpcloud/accounts'
|
|
49
|
+
require 'hpcloud/auth_cache'
|
|
50
|
+
require 'hpcloud/acl'
|
|
51
|
+
require 'hpcloud/acl_cmd'
|
|
52
|
+
require 'hpcloud/addresses'
|
|
53
|
+
require 'hpcloud/checker'
|
|
54
|
+
require 'hpcloud/databases'
|
|
55
|
+
require 'hpcloud/dnss'
|
|
56
|
+
require 'hpcloud/config'
|
|
57
|
+
require 'hpcloud/flavors'
|
|
58
|
+
require 'hpcloud/floating_ips'
|
|
59
|
+
require 'hpcloud/fog_collection'
|
|
60
|
+
require 'hpcloud/keypairs'
|
|
61
|
+
require 'hpcloud/networks'
|
|
62
|
+
require 'hpcloud/ports'
|
|
63
|
+
require 'hpcloud/lbs'
|
|
64
|
+
require 'hpcloud/images'
|
|
65
|
+
require 'hpcloud/metadata'
|
|
66
|
+
require 'hpcloud/progress'
|
|
67
|
+
require 'hpcloud/resource_factory'
|
|
68
|
+
require 'hpcloud/routers'
|
|
69
|
+
require 'hpcloud/rules'
|
|
70
|
+
require 'hpcloud/security_groups'
|
|
71
|
+
require 'hpcloud/servers'
|
|
72
|
+
require 'hpcloud/snapshots'
|
|
73
|
+
require 'hpcloud/subnets'
|
|
74
|
+
require 'hpcloud/tableizer'
|
|
75
|
+
require 'hpcloud/time_parser'
|
|
76
|
+
require 'hpcloud/volumes'
|
|
77
|
+
require 'hpcloud/volume_attachment'
|
|
78
|
+
require 'hpcloud/volume_attachments'
|
|
79
|
+
|
|
80
|
+
require 'hpcloud/cli'
|
|
81
|
+
|
|
82
|
+
require 'hpcloud/commands/account'
|
|
83
|
+
require 'hpcloud/commands/acl'
|
|
84
|
+
require 'hpcloud/commands/addresses'
|
|
85
|
+
require 'hpcloud/commands/cdn_containers'
|
|
86
|
+
require 'hpcloud/commands/complete'
|
|
87
|
+
require 'hpcloud/commands/config'
|
|
88
|
+
require 'hpcloud/commands/containers'
|
|
89
|
+
require 'hpcloud/commands/copy'
|
|
90
|
+
require 'hpcloud/commands/dns'
|
|
91
|
+
require 'hpcloud/commands/flavors'
|
|
92
|
+
require 'hpcloud/commands/get'
|
|
93
|
+
require 'hpcloud/commands/images'
|
|
94
|
+
require 'hpcloud/commands/keypairs'
|
|
95
|
+
require 'hpcloud/commands/lb'
|
|
96
|
+
require 'hpcloud/commands/list'
|
|
97
|
+
require 'hpcloud/commands/location'
|
|
98
|
+
require 'hpcloud/commands/networks'
|
|
99
|
+
require 'hpcloud/commands/metadata'
|
|
100
|
+
require 'hpcloud/commands/metadata/set'
|
|
101
|
+
require 'hpcloud/commands/ports'
|
|
102
|
+
require 'hpcloud/commands/info'
|
|
103
|
+
require 'hpcloud/commands/migrate'
|
|
104
|
+
require 'hpcloud/commands/move'
|
|
105
|
+
require 'hpcloud/commands/remove'
|
|
106
|
+
require 'hpcloud/commands/routers'
|
|
107
|
+
require 'hpcloud/commands/servers'
|
|
108
|
+
require 'hpcloud/commands/securitygroups'
|
|
109
|
+
require 'hpcloud/commands/snapshots'
|
|
110
|
+
require 'hpcloud/commands/subnets'
|
|
111
|
+
require 'hpcloud/commands/tempurl'
|
|
112
|
+
require 'hpcloud/commands/volumes'
|
data/lib/monkey/hp/lb.rb
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/hp'
|
|
23
|
+
|
|
24
|
+
module Fog
|
|
25
|
+
module HP
|
|
26
|
+
class LB < Fog::Service
|
|
27
|
+
|
|
28
|
+
requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
|
29
|
+
recognizes :hp_auth_uri, :credentials
|
|
30
|
+
recognizes :persistent, :connection_options
|
|
31
|
+
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
|
32
|
+
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
|
33
|
+
|
|
34
|
+
secrets :hp_secret_key
|
|
35
|
+
|
|
36
|
+
model_path 'monkey/hp/models/lb'
|
|
37
|
+
model :algorithm
|
|
38
|
+
collection :algorithms
|
|
39
|
+
model :limit
|
|
40
|
+
collection :limits
|
|
41
|
+
model :load_balancer
|
|
42
|
+
collection :load_balancers
|
|
43
|
+
model :node
|
|
44
|
+
collection :nodes
|
|
45
|
+
model :protocol
|
|
46
|
+
collection :protocols
|
|
47
|
+
model :version
|
|
48
|
+
collection :versions
|
|
49
|
+
model :virtual_ip
|
|
50
|
+
collection :virtual_ips
|
|
51
|
+
|
|
52
|
+
request_path 'monkey/hp/requests/lb'
|
|
53
|
+
request :create_load_balancer
|
|
54
|
+
request :create_load_balancer_node
|
|
55
|
+
request :delete_load_balancer
|
|
56
|
+
request :delete_load_balancer_node
|
|
57
|
+
request :get_load_balancer
|
|
58
|
+
request :get_load_balancer_node
|
|
59
|
+
request :get_version
|
|
60
|
+
request :get_virtual_ips
|
|
61
|
+
request :list_algorithms
|
|
62
|
+
request :list_limits
|
|
63
|
+
request :list_load_balancer_nodes
|
|
64
|
+
request :list_load_balancers
|
|
65
|
+
request :list_protocols
|
|
66
|
+
request :list_versions
|
|
67
|
+
request :list_load_balancer_virtual_ips
|
|
68
|
+
request :update_load_balancer
|
|
69
|
+
request :update_load_balancer_node
|
|
70
|
+
|
|
71
|
+
class Mock
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def self.data
|
|
75
|
+
@data ||= Hash.new do |hash, key|
|
|
76
|
+
hash[key] = {
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.reset
|
|
83
|
+
@data = nil
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def initialize(options={})
|
|
87
|
+
# deprecate hp_account_id
|
|
88
|
+
if options[:hp_account_id]
|
|
89
|
+
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
|
90
|
+
@hp_access_key = options.delete(:hp_account_id)
|
|
91
|
+
end
|
|
92
|
+
@hp_access_key = options[:hp_access_key]
|
|
93
|
+
unless @hp_access_key
|
|
94
|
+
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def data
|
|
99
|
+
self.class.data[@hp_access_key]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def reset_data
|
|
103
|
+
self.class.data.delete(@hp_access_key)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
class Real
|
|
109
|
+
attr_reader :credentials
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def initialize(options={})
|
|
113
|
+
# deprecate hp_account_id
|
|
114
|
+
if options[:hp_account_id]
|
|
115
|
+
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
|
116
|
+
options[:hp_access_key] = options.delete(:hp_account_id)
|
|
117
|
+
end
|
|
118
|
+
@hp_access_key = options[:hp_access_key]
|
|
119
|
+
unless @hp_access_key
|
|
120
|
+
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
|
121
|
+
end
|
|
122
|
+
@hp_secret_key = options[:hp_secret_key]
|
|
123
|
+
@hp_auth_uri = options[:hp_auth_uri]
|
|
124
|
+
@connection_options = options[:connection_options] || {}
|
|
125
|
+
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
|
126
|
+
auth_version = options[:hp_auth_version] || :v2
|
|
127
|
+
### Pass the service name for object storage to the authentication call
|
|
128
|
+
options[:hp_service_type] = "Load Balancer"
|
|
129
|
+
@hp_tenant_id = options[:hp_tenant_id]
|
|
130
|
+
@hp_avl_zone = options[:hp_avl_zone]
|
|
131
|
+
|
|
132
|
+
### Make the authentication call
|
|
133
|
+
if (auth_version == :v2)
|
|
134
|
+
# Call the control services authentication
|
|
135
|
+
credentials = Fog::HP.authenticate_v2(options, @connection_options)
|
|
136
|
+
# the CS service catalog returns the block storage endpoint
|
|
137
|
+
@hp_block_uri = credentials[:endpoint_url]
|
|
138
|
+
else
|
|
139
|
+
# Call the legacy v1.0/v1.1 authentication
|
|
140
|
+
credentials = Fog::HP.authenticate_v1(options, @connection_options)
|
|
141
|
+
# the user sends in the block storage endpoint
|
|
142
|
+
@hp_block_uri = options[:hp_auth_uri]
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
@auth_token = credentials[:auth_token]
|
|
146
|
+
@persistent = options[:persistent] || false
|
|
147
|
+
|
|
148
|
+
uri = URI.parse(@hp_block_uri)
|
|
149
|
+
@host = uri.host
|
|
150
|
+
@path = uri.path
|
|
151
|
+
@port = uri.port
|
|
152
|
+
@scheme = uri.scheme
|
|
153
|
+
|
|
154
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def reload
|
|
158
|
+
@connection.reset
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def request(params, parse_json = true, &block)
|
|
162
|
+
begin
|
|
163
|
+
response = @connection.request(params.merge!({
|
|
164
|
+
:headers => {
|
|
165
|
+
'Content-Type' => 'application/json',
|
|
166
|
+
'X-Auth-Token' => @auth_token
|
|
167
|
+
}.merge!(params[:headers] || {}),
|
|
168
|
+
:path => "#{@path}/#{params[:path]}",
|
|
169
|
+
}), &block)
|
|
170
|
+
rescue Excon::Errors::HTTPStatusError => error
|
|
171
|
+
raise case error
|
|
172
|
+
when Excon::Errors::NotFound
|
|
173
|
+
Fog::HP::BlockStorage::NotFound.slurp(error)
|
|
174
|
+
else
|
|
175
|
+
error
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
|
179
|
+
response.body = Fog::JSON.decode(response.body)
|
|
180
|
+
end
|
|
181
|
+
response
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/model'
|
|
23
|
+
|
|
24
|
+
module Fog
|
|
25
|
+
module HP
|
|
26
|
+
class LB
|
|
27
|
+
class Algorithm < Fog::Model
|
|
28
|
+
identity :name
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/collection'
|
|
23
|
+
require 'monkey/hp/models/lb/algorithm'
|
|
24
|
+
|
|
25
|
+
module Fog
|
|
26
|
+
module HP
|
|
27
|
+
class LB
|
|
28
|
+
class Algorithms < Fog::Collection
|
|
29
|
+
model Fog::HP::LB::Algorithm
|
|
30
|
+
|
|
31
|
+
def all
|
|
32
|
+
data = service.list_algorithms.body['algorithms']
|
|
33
|
+
load(data)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def get(record_id)
|
|
37
|
+
record = service.get_algorithm_details(record_id).body['algorithm']
|
|
38
|
+
new(record)
|
|
39
|
+
rescue Fog::HP::LB::NotFound
|
|
40
|
+
nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/model'
|
|
23
|
+
|
|
24
|
+
module Fog
|
|
25
|
+
module HP
|
|
26
|
+
class LB
|
|
27
|
+
class Limit < Fog::Model
|
|
28
|
+
|
|
29
|
+
identity :id
|
|
30
|
+
attribute :max_load_balancer_name_length, :aliases => 'maxLoadBalancerNameLength'
|
|
31
|
+
attribute :max_load_balancers, :aliases => 'maxLoadBalancers'
|
|
32
|
+
attribute :max_nodes_per_load_balancer, :aliases => 'maxNodesPerLoadBalancer'
|
|
33
|
+
attribute :max_vips_per_load_balancer, :aliases => 'maxVIPsPerLoadBalancer'
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/collection'
|
|
23
|
+
require 'monkey/hp/models/lb/limit'
|
|
24
|
+
|
|
25
|
+
module Fog
|
|
26
|
+
module HP
|
|
27
|
+
class LB
|
|
28
|
+
class Limits < Fog::Collection
|
|
29
|
+
model Fog::HP::LB::Limit
|
|
30
|
+
|
|
31
|
+
#{
|
|
32
|
+
# "limits" : {
|
|
33
|
+
# "absolute" : {
|
|
34
|
+
# "values" : {
|
|
35
|
+
# "maxLoadBalancerNameLength" : 128,
|
|
36
|
+
# "maxLoadBalancers" : 20,
|
|
37
|
+
# "maxNodesPerLoadBalancer" : 5,
|
|
38
|
+
# "maxVIPsPerLoadBalancer" : 1
|
|
39
|
+
#}
|
|
40
|
+
#}
|
|
41
|
+
#}
|
|
42
|
+
#}
|
|
43
|
+
def all
|
|
44
|
+
data = service.list_limits.body['limits']['absolute']['values']
|
|
45
|
+
load([data])
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/model'
|
|
23
|
+
|
|
24
|
+
module Fog
|
|
25
|
+
module HP
|
|
26
|
+
class LB
|
|
27
|
+
|
|
28
|
+
class LoadBalancer < Fog::Model
|
|
29
|
+
identity :id
|
|
30
|
+
attribute :name
|
|
31
|
+
attribute :protocol
|
|
32
|
+
attribute :port
|
|
33
|
+
attribute :algorithm
|
|
34
|
+
attribute :status
|
|
35
|
+
attribute :nodes
|
|
36
|
+
attribute :virtualIps
|
|
37
|
+
attribute :created_at, :aliases => 'created'
|
|
38
|
+
attribute :updated_at , :aliases => 'updated'
|
|
39
|
+
|
|
40
|
+
def destroy
|
|
41
|
+
requires :id
|
|
42
|
+
service.delete_load_balancer(id)
|
|
43
|
+
true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def ready?
|
|
47
|
+
self.status == 'ACTIVE'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def save
|
|
51
|
+
identity ? update : create
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def create
|
|
57
|
+
merge_attributes(service.create_load_balancer(name, nodes, attributes).body)
|
|
58
|
+
true
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def update
|
|
62
|
+
requires :id
|
|
63
|
+
merge_attributes(service.update_load_balancer(id, attributes).body)
|
|
64
|
+
true
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/collection'
|
|
23
|
+
require 'monkey/hp/models/lb/load_balancer'
|
|
24
|
+
|
|
25
|
+
module Fog
|
|
26
|
+
module HP
|
|
27
|
+
class LB
|
|
28
|
+
class LoadBalancers < Fog::Collection
|
|
29
|
+
model Fog::HP::LB::LoadBalancer
|
|
30
|
+
|
|
31
|
+
def all
|
|
32
|
+
data = service.list_load_balancers.body['loadBalancers']
|
|
33
|
+
load(data)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def get(record_id)
|
|
37
|
+
record = service.get_load_balancer_details(record_id).body['load_balancer']
|
|
38
|
+
new(record)
|
|
39
|
+
rescue Fog::HP::LB::NotFound
|
|
40
|
+
nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
# furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
# SOFTWARE.
|
|
21
|
+
|
|
22
|
+
require 'fog/core/model'
|
|
23
|
+
|
|
24
|
+
module Fog
|
|
25
|
+
module HP
|
|
26
|
+
class LB
|
|
27
|
+
class Node < Fog::Model
|
|
28
|
+
|
|
29
|
+
identity :id
|
|
30
|
+
attribute :address
|
|
31
|
+
attribute :port
|
|
32
|
+
attribute :condition
|
|
33
|
+
attribute :status
|
|
34
|
+
attribute :load_balancer_id
|
|
35
|
+
|
|
36
|
+
def destroy
|
|
37
|
+
requires :id
|
|
38
|
+
requires :load_balancer_id
|
|
39
|
+
service.delete_load_balancer_node(load_balancer_id, id)
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def ready?
|
|
44
|
+
self.status == 'ACTIVE'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def save
|
|
48
|
+
identity ? update : create
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def create
|
|
54
|
+
requires :load_balancer_id
|
|
55
|
+
merge_attributes(service.create_load_balancer_node(load_balancer_id, {'nodes' => [attributes]}).body)
|
|
56
|
+
true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def update
|
|
60
|
+
requires :id
|
|
61
|
+
requires :load_balancer_id
|
|
62
|
+
service.update_load_balancer_node(load_balancer_id, id, attributes[:condition])
|
|
63
|
+
true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|