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,56 @@
|
|
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/securitygroups/rules/add'
|
23
|
+
require 'hpcloud/commands/securitygroups/rules/remove'
|
24
|
+
|
25
|
+
module HP
|
26
|
+
module Cloud
|
27
|
+
class CLI < Thor
|
28
|
+
|
29
|
+
map 'securitygroups:rules:list' => 'securitygroups:rules'
|
30
|
+
|
31
|
+
desc "securitygroups:rules <sec_group_name>", "Display the list of rules for a security group."
|
32
|
+
long_desc <<-DESC
|
33
|
+
List the rules for a security group for your compute account. Optionally, you can specify an availability zone.
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
hpcloud securitygroups:rules mysecgroup # List the rules for security group `mysecgroup`
|
37
|
+
hpcloud securitygroups:rules c14411d7 # List the rules for security group `c14411d7`
|
38
|
+
|
39
|
+
Aliases: securitygroups:rules:list
|
40
|
+
DESC
|
41
|
+
CLI.add_report_options
|
42
|
+
CLI.add_common_options
|
43
|
+
define_method "securitygroups:rules" do |sec_group_name|
|
44
|
+
cli_command(options) {
|
45
|
+
rules = Rules.new(sec_group_name)
|
46
|
+
if rules.empty?
|
47
|
+
@log.display "You currently have no rules for the security group '#{sec_group_name}'."
|
48
|
+
else
|
49
|
+
ray = rules.get_array
|
50
|
+
Tableizer.new(options, RuleHelper.get_keys(), ray).print
|
51
|
+
end
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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/securitygroups/add'
|
23
|
+
require 'hpcloud/commands/securitygroups/remove'
|
24
|
+
require 'hpcloud/commands/securitygroups/rules'
|
25
|
+
|
26
|
+
module HP
|
27
|
+
module Cloud
|
28
|
+
class CLI < Thor
|
29
|
+
|
30
|
+
map 'securitygroups:list' => 'securitygroups'
|
31
|
+
|
32
|
+
desc "securitygroups [name_or_id ...]", "List the available security groups."
|
33
|
+
long_desc <<-DESC
|
34
|
+
List the security groups in your compute account. You may filter the display by specifying names or IDs of security groups on the command line. Optionally, you can specify an availability zone.
|
35
|
+
|
36
|
+
Examples:
|
37
|
+
hpcloud securitygroups # List the security groups
|
38
|
+
hpcloud securitygroups mysecgrp # List security group `mysecgrp`
|
39
|
+
hpcloud securitygroups -z az-2.region-a.geo-1 # List the security groups for availability zone `az-2.region-a.geo-1`
|
40
|
+
|
41
|
+
Aliases: securitygroups:list
|
42
|
+
DESC
|
43
|
+
CLI.add_report_options
|
44
|
+
CLI.add_common_options
|
45
|
+
def securitygroups(*arguments)
|
46
|
+
cli_command(options) {
|
47
|
+
securitygroups = SecurityGroups.new
|
48
|
+
if securitygroups.empty?
|
49
|
+
@log.display "You currently have no security groups, , use `#{selfname} securitygroups:add <name>` to create one."
|
50
|
+
else
|
51
|
+
ray = securitygroups.get_array(arguments)
|
52
|
+
if ray.empty?
|
53
|
+
@log.display "There are no security groups that match the provided arguments"
|
54
|
+
else
|
55
|
+
Tableizer.new(options, SecurityGroupHelper.get_keys(), ray).print
|
56
|
+
end
|
57
|
+
end
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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
|
+
desc "servers:add <name> <flavor>", "Add a server."
|
27
|
+
long_desc <<-DESC
|
28
|
+
Add a new server to your compute account. You must specify: Server name, a flavor, an image or volume to use, and a key pair. If you are creating a windows server, the flavor must be at least a large and you must specify a security group that has the RDP port open. Optionally, you can specify a security group, key name, metadata and availability zone.
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
hpcloud servers:add my_server small -i 90ea5676 -k key1 # Create a new small server named 'my_server' with image 90ea5676 and key1
|
32
|
+
hpcloud servers:add winserv large -i c80dfe05 -k winpair -s allowsRDP -p ./winpair.pem # Create a windows server with the specified key, security group, and private key to decrypt the password
|
33
|
+
hpcloud servers:add my_server large -v natty -k key1 -s sg1 # Create a new large server named 'my_server' using volume `natty`, key `key1`, and the `sg1` security group
|
34
|
+
hpcloud servers:add my_server small -i 53e78869 -k key1 -m this=that # Create a new small server named 'my_server' using the specified image, flavor, key and metadata this=that
|
35
|
+
hpcloud servers:add my_server large -i 53e78869 -k key1 --personality rootdir # Create 'my_server' with the personality specified in the directory 'rootdir'
|
36
|
+
DESC
|
37
|
+
method_option :key_name, :required => true,
|
38
|
+
:type => :string, :aliases => '-k',
|
39
|
+
:desc => 'Specify a key name to be used.'
|
40
|
+
method_option :image,
|
41
|
+
:type => :string, :aliases => '-i',
|
42
|
+
:desc => 'Image to use to create the server.'
|
43
|
+
method_option :volume,
|
44
|
+
:type => :string, :aliases => '-v',
|
45
|
+
:desc => 'Volume to use to create the server.'
|
46
|
+
method_option :security_group,
|
47
|
+
:type => :string, :aliases => '-s',
|
48
|
+
:desc => 'Specify a security group or comma seperated list of security groups to be used.'
|
49
|
+
method_option :private_key_file,
|
50
|
+
:type => :string, :aliases => '-p',
|
51
|
+
:desc => 'Name of the pem file with your private key.'
|
52
|
+
method_option :metadata,
|
53
|
+
:type => :string, :aliases => '-m',
|
54
|
+
:desc => 'Set the meta data.'
|
55
|
+
method_option :network,
|
56
|
+
:type => :string, :aliases => '-n',
|
57
|
+
:desc => 'Network to use for the server.'
|
58
|
+
method_option :userdata,
|
59
|
+
:type => :string, :aliases => '-u',
|
60
|
+
:desc => 'File which contains user data.'
|
61
|
+
method_option :personality,
|
62
|
+
:type => :string,
|
63
|
+
:desc => 'Directory containing personality for server.'
|
64
|
+
CLI.add_common_options
|
65
|
+
define_method "servers:add" do |name, *flavor|
|
66
|
+
cli_command(options) {
|
67
|
+
srv = HP::Cloud::ServerHelper.new(Connection.instance.compute)
|
68
|
+
srv.name = name
|
69
|
+
srv.set_flavor(flavor.first) unless flavor.first.nil?
|
70
|
+
srv.set_image(options[:image])
|
71
|
+
srv.set_volume(options[:volume])
|
72
|
+
srv.set_keypair(options[:key_name])
|
73
|
+
srv.set_security_groups(options[:security_group])
|
74
|
+
srv.set_private_key(options[:private_key_file])
|
75
|
+
srv.meta.set_metadata(options[:metadata])
|
76
|
+
srv.set_network(options[:network])
|
77
|
+
srv.set_user_data(options[:userdata])
|
78
|
+
srv.set_personality(options[:personality])
|
79
|
+
if srv.save == true
|
80
|
+
@log.display "Created server '#{name}' with id '#{srv.id}'."
|
81
|
+
if srv.is_windows?
|
82
|
+
unless srv.is_private_image?
|
83
|
+
@log.display "Retrieving password, this may take several minutes..."
|
84
|
+
srv.fog.wait_for { ready? }
|
85
|
+
@log.display "Windows password: " + srv.windows_password
|
86
|
+
@log.display "Make sure the security group has RDP port 3389 open"
|
87
|
+
@log.display "You may wish to change the password when you log in"
|
88
|
+
if srv.is_valid? == false
|
89
|
+
@log.fatal srv.cstatus
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
else
|
94
|
+
@log.fatal srv.cstatus
|
95
|
+
end
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,81 @@
|
|
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
|
+
desc "servers:console <server_name_or_id> [lines]", "Get the console output of a server or extract the windows password."
|
27
|
+
long_desc <<-DESC
|
28
|
+
Display the console output of a server. When the `-p` option is used with the private key file for the server, if the decrypted password is still available on the console, it is displayed.
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
hpcloud servers:console my-server 100 # Display 100 lines of console ouput
|
32
|
+
hpcloud servers:console winserver -p win.pem # Display the password of the winserver
|
33
|
+
DESC
|
34
|
+
method_option :private_key_file,
|
35
|
+
:type => :string, :aliases => '-p',
|
36
|
+
:desc => 'Private key pem file used to decrypt windows password.'
|
37
|
+
method_option :dump_password,
|
38
|
+
:type => :boolean, :aliases => '-d',
|
39
|
+
:desc => 'Dump the windows password if the private key is known by the CLI.'
|
40
|
+
CLI.add_common_options
|
41
|
+
define_method "servers:console" do |name_or_id, *lines|
|
42
|
+
cli_command(options) {
|
43
|
+
lines = ["50"] if lines.nil? || lines.empty?
|
44
|
+
lines = lines[0]
|
45
|
+
if lines.match(/[^0-9]/)
|
46
|
+
@log.fatal "Invalid number of lines specified '#{lines}'", :incorrect_usage
|
47
|
+
end
|
48
|
+
lines = lines.to_i + 1
|
49
|
+
lines = lines.to_s
|
50
|
+
server = Servers.new.get(name_or_id)
|
51
|
+
if server.is_valid?
|
52
|
+
key_file = options[:private_key_file]
|
53
|
+
if key_file.nil?
|
54
|
+
unless options[:dump_password].nil?
|
55
|
+
key_file = KeypairHelper.private_filename("#{server.id}")
|
56
|
+
unless File.exists?(key_file)
|
57
|
+
@log.fatal "Cannot find private key file for '#{name_or_id}'.", :not_found
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
if key_file.nil?
|
62
|
+
output = server.fog.console_output(lines)
|
63
|
+
if output.nil?
|
64
|
+
@log.fatal "Error getting console response from #{name_or_id}"
|
65
|
+
end
|
66
|
+
@log.display "Console output for #{name_or_id}:"
|
67
|
+
@log.display output.body["output"]
|
68
|
+
else
|
69
|
+
server.set_private_key(key_file)
|
70
|
+
server.set_image(server.image)
|
71
|
+
@log.display "Warning: Server does not appear to be a Windows server" unless server.is_windows?
|
72
|
+
@log.display server.windows_password(1)
|
73
|
+
end
|
74
|
+
else
|
75
|
+
@log.fatal server.cstatus
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
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
|
+
module HP
|
23
|
+
module Cloud
|
24
|
+
class CLI < Thor
|
25
|
+
desc 'servers:limits', "List compute limits."
|
26
|
+
long_desc <<-DESC
|
27
|
+
Lists all the compute limits for this project.
|
28
|
+
|
29
|
+
Examples:
|
30
|
+
hpcloud servers:limits # List all limits
|
31
|
+
DESC
|
32
|
+
CLI.add_common_options
|
33
|
+
define_method "servers:limits" do
|
34
|
+
cli_command(options) {
|
35
|
+
rsp = Connection.instance.compute.request(
|
36
|
+
:expects => 200,
|
37
|
+
:method => 'GET',
|
38
|
+
:path => 'limits'
|
39
|
+
)
|
40
|
+
hsh = { "limits" => rsp.body['limits']['absolute'] }
|
41
|
+
@log.display hsh.to_yaml
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 'servers:metadata:update' => 'servers:metadata:add'
|
27
|
+
|
28
|
+
desc "servers:metadata:add <name_or_id> <metadata>", "Add metadata to a server."
|
29
|
+
long_desc <<-DESC
|
30
|
+
Add metadata to a server in your compute account. You can specify the erver name or ID. Optionally, you can an availability zone. The metadata should be a comma separated list of name value pairs.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
hpcloud servers:metadata:add my_server 'r2=d2,c3=po' # Add the specified metadata to the server (if the metadata exists, it is updated)
|
34
|
+
hpcloud servers:metadata:add c14411d7 'chew=bacca,han=solo' # Add the specified metadata to the server (if the metadata exists, it is updated)
|
35
|
+
|
36
|
+
Aliases: servers:metadata:update
|
37
|
+
DESC
|
38
|
+
CLI.add_common_options
|
39
|
+
define_method "servers:metadata:add" do |name_or_id, metadata|
|
40
|
+
cli_command(options) {
|
41
|
+
server = Servers.new.get(name_or_id.to_s)
|
42
|
+
if server.is_valid? == false
|
43
|
+
@log.fatal server.cstatus
|
44
|
+
else
|
45
|
+
if server.meta.set_metadata(metadata)
|
46
|
+
@log.display "Server '#{name_or_id}' set metadata '#{metadata}'."
|
47
|
+
else
|
48
|
+
@log.fatal server.meta.cstatus
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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 'servers:metadata:rm' => 'servers:metadata:remove'
|
27
|
+
|
28
|
+
desc "servers:metadata:remove <name> <metadata_key> ...", "Remove metadata from a server."
|
29
|
+
long_desc <<-DESC
|
30
|
+
Remove metadata from a server in your compute account. You can speciry the erver name or ID. You can specify one or more metadata keys on the command line. Optionally, you can specify an availability zone.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
hpcloud servers:metadata:remove :my_server r2 c3 # Remove the the r2 and c3 metadata from the server
|
34
|
+
hpcloud servers:metadata:remove b8e90a48 r2 c3 # Remove the the r2 and c3 metadata from the server
|
35
|
+
|
36
|
+
Aliases: servers:metadata:rm
|
37
|
+
DESC
|
38
|
+
CLI.add_common_options
|
39
|
+
define_method "servers:metadata:remove" do |name_or_id, *metadata|
|
40
|
+
cli_command(options) {
|
41
|
+
server = Servers.new.get(name_or_id)
|
42
|
+
if server.is_valid? == false
|
43
|
+
@log.fatal server.cstatus
|
44
|
+
else
|
45
|
+
metadata.each { |key|
|
46
|
+
if server.meta.remove_metadata(key)
|
47
|
+
@log.display "Removed metadata '#{key}' from server '#{name_or_id}'."
|
48
|
+
else
|
49
|
+
@log.error server.meta.cstatus
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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/servers'
|
23
|
+
require 'hpcloud/metadata'
|
24
|
+
|
25
|
+
module HP
|
26
|
+
module Cloud
|
27
|
+
class CLI < Thor
|
28
|
+
|
29
|
+
map 'servers:metadata:list' => 'servers:metadata'
|
30
|
+
|
31
|
+
desc "servers:metadata <name_or_id>", "List the metadata for a server."
|
32
|
+
long_desc <<-DESC
|
33
|
+
List the metadata for a server in your compute account. You can specify either the name or the ID of the server. Optionally, you can specify an availability zone.
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
hpcloud servers:metadata Skynet # List server metadata
|
37
|
+
hpcloud servers:metadata c14411d7 # List server metadata
|
38
|
+
|
39
|
+
Aliases: servers:metadata:list
|
40
|
+
DESC
|
41
|
+
CLI.add_report_options
|
42
|
+
CLI.add_common_options
|
43
|
+
define_method "servers:metadata" do |name_or_id|
|
44
|
+
cli_command(options) {
|
45
|
+
server = Servers.new.get(name_or_id)
|
46
|
+
if server.is_valid?
|
47
|
+
ray = server.meta.to_array()
|
48
|
+
Tableizer.new(options, Metadata.get_keys(), ray).print
|
49
|
+
else
|
50
|
+
@log.fatal server.cstatus
|
51
|
+
end
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
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
|
+
module HP
|
23
|
+
module Cloud
|
24
|
+
class CLI < Thor
|
25
|
+
|
26
|
+
map %w(servers:passwd) => 'servers:password'
|
27
|
+
|
28
|
+
desc "servers:password <server_name> <password>", "Change the password for a server."
|
29
|
+
long_desc <<-DESC
|
30
|
+
Change the password for an existing server. The password must adhere to the existing security complexity naming rules. Optionally, you can specify an availability zone.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
hpcloud servers:password my-server my-password # Change the password for server 'my-server'
|
34
|
+
hpcloud servers:password b8e90a48 'pA$3word' # Change the password for server 'b8e90a48'
|
35
|
+
|
36
|
+
Aliases: servers:passwd
|
37
|
+
DESC
|
38
|
+
CLI.add_common_options
|
39
|
+
define_method "servers:password" do |name, password|
|
40
|
+
cli_command(options) {
|
41
|
+
@log.fatal "Password change is no longer supported. Support may be added back in the future"
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
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
|
+
module HP
|
23
|
+
module Cloud
|
24
|
+
class CLI < Thor
|
25
|
+
desc 'servers:ratelimits', "List compute rate limits."
|
26
|
+
long_desc <<-DESC
|
27
|
+
Lists all the compute rate limits for this project.
|
28
|
+
|
29
|
+
Examples:
|
30
|
+
hpcloud servers:ratelimits # List all rate limits
|
31
|
+
DESC
|
32
|
+
CLI.add_common_options
|
33
|
+
define_method "servers:ratelimits" do
|
34
|
+
cli_command(options) {
|
35
|
+
rsp = Connection.instance.compute.request(
|
36
|
+
:expects => 200,
|
37
|
+
:method => 'GET',
|
38
|
+
:path => 'limits'
|
39
|
+
)
|
40
|
+
hsh = { "limits" => rsp.body['limits']['rate'] }
|
41
|
+
@log.display hsh.to_yaml
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|