kanmon 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a456c501f0a74223496549c37e6b9f4631d9f9e8e4d77d6c21bfbe7b13550958
4
- data.tar.gz: 5ab3f237e4e0bfd406803c5423c92ea46ae6764cbece9ed7806cd60763b2b187
3
+ metadata.gz: f8165d679d79798562ce7492a1968f1644f18eea223197e70e6dfa990238e745
4
+ data.tar.gz: 64a060d28220d756431c319ab605336e1e4a47789d38b6819f13e9264687ad14
5
5
  SHA512:
6
- metadata.gz: 2ce5e30cec4511001057de71a4070bc0610348f4d853f0ec0a88711811dfc70655106c38ef0f635e4db5d89a3d2e8f2fcd49d625228d75314a29bd4b7c73342b
7
- data.tar.gz: ea9918c0df250a83109046063104f4b14634da3c43d0e8a5d330fb2c8affe53831062be83a0027234956f0acf8bedf4cb35e9d121e040b6c820ba2707f97f4ce
6
+ metadata.gz: a5fa331534b84747fe2645732e3f3407fc2b38255fc3d1b1bcb12bc64049e43aac6e28186eb5b502bf82fbe035341c7862c5c3835aa486a982cb634c719b4021
7
+ data.tar.gz: 59a3dcbf8bde5d122d31fa7675ff7ed16f46a1007344838cc4a6cc7e32ecfd3ddba26bbc7249cbc1c1c1071f18aae667289f43c8cffb69d8791c3825361c37f8
data/Gemfile.lock CHANGED
@@ -3,7 +3,7 @@ PATH
3
3
  specs:
4
4
  kanmon (0.1.0)
5
5
  hanami-cli (>= 0.1.1)
6
- yao (>= 0.3.8)
6
+ yao (>= 0.4.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -14,10 +14,10 @@ GEM
14
14
  multipart-post (>= 1.2, < 3)
15
15
  faraday_middleware (0.12.2)
16
16
  faraday (>= 0.7.4, < 1.0)
17
- hanami-cli (0.1.1)
17
+ hanami-cli (0.2.0)
18
18
  concurrent-ruby (~> 1.0)
19
- hanami-utils (~> 1.1)
20
- hanami-utils (1.1.2)
19
+ hanami-utils (~> 1.2)
20
+ hanami-utils (1.2.0)
21
21
  concurrent-ruby (~> 1.0)
22
22
  transproc (~> 1.0)
23
23
  json (2.1.0)
@@ -37,7 +37,7 @@ GEM
37
37
  rspec-support (~> 3.7.0)
38
38
  rspec-support (3.7.1)
39
39
  transproc (1.0.2)
40
- yao (0.3.8)
40
+ yao (0.4.1)
41
41
  faraday (~> 0.12.0)
42
42
  faraday_middleware
43
43
  json
data/README.md CHANGED
@@ -27,3 +27,9 @@ $ export OS_PROJECT_DOMAIN_NAME=default
27
27
  ```
28
28
  $ kanmon open
29
29
  ```
30
+
31
+ 追加したSecurity Groupのルールを削除します。
32
+
33
+ ```
34
+ $ kanmon close
35
+ ```
data/kanmon.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "yao", ">= 0.3.8"
23
+ spec.add_dependency "yao", ">= 0.4.1"
24
24
  spec.add_dependency "hanami-cli", ">= 0.1.1"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.16"
@@ -0,0 +1,43 @@
1
+ require "yao"
2
+ require "yaml"
3
+ require "kanmon/commands/base"
4
+
5
+ module Kanmon
6
+ module Commands
7
+ class Close < Base
8
+ option :file, default: "kanmon.yml", desc: "config file path"
9
+
10
+ def call(**options)
11
+ id = YAML.load_file(options.fetch(:file))["security_group"]
12
+ tenant_id = Yao.current_tenant_id
13
+
14
+ rule = {
15
+ direction: "ingress",
16
+ port_range_min: 22,
17
+ port_range_max: 22,
18
+ ethertype: "IPv4",
19
+ protocol: "tcp",
20
+ security_group_id: id,
21
+ tenant_id: tenant_id,
22
+ }
23
+
24
+ result = Yao::SecurityGroupRule.list(rule)
25
+
26
+ if result.empty?
27
+ puts "Not found"
28
+ exit(1)
29
+ end
30
+
31
+ result.each do |rule|
32
+ id = rule.id
33
+ puts "Delete #{id}"
34
+ Yao::SecurityGroupRule.destroy(id)
35
+ end
36
+
37
+ puts "Success!!"
38
+ end
39
+ end
40
+
41
+ register "close", Close
42
+ end
43
+ end
@@ -4,6 +4,7 @@ module Kanmon
4
4
  module Commands
5
5
  extend Hanami::CLI::Registry
6
6
 
7
+ require "kanmon/commands/close"
7
8
  require "kanmon/commands/open"
8
9
  require "kanmon/commands/version"
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Kanmon
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanmon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Koya
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.8
19
+ version: 0.4.1
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: 0.3.8
26
+ version: 0.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hanami-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ files:
103
103
  - lib/kanmon.rb
104
104
  - lib/kanmon/commands.rb
105
105
  - lib/kanmon/commands/base.rb
106
+ - lib/kanmon/commands/close.rb
106
107
  - lib/kanmon/commands/open.rb
107
108
  - lib/kanmon/commands/version.rb
108
109
  - lib/kanmon/version.rb