awful 0.0.162 → 0.0.163

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c108b1b219d5b3b1f34c50c775a06e12070a5e8
4
- data.tar.gz: 98a86eee58b229adc6ca819d1882ae29feccbdb3
3
+ metadata.gz: ebfbcfe1d5771dd2cb7f2a61cabd12011eb52916
4
+ data.tar.gz: a6c264f051a876b90c608ade59c701fe85e309c2
5
5
  SHA512:
6
- metadata.gz: 0777d9f98e288504f35f990422d7dec9d8911061b2825a577a4b27cf4adba37607ca70da86894953fe14274ed49a894d8378cbb5f0da160373a9421c68027490
7
- data.tar.gz: 60db36d4cf8a4dade79edb173fe7738b1ee6a9bc848ba428111d37ab14ceb229036254276b387d530facee916b5bd90cb35e5fc94339815301f5e7f8485c1a15
6
+ metadata.gz: 3ab5f9913200cfc00d75dd49fa30f6e2e2a6c53cd6f8a21cca49b94b1db57005966f80e5384decb21f942838aa4cdda68a18b2338702d0531d0ad2cd318b051b
7
+ data.tar.gz: bc7bc2e2d6e7e5024053247c1680b4f1311530590ed0abf8a15de2a2605c70500cf7bd81e960c1f8e3097fe34cfd46785c288b712757222ce30a614980333217
data/bin/param ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/param'
6
+
7
+ Awful::Param.start(ARGV)
@@ -0,0 +1,97 @@
1
+ module Awful
2
+ module Short
3
+ def param(*args)
4
+ Awful::Param.new.invoke(*args)
5
+ end
6
+ end
7
+
8
+ class Param < Cli
9
+ no_commands do
10
+ def ssm
11
+ @ssm ||= Aws::SSM::Client.new
12
+ end
13
+ end
14
+
15
+ desc 'ls [NAMES]', 'list parameters'
16
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
17
+ method_option :type, aliases: '-t', type: :array, default: nil, desc: 'filter types: String, StringList, SecureString'
18
+ method_option :key_id, aliases: '-k', type: :array, default: nil, desc: 'filter key IDs'
19
+ def ls(*names)
20
+ filters = []
21
+ filters += [{key: 'Name', values: names}] unless names.empty?
22
+ filters += [{key: 'Type', values: options[:type]}] if options[:type]
23
+ filters += [{key: 'KeyId', values: options[:key_id]}] if options[:key_id]
24
+ paginate(:parameters) do |token|
25
+ ssm.describe_parameters(filters: filters, next_token: token)
26
+ end.output do |params|
27
+ if options[:long]
28
+ print_table params.map { |p|
29
+ [p.name, p.type, p.description, p.key_id, p.last_modified_date, p.last_modified_user]
30
+ }
31
+ else
32
+ puts params.map(&:name)
33
+ end
34
+ end
35
+ end
36
+
37
+ desc 'get NAMES', 'get parameter values'
38
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
39
+ method_option :decrypt, aliases: '-d', type: :boolean, default: false, desc: 'decrypt values for SecureString types'
40
+ def get(*names)
41
+ ssm.get_parameters(names: names, with_decryption: options[:decrypt]).parameters.output do |params|
42
+ if options[:long]
43
+ print_table params.map { |p|
44
+ [p.name, p.value]
45
+ }
46
+ else
47
+ puts params.map(&:value)
48
+ end
49
+ end
50
+ end
51
+
52
+ desc 'history NAME', 'get parameter history'
53
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
54
+ def history(name)
55
+ paginate(:parameters) do |token|
56
+ ssm.get_parameter_history(
57
+ name: name,
58
+ with_decryption: options[:decrypt],
59
+ next_token: token,
60
+ )
61
+ end.output do |params|
62
+ if options[:long]
63
+ print_table params.map { |p|
64
+ [p.name, p.value, p.last_modified_date, p.last_modified_user]
65
+ }
66
+ else
67
+ puts params.map(&:value)
68
+ end
69
+ end
70
+ end
71
+
72
+ desc 'put NAME VALUE', 'put parameter into the store'
73
+ method_option :description, aliases: '-d', type: :string, default: nil, desc: 'description for params'
74
+ method_option :type, aliases: '-t', type: :string, default: 'String', desc: 'String, StringList, SecureString'
75
+ method_option :key_id, aliases: '-k', type: :string, default: nil, desc: 'KMS key for SecureString params'
76
+ method_option :overwrite, aliases: '-o', type: :boolean, default: false, desc: 'overwrite existing params'
77
+ def put(name, value)
78
+ ssm.put_parameter(
79
+ name: name,
80
+ value: value,
81
+ description: options[:description],
82
+ type: options[:type],
83
+ key_id: options[:key_id],
84
+ overwrite: options[:overwrite],
85
+ )
86
+ end
87
+
88
+ desc 'delete NAME', 'delete parameter from the store'
89
+ method_option :yes, aliases: '-y', type: :boolean, default: false, desc: 'delete without query'
90
+ def delete(name)
91
+ if options[:yes] || yes?("Really delete parameter #{name}?", :yellow)
92
+ ssm.delete_parameter(name: name)
93
+ end
94
+ end
95
+
96
+ end
97
+ end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.162'
2
+ VERSION = '0.0.163'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.162
4
+ version: 0.0.163
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -107,6 +107,7 @@ executables:
107
107
  - kms
108
108
  - lambda
109
109
  - lc
110
+ - param
110
111
  - r53
111
112
  - rds
112
113
  - route
@@ -151,6 +152,7 @@ files:
151
152
  - bin/kms
152
153
  - bin/lambda
153
154
  - bin/lc
155
+ - bin/param
154
156
  - bin/r53
155
157
  - bin/rds
156
158
  - bin/route
@@ -194,6 +196,7 @@ files:
194
196
  - lib/awful/lambda.rb
195
197
  - lib/awful/lambda_events.rb
196
198
  - lib/awful/launch_config.rb
199
+ - lib/awful/param.rb
197
200
  - lib/awful/rds.rb
198
201
  - lib/awful/route53.rb
199
202
  - lib/awful/route_table.rb