rds_concerto 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a2517c6d84fb8cf3bba71e26892dc0ef6ca9ab0aaf67c566d9ca8886b4c229b
4
- data.tar.gz: 3fe1a66adb8672f2cbec6912e902e87ec0e224a3fa523b9d2c4bddc9bd3b0c9c
3
+ metadata.gz: 6d61fd7326756924697389a92e7fd7d4c4703f2cdb0fda94ac2b26d6e76679e5
4
+ data.tar.gz: 5bceb36c8a9620e2f193fa1f886889169d5744411874c370e048b1db89705476
5
5
  SHA512:
6
- metadata.gz: c802ce68b8f2f0992718fb4d668bf70619e57f16a2f129811e112b2560a84ffac7c302ee67b52aafc5a417c51819799ba90a189db597d3e5e3888ae76e43f766
7
- data.tar.gz: ea83ae1b26e155bbde0ab34f6dcd18e74b9262a47c6512f3168d4e612088c04b65a852631ae0612deccf7099c514c3a15a47fcc45464d8786b7fe8c56ff3a1d6
6
+ metadata.gz: e9e69e17375c7b6acf152b2bcbc05076e8ba225a4fb32a46e72f611a8f624eba5688e90cd050dfd79511c90dae5fe95c1bcce4b537194e7b78c4fb1a57f28ba4
7
+ data.tar.gz: 05b0b552bd127dc317c2650ec909655adc27052da5cbde3b426737bf4197a39b0967e830328e7bd8faf15c88a8027ac107891cd9df026f03eca8571781a3c738
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ vendor
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rds_concerto (0.1.0)
4
+ rds_concerto (0.1.1)
5
5
  aws-sdk-rds
6
6
  thor
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- aws-eventstream (1.0.3)
12
- aws-partitions (1.240.0)
13
- aws-sdk-core (3.78.0)
14
- aws-eventstream (~> 1.0, >= 1.0.2)
11
+ aws-eventstream (1.1.0)
12
+ aws-partitions (1.358.0)
13
+ aws-sdk-core (3.104.4)
14
+ aws-eventstream (~> 1, >= 1.0.2)
15
15
  aws-partitions (~> 1, >= 1.239.0)
16
16
  aws-sigv4 (~> 1.1)
17
17
  jmespath (~> 1.0)
18
- aws-sdk-rds (1.71.0)
19
- aws-sdk-core (~> 3, >= 3.71.0)
18
+ aws-sdk-rds (1.96.0)
19
+ aws-sdk-core (~> 3, >= 3.99.0)
20
20
  aws-sigv4 (~> 1.1)
21
- aws-sigv4 (1.1.0)
22
- aws-eventstream (~> 1.0, >= 1.0.2)
21
+ aws-sigv4 (1.2.2)
22
+ aws-eventstream (~> 1, >= 1.0.2)
23
23
  coderay (1.1.2)
24
24
  diff-lcs (1.3)
25
25
  jmespath (1.4.0)
@@ -27,7 +27,7 @@ GEM
27
27
  pry (0.12.2)
28
28
  coderay (~> 1.1.0)
29
29
  method_source (~> 0.9.0)
30
- rake (10.5.0)
30
+ rake (13.0.1)
31
31
  rspec (3.9.0)
32
32
  rspec-core (~> 3.9.0)
33
33
  rspec-expectations (~> 3.9.0)
@@ -41,7 +41,7 @@ GEM
41
41
  diff-lcs (>= 1.2.0, < 2.0)
42
42
  rspec-support (~> 3.9.0)
43
43
  rspec-support (3.9.0)
44
- thor (0.20.3)
44
+ thor (1.0.1)
45
45
 
46
46
  PLATFORMS
47
47
  ruby
@@ -49,7 +49,7 @@ PLATFORMS
49
49
  DEPENDENCIES
50
50
  bundler
51
51
  pry
52
- rake (~> 10.0)
52
+ rake (~> 13.0)
53
53
  rds_concerto!
54
54
  rspec (~> 3.0)
55
55
 
@@ -73,6 +73,20 @@ class RdsConcerto::Aurora::Client
73
73
  RdsConcerto::Config.database_url_format.gsub('{{endpoint}}', instance[:endpoint])
74
74
  end
75
75
 
76
+ def start_from_stopping(name, dry_run: false)
77
+ if not cloned_instances.map { |x| x[:name] }.include?(name)
78
+ raise 'Command failed. Do not found resource.'
79
+ end
80
+ RdsConcerto::Aurora::Resource.new(rds_client: rds_client, name: name).start! unless dry_run
81
+ end
82
+
83
+ def stop_from_available(name, dry_run: false)
84
+ if not cloned_instances.map { |x| x[:name] }.include?(name)
85
+ raise 'Command failed. Do not found resource.'
86
+ end
87
+ RdsConcerto::Aurora::Resource.new(rds_client: rds_client, name: name).stop! unless dry_run
88
+ end
89
+
76
90
  private
77
91
 
78
92
  def get_arn(identifier: )
@@ -18,6 +18,15 @@ class RdsConcerto::Aurora::Resource
18
18
  }
19
19
  end
20
20
 
21
+ def start!
22
+ { start_db_cluster_response: rds_client.start_db_cluster(db_cluster_identifier: name) }
23
+ end
24
+
25
+ # https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/RDS/Client.html#stop_db_cluster-instance_method
26
+ def stop!
27
+ { stop_db_cluster_response: rds_client.stop_db_cluster(db_cluster_identifier: name) }
28
+ end
29
+
21
30
  private
22
31
 
23
32
  def restore_db_cluster!(name: , tags: )
@@ -37,11 +37,24 @@ class RdsConcerto::CLI < Thor
37
37
  end
38
38
 
39
39
  desc "url NAME(URL を取得するインスタンスを指定したい場合。指定しなければ適当に選びます)", "インスタンスに接続するための URL の取得"
40
- def url(name = nil)
40
+ def url(name=nil)
41
41
  concerto = RdsConcerto::Aurora.new(config_path: options[:config])
42
42
  puts concerto.url(name)
43
43
  end
44
44
 
45
+ desc "start NAME", ""
46
+ option :name, desc: "instance identifier"
47
+ def start(name=nil)
48
+ concerto = RdsConcerto::Aurora.new(config_path: options[:config])
49
+ concerto.start_from_stopping(name || options[:name], dry_run: options[:pretend])
50
+ end
51
+
52
+ desc "stop NAME", ""
53
+ def stop(name=nil)
54
+ concerto = RdsConcerto::Aurora.new(config_path: options[:config])
55
+ concerto.stop_from_available(name || options[:name], dry_run: options[:pretend])
56
+ end
57
+
45
58
  private
46
59
 
47
60
  def show_replica
@@ -1,3 +1,3 @@
1
1
  module RdsConcerto
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "thor"
27
27
 
28
28
  spec.add_development_dependency "bundler"
29
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  spec.add_development_dependency "pry"
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rds_concerto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-02 00:00:00.000000000 Z
11
+ date: 2020-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-rds
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ homepage: https://github.com/jiikko/rds_concerto
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}
129
- post_install_message:
129
+ post_install_message:
130
130
  rdoc_options: []
131
131
  require_paths:
132
132
  - lib
@@ -141,9 +141,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubyforge_project:
144
+ rubyforge_project:
145
145
  rubygems_version: 2.7.6
146
- signing_key:
146
+ signing_key:
147
147
  specification_version: 4
148
148
  summary: tool that to clone AWS-RDS Aurora instance
149
149
  test_files: []