stax 0.1.9 → 0.1.10

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
  SHA256:
3
- metadata.gz: 184e068dc00c13a187864710303862b2049ec3f353cdf7bda094dc94fe711201
4
- data.tar.gz: a2fa06ab9dad658167b57cfbbaf7411a73cbfeccf1cb2eb4ab4c5a50beea9c97
3
+ metadata.gz: e17c465590b04d1db946eb5cf12e660fb01a63c348aefcfadca2b5d98e568e52
4
+ data.tar.gz: d585924ea4d53397cc817cda8a617f7a14c430d84befa9f485ee5440a64653af
5
5
  SHA512:
6
- metadata.gz: 6491ccdb338d2883cc657eceab4255d14b6202bea65494f3a9ef71a6e459affa813252a5bdb766fb9e12a10d4d3a2121ebe39b80f7ef7803c0f0894b10eba326
7
- data.tar.gz: 76e87f6dc9e8569d025ab23fc6ac662e30bb00439b8f06c6e7cfb7a0cc42c7e12046a76627e7de3c6b0f493764ecef8f77e52a66fb7e68d98c0899266d6340fe
6
+ metadata.gz: 4d71a59e526634d2c27d768db9e979569482e53bfeb43ae3907326dd851ba983c3498d5b04ec11727461abcdee5e1dfcf7f634a0c1b6338901718b9092652fb0
7
+ data.tar.gz: eb8469a0fd373332b3d51171324e9ec9857c77e8a75cdf50c1f6414304af84bcfde1628087ea1866acf6a63b29f4ca5fa9cc13364ec7d8de59e2d330cd20555a
data/bin/stax CHANGED
@@ -5,6 +5,8 @@ require 'stax'
5
5
  Stax.load_staxfile
6
6
  begin
7
7
  Stax::Cli.start(ARGV)
8
- rescue Aws::CloudFormation::Errors::ExpiredToken => e
8
+ rescue Aws::CloudFormation::Errors::ExpiredToken,
9
+ Aws::CloudFormation::Errors::ValidationError,
10
+ Aws::Errors::MissingCredentialsError => e
9
11
  abort(e.message)
10
12
  end
data/lib/stax/cli/ls.rb CHANGED
@@ -2,37 +2,43 @@ module Stax
2
2
  class Cli < Base
3
3
 
4
4
  no_commands do
5
+ ## fields to show in output
6
+ def ls_stack_fields(s)
7
+ [ s.stack_name, s.creation_time, color(s.stack_status, Aws::Cfn::COLORS) ]
8
+ end
9
+
10
+ ## list stacks from Staxfile in given order
5
11
  def ls_staxfile_stacks
6
- stacks = Aws::Cfn.stacks.each_with_object({}) { |s, h| h[s.stack_name] = s }
7
12
  print_table Stax.stack_list.map { |id|
8
13
  name = stack(id).stack_name
9
- if (s = stacks[name])
10
- [s.stack_name, s.creation_time, color(s.stack_status, Aws::Cfn::COLORS), s.template_description]
14
+ if (s = Aws::Cfn.describe(name))
15
+ ls_stack_fields(s)
11
16
  else
12
- options[:existing] ? nil : [name, '-']
17
+ [ name, '-' ]
13
18
  end
14
- }.compact
19
+ }
15
20
  end
16
21
 
22
+ ## list all extant stacks we think match our prefix
17
23
  def ls_stacks_with_prefix(prefix)
18
24
  print_table Aws::Cfn.stacks.select { |s|
19
25
  s.stack_name.start_with?(prefix || stack_prefix)
20
26
  }.map { |s|
21
- [s.stack_name, s.creation_time, color(s.stack_status, Aws::Cfn::COLORS), s.template_description]
27
+ ls_stack_fields(s)
22
28
  }.sort
23
29
  end
24
30
 
31
+ ## list all stacks in account
25
32
  def ls_account_stacks
26
33
  print_table Aws::Cfn.stacks.map { |s|
27
- [s.stack_name, s.creation_time, color(s.stack_status, Aws::Cfn::COLORS), s.template_description]
34
+ ls_stack_fields(s)
28
35
  }.sort
29
36
  end
30
37
  end
31
38
 
32
39
  desc 'ls [PREFIX]', 'list stacks'
33
- method_option :existing, aliases: '-e', type: :boolean, default: false, desc: 'list just existing stacks'
34
- method_option :all, aliases: '-a', type: :boolean, default: false, desc: 'list all running stacks with our prefix'
35
- method_option :account, aliases: '-A', type: :boolean, default: false, desc: 'list all running stacks in account'
40
+ method_option :all, aliases: '-a', type: :boolean, default: false, desc: 'list all running stacks with our prefix'
41
+ method_option :account, aliases: '-A', type: :boolean, default: false, desc: 'list all running stacks in account'
36
42
  def ls(prefix = nil)
37
43
  if options[:account]
38
44
  ls_account_stacks
@@ -44,4 +50,4 @@ module Stax
44
50
  end
45
51
 
46
52
  end
47
- end
53
+ end
data/lib/stax/cli.rb CHANGED
@@ -9,6 +9,7 @@ module Stax
9
9
  class Cli < Base
10
10
  class_option :branch, type: :string, default: Git.branch, desc: 'git branch to use'
11
11
  class_option :app, type: :string, default: File.basename(Git.toplevel), desc: 'application name'
12
+
12
13
  ## silence deprecation warning
13
14
  ## https://github.com/erikhuda/thor/blob/fb625b223465692a9d8a88cc2a483e126f1a8978/CHANGELOG.md#100
14
15
  def self.exit_on_failure?
@@ -158,6 +158,25 @@ module Stax
158
158
  end
159
159
  end
160
160
 
161
+ desc 'write-forwarding', 'control write-forwarding'
162
+ method_option :disable, aliases: '-d', type: :boolean, desc: 'disable write-forwarding'
163
+ method_option :enable, aliases: '-e', type: :boolean, desc: 'enable write-forwarding'
164
+ def write_forwarding
165
+ stack_db_clusters.map(&:physical_resource_id).each do |cluster|
166
+ if options[:enable]
167
+ puts "#{cluster} enabling write-forwarding"
168
+ Aws::Rds.client.modify_db_cluster(db_cluster_identifier: cluster, enable_global_write_forwarding: true)
169
+ elsif options[:disable]
170
+ puts "#{cluster} disabling write-forwarding"
171
+ Aws::Rds.client.modify_db_cluster(db_cluster_identifier: cluster, enable_global_write_forwarding: false)
172
+ else
173
+ print_table Aws::Rds.client.describe_db_clusters(db_cluster_identifier: cluster).db_clusters.map { |c|
174
+ [ c.db_cluster_identifier, c.global_write_forwarding_status || '-' ]
175
+ }
176
+ end
177
+ end
178
+ end
179
+
161
180
  end
162
181
  end
163
182
  end
@@ -21,4 +21,4 @@ module Stax
21
21
  end
22
22
 
23
23
  end
24
- end
24
+ end
data/lib/stax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stax
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -610,7 +610,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
610
610
  - !ruby/object:Gem::Version
611
611
  version: '0'
612
612
  requirements: []
613
- rubygems_version: 3.1.4
613
+ rubygems_version: 3.1.6
614
614
  signing_key:
615
615
  specification_version: 4
616
616
  summary: Control Cloudformation stack and other stuff.