hpcloud 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,51 @@
|
|
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 'hpcloud/commands/keypairs/import'
|
23
|
+
require 'hpcloud/commands/keypairs/add'
|
24
|
+
require 'hpcloud/commands/keypairs/remove'
|
25
|
+
|
26
|
+
module HP
|
27
|
+
module Cloud
|
28
|
+
class CLI < Thor
|
29
|
+
|
30
|
+
desc "keypairs:public_key <name>", "Display the public keys of a key pair."
|
31
|
+
long_desc <<-DESC
|
32
|
+
Display the public key of the specified keypair. Optionally, you can specify an availability zone.
|
33
|
+
|
34
|
+
Examples:
|
35
|
+
hpcloud keypairs:public_key keyno # Remove the public key `keyno`
|
36
|
+
hpcloud keypairs:public_key keyno -z az-2.region-a.geo-1 # Remove the public key `keyno` for availability zone `az-2.region-a.geo-1`
|
37
|
+
DESC
|
38
|
+
CLI.add_common_options
|
39
|
+
define_method "keypairs:public_key" do |key_name|
|
40
|
+
cli_command(options) {
|
41
|
+
keypair = Keypairs.new.get(key_name)
|
42
|
+
unless keypair.is_valid?
|
43
|
+
@log.fatal keypair.cstatus
|
44
|
+
end
|
45
|
+
|
46
|
+
@log.display keypair.public_key
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,58 @@
|
|
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
|
+
module HP
|
23
|
+
module Cloud
|
24
|
+
class CLI < Thor
|
25
|
+
|
26
|
+
map %w(keypairs:rm keypairs:delete keypairs:del) => 'keypairs:remove'
|
27
|
+
|
28
|
+
desc "keypairs:remove name [name ...]", "Remove a key pair (by name)."
|
29
|
+
long_desc <<-DESC
|
30
|
+
Remove an existing key pair by name. You may specify more than one key pair to remove on a single command line. Optionally, you can specify an availability zone.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
hpcloud keypairs:remove mykey # Remove the key pair 'mykey'
|
34
|
+
hpcloud keypairs:remove mykey myotherkey # Remove the key pairs 'mykey' and 'myotherkey'
|
35
|
+
hpcloud keypairs:remove mykey -z az-2.region-a.geo-1 # Remove the key pair `mykey` for availability zone `az-2.region-a.geo-1
|
36
|
+
|
37
|
+
Aliases: keypairs:rm, keypairs:delete, keypairs:del
|
38
|
+
DESC
|
39
|
+
CLI.add_common_options
|
40
|
+
define_method "keypairs:remove" do |name, *names|
|
41
|
+
cli_command(options) {
|
42
|
+
names = [name] + names
|
43
|
+
keypairs = Keypairs.new.get(names, false)
|
44
|
+
keypairs.each { |keypair|
|
45
|
+
sub_command("removing keypair") {
|
46
|
+
if keypair.is_valid?
|
47
|
+
keypair.destroy
|
48
|
+
@log.display "Removed key pair '#{keypair.name}'."
|
49
|
+
else
|
50
|
+
@log.error keypair.cstatus
|
51
|
+
end
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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 'hpcloud/commands/keypairs/import'
|
23
|
+
require 'hpcloud/commands/keypairs/add'
|
24
|
+
require 'hpcloud/commands/keypairs/private'
|
25
|
+
require 'hpcloud/commands/keypairs/public_key'
|
26
|
+
require 'hpcloud/commands/keypairs/remove'
|
27
|
+
|
28
|
+
module HP
|
29
|
+
module Cloud
|
30
|
+
class CLI < Thor
|
31
|
+
|
32
|
+
map 'keypairs:list' => 'keypairs'
|
33
|
+
|
34
|
+
desc "keypairs [name ...]", "List the available keypairs."
|
35
|
+
long_desc <<-DESC
|
36
|
+
List the key pairs in your compute account. You may filter the output of keys displayed by specifying the key pairs you want displayed on the command line. Optionally, you can specify an availability zone.
|
37
|
+
|
38
|
+
Examples:
|
39
|
+
hpcloud keypairs # List the key pairs
|
40
|
+
hpcloud keypairs brat # List the key pair 'brat'
|
41
|
+
hpcloud keypairs -z az-2.region-a.geo-1 # List the key pairs for availability zone `az-2.region-a.geo-1`
|
42
|
+
|
43
|
+
Aliases: keypairs:list
|
44
|
+
DESC
|
45
|
+
CLI.add_report_options
|
46
|
+
CLI.add_common_options
|
47
|
+
def keypairs(*arguments)
|
48
|
+
cli_command(options) {
|
49
|
+
keypairs = Keypairs.new
|
50
|
+
if keypairs.empty?
|
51
|
+
@log.display "You currently have no keypairs, use `#{selfname} keypairs:add <name>` to create one."
|
52
|
+
else
|
53
|
+
ray = keypairs.get_array(arguments)
|
54
|
+
if ray.empty?
|
55
|
+
@log.display "There are no keypairs that match the provided arguments"
|
56
|
+
else
|
57
|
+
Tableizer.new(options, KeypairHelper.get_keys(), ray).print
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,92 @@
|
|
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
|
+
|
23
|
+
module HP
|
24
|
+
module Cloud
|
25
|
+
class CLI < Thor
|
26
|
+
|
27
|
+
desc "lb:add <name> <algorithm> <protocol> <port>", "Add a load balancer."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Add a load balancer with the specified name, algorithm, protocol and port. You must specify a node and may specify a virtual IP id to create a load balancer.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:add loady ROUND_ROBIN HTTP 80 -n '10.1.1.1:80;10.1.1.2:81' -v '123;39393' # Create a new load balancer 'loady'
|
33
|
+
DESC
|
34
|
+
method_option :nodes,
|
35
|
+
:type => :string, :aliases => '-n', :required => true,
|
36
|
+
:desc => 'Nodes to associate with the load balancer. Semicolon separated list of colon separated IP and port pairs'
|
37
|
+
method_option :ips,
|
38
|
+
:type => :string, :aliases => '-v',
|
39
|
+
:desc => 'Semicolon separated list of of virtual IPs Ids to associate with the load balancer.'
|
40
|
+
CLI.add_common_options
|
41
|
+
define_method "lb:add" do |name, algorithm, protocol, port|
|
42
|
+
cli_command(options) {
|
43
|
+
lb = Lbs.new.unique(name)
|
44
|
+
lb.name = name
|
45
|
+
algorithm = LbAlgorithms.new.get(algorithm).name
|
46
|
+
lb.algorithm = algorithm
|
47
|
+
protocol = LbProtocols.new.get(protocol).name
|
48
|
+
lb.protocol = protocol
|
49
|
+
lb.port = port
|
50
|
+
lb.nodes = parse_nodes(options[:nodes])
|
51
|
+
lb.virtualIps = parse_virtual_ips(options[:ips])
|
52
|
+
lb.save
|
53
|
+
@log.display "Created load balancer '#{name}' with id '#{lb.id}'."
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def parse_nodes(value)
|
60
|
+
return [] if value.nil?
|
61
|
+
ray = []
|
62
|
+
begin
|
63
|
+
value.split(';').each{ |x|
|
64
|
+
hsh = {}
|
65
|
+
nod = x.split(':')
|
66
|
+
raise "Error" if nod.length != 2
|
67
|
+
hsh["address"] = nod[0]
|
68
|
+
hsh["port"] = nod[1]
|
69
|
+
ray << hsh
|
70
|
+
}
|
71
|
+
rescue
|
72
|
+
raise HP::Cloud::Exceptions::General.new("Error parsing nodes '#{value}'")
|
73
|
+
end
|
74
|
+
ray
|
75
|
+
end
|
76
|
+
|
77
|
+
def parse_virtual_ips(value)
|
78
|
+
return [] if value.nil?
|
79
|
+
ray = []
|
80
|
+
begin
|
81
|
+
value.split(';').each{ |x|
|
82
|
+
ray << {"id"=>x}
|
83
|
+
}
|
84
|
+
rescue
|
85
|
+
raise HP::Cloud::Exceptions::General.new("Error parsing virtual IPs '#{value}'")
|
86
|
+
end
|
87
|
+
ray
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 'hpcloud/lb_algorithms'
|
23
|
+
|
24
|
+
module HP
|
25
|
+
module Cloud
|
26
|
+
class CLI < Thor
|
27
|
+
desc 'lb:algorithms', "List the available load balancer algorithms."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Lists all the available load balancers algorithms.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:algorithms # List all algorithms
|
33
|
+
DESC
|
34
|
+
CLI.add_report_options
|
35
|
+
CLI.add_common_options
|
36
|
+
define_method "lb:algorithms" do |*arguments|
|
37
|
+
columns = [ "name" ]
|
38
|
+
|
39
|
+
cli_command(options) {
|
40
|
+
algo = LbAlgorithms.new
|
41
|
+
if algo.empty?
|
42
|
+
@log.display "There don't seem to be any supported algorithms at the moment"
|
43
|
+
else
|
44
|
+
ray = algo.get_array(arguments)
|
45
|
+
if ray.empty?
|
46
|
+
@log.display "There are no algorithms that match the provided arguments"
|
47
|
+
else
|
48
|
+
Tableizer.new(options, columns, ray).print
|
49
|
+
end
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 'hpcloud/lb_limits'
|
23
|
+
|
24
|
+
module HP
|
25
|
+
module Cloud
|
26
|
+
class CLI < Thor
|
27
|
+
desc 'lb:limits', "List the available load balancer limits."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Lists all the available load balancers limits.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:limits # List all limits
|
33
|
+
DESC
|
34
|
+
CLI.add_report_options
|
35
|
+
CLI.add_common_options
|
36
|
+
define_method "lb:limits" do
|
37
|
+
columns = [ "max_load_balancer_name_length", "max_load_balancers", "max_nodes_per_load_balancer", "max_vips_per_load_balancer" ]
|
38
|
+
|
39
|
+
cli_command(options) {
|
40
|
+
filter = LbLimits.new
|
41
|
+
if filter.empty?
|
42
|
+
@log.display "There don't seem to be any supported limits at the moment"
|
43
|
+
else
|
44
|
+
ray = filter.get_array
|
45
|
+
if ray.empty?
|
46
|
+
@log.display "No limits were found"
|
47
|
+
else
|
48
|
+
Tableizer.new(options, columns, ray).print
|
49
|
+
end
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
23
|
+
module HP
|
24
|
+
module Cloud
|
25
|
+
class CLI < Thor
|
26
|
+
|
27
|
+
desc "lb:nodes:add <lb_name_or_id> <address> <port>", "Add a node to the load balancer."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Add a node to the load balancer with the specified adddress and port.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:nodes:add loady 10.1.1.1 80 # Create a new node for load balancer 'loady'
|
33
|
+
DESC
|
34
|
+
CLI.add_common_options
|
35
|
+
define_method "lb:nodes:add" do |load_balancer_name_or_id, address, port|
|
36
|
+
cli_command(options) {
|
37
|
+
lb = Lbs.new.get(load_balancer_name_or_id)
|
38
|
+
node = Fog::HP::LB::Node.new({:service => Connection.instance.lb, :load_balancer_id => lb.id})
|
39
|
+
node.address = address
|
40
|
+
node.port = port
|
41
|
+
node.save
|
42
|
+
@log.display "Created node '#{address}:#{port}' with id '#{node.id}'."
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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
|
+
module HP
|
23
|
+
module Cloud
|
24
|
+
class CLI < Thor
|
25
|
+
|
26
|
+
map %w(lb:nodes:rm lb:nodes:delete lb:nodes:del) => 'lb:nodes:remove'
|
27
|
+
|
28
|
+
desc "lb:nodes:remove lb_name_or_id node_id [node_id ...]", "Remove the specified load balancer nodes."
|
29
|
+
long_desc <<-DESC
|
30
|
+
Remove load balancer node by specifying the name or id of the load balancer and the id of the nodes.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
hpcloud lb:nodes:remove scale 1044952 # Delete the load balancers ndoe `1044952` from `scale`
|
34
|
+
|
35
|
+
Aliases: lb:nodes:rm, lb:nodes:delete, lb:nodes:del
|
36
|
+
DESC
|
37
|
+
CLI.add_common_options
|
38
|
+
define_method "lb:nodes:remove" do |lb_name_or_id, name_or_id, *name_or_ids|
|
39
|
+
cli_command(options) {
|
40
|
+
name_or_ids = [name_or_id] + name_or_ids
|
41
|
+
lb = Lbs.new.get(lb_name_or_id)
|
42
|
+
name_or_ids.each{ |name|
|
43
|
+
sub_command("removing load balancer node") {
|
44
|
+
node = LbNodes.new(lb.id).get(name, false)
|
45
|
+
node.load_balancer_id = lb.id
|
46
|
+
node.destroy
|
47
|
+
@log.display "Removed node '#{name}' from load balancer '#{lb_name_or_id}'."
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
23
|
+
module HP
|
24
|
+
module Cloud
|
25
|
+
class CLI < Thor
|
26
|
+
|
27
|
+
desc "lb:nodes:update <lb_name_or_id> <node_id> <condition>", "Update a node in a load balancer."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Update a node in a load balancer with the specified condition. The id of the node may be used or 'address:port'.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:nodes:update loady 10.1.1.1:80 DISABLED # Update node '10.1.1.1:80' to 'DISABLED'
|
33
|
+
hpcloud lb:nodes:update 220303 1027580 ENABLED # Update node '1027580' to 'ENABLED'
|
34
|
+
DESC
|
35
|
+
CLI.add_common_options
|
36
|
+
define_method "lb:nodes:update" do |lb_name_or_id, name_or_id, condition|
|
37
|
+
cli_command(options) {
|
38
|
+
lb = Lbs.new.get(lb_name_or_id)
|
39
|
+
node = LbNodes.new(lb.id).get(name_or_id, false)
|
40
|
+
node.condition = condition
|
41
|
+
node.save
|
42
|
+
@log.display "Updated node '#{name_or_id}' to '#{condition}'."
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 'hpcloud/lb_nodes'
|
23
|
+
|
24
|
+
module HP
|
25
|
+
module Cloud
|
26
|
+
class CLI < Thor
|
27
|
+
|
28
|
+
map 'lb:nodes:list' => 'lb:nodes'
|
29
|
+
|
30
|
+
desc 'lb:nodes name_or_id', "List the nodes associated with the specified load balancer."
|
31
|
+
long_desc <<-DESC
|
32
|
+
Lists all the nodes associated with the specified load balancer. The list begins with identifier and address, port, condition and status.
|
33
|
+
|
34
|
+
Examples:
|
35
|
+
hpcloud lb:nodes balancer # List all nodes for load balancer 'balancer'
|
36
|
+
|
37
|
+
Aliases: lb:nodes:list
|
38
|
+
DESC
|
39
|
+
CLI.add_report_options
|
40
|
+
CLI.add_common_options
|
41
|
+
define_method "lb:nodes" do |name_or_id|
|
42
|
+
columns = [ "id", "address", "port", "condition", "status" ]
|
43
|
+
cli_command(options) {
|
44
|
+
lb = Lbs.new.get(name_or_id)
|
45
|
+
ray = LbNodes.new(lb.id).get_array
|
46
|
+
if ray.empty?
|
47
|
+
@log.display "There are no nodes for the given load balancer."
|
48
|
+
else
|
49
|
+
Tableizer.new(options, columns, ray).print
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 'hpcloud/lb_protocols'
|
23
|
+
|
24
|
+
module HP
|
25
|
+
module Cloud
|
26
|
+
class CLI < Thor
|
27
|
+
desc 'lb:protocols', "List the available load balancer protocols."
|
28
|
+
long_desc <<-DESC
|
29
|
+
Lists all the available load balancers protocols.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
hpcloud lb:protocols # List all protocols
|
33
|
+
DESC
|
34
|
+
CLI.add_report_options
|
35
|
+
CLI.add_common_options
|
36
|
+
define_method "lb:protocols" do |*arguments|
|
37
|
+
columns = [ "name", "port" ]
|
38
|
+
|
39
|
+
cli_command(options) {
|
40
|
+
filter = LbProtocols.new
|
41
|
+
if filter.empty?
|
42
|
+
@log.display "There don't seem to be any supported protocols at the moment"
|
43
|
+
else
|
44
|
+
ray = filter.get_array(arguments)
|
45
|
+
if ray.empty?
|
46
|
+
@log.display "There are no protocols that match the provided arguments"
|
47
|
+
else
|
48
|
+
Tableizer.new(options, columns, ray).print
|
49
|
+
end
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|