rightscale-cli 0.5.6 → 0.6.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.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/bin/rightscale +25 -0
- data/bin/rs +2 -3
- data/lib/ask_pass.rb +2 -2
- data/lib/deployment_cat.rb +378 -0
- data/lib/rightscale_cli.rb +0 -1
- data/lib/rightscale_cli/client.rb +26 -16
- data/lib/rightscale_cli/clouds.rb +22 -22
- data/lib/rightscale_cli/config.rb +16 -11
- data/lib/rightscale_cli/configure.rb +24 -1
- data/lib/rightscale_cli/deployments.rb +37 -13
- data/lib/rightscale_cli/instances.rb +26 -3
- data/lib/rightscale_cli/logger.rb +8 -6
- data/lib/rightscale_cli/monkey_patches/client_attributes.rb +1 -0
- data/lib/rightscale_cli/network/networks.rb +61 -0
- data/lib/rightscale_cli/network/security_groups.rb +155 -0
- data/lib/rightscale_cli/output.rb +5 -4
- data/lib/rightscale_cli/recurring_volume_attachments.rb +50 -0
- data/lib/rightscale_cli/refresh.rb +63 -0
- data/lib/rightscale_cli/render_options.rb +12 -2
- data/lib/rightscale_cli/rightscale_cli.rb +10 -0
- data/lib/rightscale_cli/server_templates.rb +1 -1
- data/lib/rightscale_cli/servers.rb +5 -0
- data/lib/rightscale_cli/ssh_keys.rb +87 -0
- data/lib/rightscale_cli/tags.rb +29 -26
- data/lib/rightscale_cli/version.rb +2 -1
- data/lib/rightscale_cli/volumes.rb +54 -19
- data/lib/templates/right_api_client.yml.erb +6 -2
- data/lib/yesno.rb +4 -8
- metadata +31 -24
data/lib/rightscale_cli/tags.rb
CHANGED
@@ -19,38 +19,39 @@ require 'rightscale_cli/client'
|
|
19
19
|
require 'rightscale_cli/logger'
|
20
20
|
|
21
21
|
class RightScaleCLI
|
22
|
+
# Represents RightScale Tags
|
22
23
|
class Tags < Thor
|
23
24
|
namespace :tags
|
24
25
|
|
25
26
|
def initialize(*args)
|
26
27
|
super
|
27
28
|
@client = RightScaleCLI::Client.new(options)
|
28
|
-
@logger = RightScaleCLI::Logger.new
|
29
|
+
@logger = RightScaleCLI::Logger.new
|
29
30
|
end
|
30
31
|
|
31
32
|
# include render options
|
32
33
|
eval(IO.read("#{File.dirname(File.expand_path(__FILE__))}/render_options.rb"), binding)
|
33
34
|
|
34
|
-
desc
|
35
|
-
option :deleted, :
|
36
|
-
option :all, :
|
37
|
-
option :count, :
|
38
|
-
option :prefix, :
|
35
|
+
desc 'search', 'search for resources having a list of tags in a specific resource_type'
|
36
|
+
option :deleted, type: :boolean, required: false, default: false
|
37
|
+
option :all, type: :boolean, required: false, default: false
|
38
|
+
option :count, type: :boolean, required: false, default: false
|
39
|
+
option :prefix, type: :boolean, required: false, default: false
|
39
40
|
def search(resource_type, tag)
|
40
41
|
if options[:prefix]
|
41
|
-
options[:prefix] = tag
|
42
|
-
results = @client.client.tags.by_tag(
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
42
|
+
options[:prefix] = tag
|
43
|
+
results = @client.client.tags.by_tag(
|
44
|
+
with_deleted: options[:deleted],
|
45
|
+
match_all: options[:all],
|
46
|
+
include_tags_with_prefix: options[:prefix],
|
47
|
+
resource_type: resource_type,
|
48
|
+
tags: [tag])
|
48
49
|
else
|
49
|
-
results = @client.client.tags.by_tag(
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
50
|
+
results = @client.client.tags.by_tag(
|
51
|
+
with_deleted: options[:deleted],
|
52
|
+
match_all: options[:all],
|
53
|
+
resource_type: resource_type,
|
54
|
+
tags: [tag])
|
54
55
|
end
|
55
56
|
|
56
57
|
resources = []
|
@@ -62,25 +63,27 @@ class RightScaleCLI
|
|
62
63
|
resource_count = 0
|
63
64
|
end
|
64
65
|
@logger.info "Found #{resource_count} #{resource_type} with tag, '#{tag}'."
|
65
|
-
@client.render(resources[0], 'tag_search') unless
|
66
|
+
@client.render(resources[0], 'tag_search') unless options[:count] || resource_count == 0
|
66
67
|
end
|
67
68
|
|
68
|
-
desc
|
69
|
+
desc 'resource', 'get tags for a list of resource hrefs'
|
69
70
|
def resource(resource_hrefs)
|
70
|
-
@client.client.tags.by_resource(:
|
71
|
+
@client.client.tags.by_resource(resource_hrefs: resource_hrefs.split(','))
|
71
72
|
end
|
72
73
|
|
73
|
-
desc
|
74
|
+
desc 'add', 'adds tag(s) to resource(s).'
|
74
75
|
def add(hrefs, tags)
|
75
|
-
@client.client.tags.multi_add(:
|
76
|
+
@client.client.tags.multi_add(resource_hrefs: hrefs.split(','),
|
77
|
+
tags: tags.split(','))
|
76
78
|
end
|
77
79
|
|
78
|
-
desc
|
80
|
+
desc 'delete', 'deletes tags from resource(s).'
|
79
81
|
def delete(hrefs, tags)
|
80
|
-
@client.client.tags.multi_delete(:
|
82
|
+
@client.client.tags.multi_delete(resource_hrefs: hrefs.split(','),
|
83
|
+
tags: tags.split(','))
|
81
84
|
end
|
82
85
|
|
83
|
-
def self.banner(task,
|
86
|
+
def self.banner(task, _namespace = true, subcommand = false)
|
84
87
|
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
|
85
88
|
end
|
86
89
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Author:: Chris Fordham (<chris@fordham-nagy.id.au>)
|
2
|
-
# Copyright:: Copyright (c) 2013 Chris Fordham
|
2
|
+
# Copyright:: Copyright (c) 2013-2015 Chris Fordham
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,26 +19,56 @@ require 'rightscale_cli/logger'
|
|
19
19
|
require 'rightscale_cli/client'
|
20
20
|
|
21
21
|
class RightScaleCLI
|
22
|
+
# Represents Storage Volumes
|
22
23
|
class Volumes < Thor
|
23
24
|
namespace :volumes
|
24
25
|
|
25
26
|
def initialize(*args)
|
26
27
|
super
|
27
28
|
@client = RightScaleCLI::Client.new(options)
|
28
|
-
@logger = RightScaleCLI::Logger.new
|
29
|
+
@logger = RightScaleCLI::Logger.new
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
class_option :xml,
|
33
|
+
type: :boolean,
|
34
|
+
default: false,
|
35
|
+
aliases: '-X',
|
36
|
+
required: false,
|
37
|
+
desc: 'returns xml'
|
38
|
+
class_option :json,
|
39
|
+
type: :boolean,
|
40
|
+
default: false,
|
41
|
+
aliases: '-J',
|
42
|
+
required: false,
|
43
|
+
desc: 'returns json'
|
44
|
+
|
45
|
+
desc 'list', 'lists volumes, optionally with filter by datacenter, ' \
|
46
|
+
'description, name, parent volume snapshot or resource UID'
|
47
|
+
option :cloud,
|
48
|
+
desc: 'the cloud to query for volumes in',
|
49
|
+
type: :string,
|
50
|
+
required: true
|
51
|
+
option :datacenter,
|
52
|
+
desc: 'the href of the datacenter / zone the volume is in',
|
53
|
+
type: :string,
|
54
|
+
required: false
|
55
|
+
option :description,
|
56
|
+
desc: 'the description of the Volume to filter on',
|
57
|
+
type: :string,
|
58
|
+
required: false
|
59
|
+
option :name,
|
60
|
+
desc: 'the name of the Volume to filter on',
|
61
|
+
type: :string,
|
62
|
+
required: false
|
63
|
+
option :parent,
|
64
|
+
desc: 'the href of the snapshot from which the volume was created',
|
65
|
+
type: :string,
|
66
|
+
required: false
|
67
|
+
option :resource_uid,
|
68
|
+
desc: 'a resource unique identifier for the volume to filter on',
|
69
|
+
type: :string,
|
70
|
+
required: false
|
71
|
+
def list
|
42
72
|
filter = []
|
43
73
|
filter.push("datacenter_href==/api/clouds/#{options[:cloud]}/datacenters/#{options[:datacenter]}") if options[:datacenter]
|
44
74
|
filter.push("description==#{options[:description]}") if options[:description]
|
@@ -49,20 +79,25 @@ class RightScaleCLI
|
|
49
79
|
@logger.debug "filter: #{filter}" if options[:debug]
|
50
80
|
|
51
81
|
volumes = []
|
52
|
-
@client.client.clouds(:
|
82
|
+
@client.client.clouds(id: options[:cloud])
|
83
|
+
.show.volumes(filter: filter).index.each do |volume|
|
53
84
|
volumes.push(volume.raw)
|
54
|
-
|
85
|
+
end
|
55
86
|
|
56
87
|
@client.render(volumes, 'volumes')
|
57
88
|
end
|
58
89
|
|
59
|
-
desc
|
60
|
-
option :cloud,
|
90
|
+
desc 'show', 'shows a single volume'
|
91
|
+
option :cloud,
|
92
|
+
desc: 'the cloud to query for volumes in',
|
93
|
+
type: :string,
|
94
|
+
required: true
|
61
95
|
def show(volume_id)
|
62
|
-
@client.render(@client.client.clouds(:
|
96
|
+
@client.render(@client.client.clouds(id: options[:cloud])
|
97
|
+
.show.volumes(id: volume_id).show.raw, 'volume')
|
63
98
|
end
|
64
99
|
|
65
|
-
def self.banner(task,
|
100
|
+
def self.banner(task, _namespace = true, subcommand = false)
|
66
101
|
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
|
67
102
|
end
|
68
103
|
end
|
@@ -7,11 +7,13 @@
|
|
7
7
|
:account_id: <%= @directives[:account_id] %>
|
8
8
|
|
9
9
|
# There are five login mechanisms:
|
10
|
-
|
10
|
+
|
11
11
|
# 0. Use the following parameters to login with your email and base64-encoded password:
|
12
12
|
# To encode your plaintext password, use 'base64' command or similar.
|
13
|
+
<% if @directives[:email] %>
|
13
14
|
:email: <%= @directives[:email] %>
|
14
15
|
:password_base64: <%= @directives[:password_base64] %>
|
16
|
+
<% end %>
|
15
17
|
|
16
18
|
# 1. Use the following parameters to login with your email and plaintext password:
|
17
19
|
#:email: <%= @directives[:email] %>
|
@@ -28,8 +30,10 @@
|
|
28
30
|
# 4. Use the following parameter to send an existing OAuth access token with every request:
|
29
31
|
# To learn more about OAuth and how to obtain an access token, see
|
30
32
|
# http://support.rightscale.com/12-Guides/03-Rightscale_API/OAuth
|
31
|
-
|
33
|
+
:access_token: <%= @directives[:access_token] %>
|
32
34
|
|
33
35
|
# The following are optional parameters:
|
34
36
|
:api_url: <%= @directives[:api_url] %>
|
35
37
|
:api_version: <%= @directives[:api_version] %>
|
38
|
+
:refresh_token: <%= @directives[:refresh_token] %>
|
39
|
+
:token_endpoint: <%= @directives[:token_endpoint] %>
|
data/lib/yesno.rb
CHANGED
@@ -16,16 +16,12 @@
|
|
16
16
|
|
17
17
|
def yesno
|
18
18
|
begin
|
19
|
-
system(
|
19
|
+
system('stty raw -echo')
|
20
20
|
str = STDIN.getc
|
21
21
|
ensure
|
22
|
-
system(
|
22
|
+
system('stty -raw echo')
|
23
23
|
end
|
24
|
-
|
25
|
-
|
26
|
-
elsif str.downcase == "n"
|
27
|
-
return false
|
28
|
-
else
|
29
|
-
raise "Invalid response. Please enter y/n."
|
24
|
+
{ 'y' => true, 'n' => false }.fetch(str.downcase) do
|
25
|
+
fail 'Invalid response. Please enter y/n.'
|
30
26
|
end
|
31
27
|
end
|
metadata
CHANGED
@@ -1,130 +1,133 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rightscale-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Fordham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.4'
|
48
|
-
- -
|
48
|
+
- - '>='
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 1.4.4
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ~>
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '1.4'
|
58
|
-
- -
|
58
|
+
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 1.4.4
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: right_api_client
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '1.5'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '1.5'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: octokit
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '2.7'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '2.7'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: thor
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0.18'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0.18'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: nokogiri
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '1.6'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ~>
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '1.6'
|
117
117
|
description: RightScale command line interface client.
|
118
118
|
email: chris@fordham-nagy.id.au
|
119
119
|
executables:
|
120
|
+
- rightscale
|
120
121
|
- rs
|
121
122
|
extensions: []
|
122
123
|
extra_rdoc_files: []
|
123
124
|
files:
|
124
125
|
- LICENSE
|
125
126
|
- README.md
|
127
|
+
- bin/rightscale
|
126
128
|
- bin/rs
|
127
129
|
- lib/ask_pass.rb
|
130
|
+
- lib/deployment_cat.rb
|
128
131
|
- lib/rightscale_cli.rb
|
129
132
|
- lib/rightscale_cli/client.rb
|
130
133
|
- lib/rightscale_cli/clouds.rb
|
@@ -136,7 +139,11 @@ files:
|
|
136
139
|
- lib/rightscale_cli/logger.rb
|
137
140
|
- lib/rightscale_cli/monkey_patches/client_attributes.rb
|
138
141
|
- lib/rightscale_cli/multi_cloud_images.rb
|
142
|
+
- lib/rightscale_cli/network/networks.rb
|
143
|
+
- lib/rightscale_cli/network/security_groups.rb
|
139
144
|
- lib/rightscale_cli/output.rb
|
145
|
+
- lib/rightscale_cli/recurring_volume_attachments.rb
|
146
|
+
- lib/rightscale_cli/refresh.rb
|
140
147
|
- lib/rightscale_cli/render_options.rb
|
141
148
|
- lib/rightscale_cli/repositories.rb
|
142
149
|
- lib/rightscale_cli/rightscale_cli.rb
|
@@ -149,6 +156,7 @@ files:
|
|
149
156
|
- lib/rightscale_cli/server_arrays/multi_run_executable.rb
|
150
157
|
- lib/rightscale_cli/server_templates.rb
|
151
158
|
- lib/rightscale_cli/servers.rb
|
159
|
+
- lib/rightscale_cli/ssh_keys.rb
|
152
160
|
- lib/rightscale_cli/tags.rb
|
153
161
|
- lib/rightscale_cli/version.rb
|
154
162
|
- lib/rightscale_cli/volumes.rb
|
@@ -164,19 +172,18 @@ require_paths:
|
|
164
172
|
- lib
|
165
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
174
|
requirements:
|
167
|
-
- -
|
175
|
+
- - '>='
|
168
176
|
- !ruby/object:Gem::Version
|
169
177
|
version: '0'
|
170
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
179
|
requirements:
|
172
|
-
- -
|
180
|
+
- - '>='
|
173
181
|
- !ruby/object:Gem::Version
|
174
182
|
version: '0'
|
175
183
|
requirements: []
|
176
184
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.4.1
|
178
186
|
signing_key:
|
179
187
|
specification_version: 4
|
180
188
|
summary: rightscale-cli
|
181
189
|
test_files: []
|
182
|
-
has_rdoc:
|