sgdoc 0.1.0 → 0.1.1

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: 2a488f37d0d4b8921d508b17f273dbf423d527bf
4
- data.tar.gz: 2a01b6e054105d90ebc8291fe1a6d018d2252598
3
+ metadata.gz: dfe3f1db6cd5e5afe70362d29b25df3685ca6a87
4
+ data.tar.gz: 1a8c5c041de3ab4da7a378c3604425f93610b0f2
5
5
  SHA512:
6
- metadata.gz: 48b43aba768af54d2259d23174d2a1d2fe230202bb607077cdf60f0d7218f5321daa9ea6f4ce2013dadae841e57ca38a8e661f791870daa0f1ccc4f4f6313744
7
- data.tar.gz: f8a314a60fc2a564ea08059faa525d0a513fd064883df7ea45591d49be22d5244fde22df06998e27ea51b5117d469565d92b0c5be949e86a346593421cd0504e
6
+ metadata.gz: c3a5a02940643289850d5fc2cffd02cc0941382f0755ed1f1c02db7726804c8ea129c27f67ad19efe36dddd69127b674ae611111aa1c5aa9bd39c6e47d25fa56
7
+ data.tar.gz: 1762e52af27785541335ec2f3f580157dd0d89e19401f801da25f7196ec0a1f583561479aa0aea0075d244c4671c6d02384aa4fd0c7bd909b3acd09746847871
data/Dockerfile ADDED
@@ -0,0 +1,7 @@
1
+ FROM ruby:latest
2
+ MAINTAINER Yuji Takaesu <taka.esu.user@gmail.com>
3
+
4
+ RUN gem install sgdoc
5
+
6
+ ENTRYPOINT ["sgdoc"]
7
+ CMD [""]
data/README.ja.md CHANGED
@@ -11,19 +11,32 @@ SGを参照しているサービスはEC2,RDS,ELBを対象とする(その他は
11
11
 
12
12
  ## やりたいこと
13
13
 
14
- - [ ] aws-sdkで必要な情報を取得してハッシュ化
15
- - [ ] Erubisに渡してerbテンプレートで展開する
14
+ - Erubisに渡してerbテンプレートで展開する
16
15
  - ドキュメントにはSecurityGroupの内容
17
16
  - 関連付けの情報(EC2, ELB, EC2)
18
- - [ ] SecurityGroupのIn,Outのポリシーにコメントを入れれるようにしたい(別ファイルでポートのコメント管理。定型文はYamlで管理(0.0.0.0/0など))
19
-
17
+ - SecurityGroupのIn,Outのポリシーにコメントを入れれるようにしたい(別ファイルでポートのコメント管理。定型文はYamlで管理(0.0.0.0/0など))
20
18
 
21
19
  ### Credentialは次の順番で有効になる
22
- - (これは設定しないのでいらないかな) `:access_key_id` , `:secret_access_key` , and `:session_token` options
23
- - `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`
20
+ - () `:access_key_id` , `:secret_access_key` , and `:session_token` options
21
+ - `ENV['AWS_REGION']`, `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`
24
22
  - HOME/.aws/credentials shared credentials file
25
23
  - EC2 instance profile credentials See Plugins::RequestSigner for more details.
26
24
 
25
+
26
+ ### 実行方法
27
+
28
+ ```
29
+ shared credentials file(HOME/.aws/credentials) に設定がある場合
30
+ $ sgdoc > sgdoc.md
31
+
32
+ 環境変数を設定して実行
33
+ $ AWS_REGION=ap-northeast-1 AWS_ACCESS_KEY_ID=[ACCESS_KEY] AWS_SECRET_ACCESS_KEY=[SECRET_ACCESS_KEY] sgdoc > sgdoc.md
34
+
35
+ Dockerで実行する
36
+ $ docker build . -f Dockerfile -t yusabana/sgdoc
37
+ $ docker run --rm -e AWS_REGION=ap-northeast-1 -e AWS_ACCESS_KEY_ID=[ACCESS_KEY] -e AWS_SECRET_ACCESS_KEY=[SECRET_ACCESS_KEY] yusabana/sgdoc sgdoc
38
+ ```
39
+
27
40
  ## Requirements
28
41
 
29
42
  Ruby 2.1 or higher
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Sgdoc
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sgdoc`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/yusabana/sgdoc.svg?branch=master)](https://travis-ci.org/yusabana/sgdoc)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ For Japanese [README.ja.md](README.ja.md)
6
6
 
7
7
  ## Installation
8
8
 
data/lib/sgdoc/client.rb CHANGED
@@ -10,7 +10,7 @@ module Sgdoc
10
10
 
11
11
  def security_groups_by_vpc_id
12
12
  describe_security_groups = @ec2_client.describe_security_groups.security_groups
13
- security_groups ||= describe_security_groups.map { |sg| Sgdoc::EC2::SecurityGroup.new(sg) }
13
+ security_groups = describe_security_groups.map { |sg| Sgdoc::EC2::SecurityGroup.new(sg) }
14
14
 
15
15
  # vpcIDのキーをvpcのオブジェクトにしても良い
16
16
  security_groups.group_by { |sg| sg.vpc_id }
@@ -4,7 +4,7 @@ module Sgdoc
4
4
  ALL_STRING = 'all'
5
5
 
6
6
  def initialize(ip_permission:, ip_range: nil, user_id_group_pair: nil)
7
- raise StandardError 'Unknown pattern of IpPermission, at least must need ip_range or user_id_group_pair' if ip_range.nil? && user_id_group_pair.nil?
7
+ raise StandardError, 'Unknown pattern of IpPermission, at least must need ip_range or user_id_group_pair' if ip_range.nil? && user_id_group_pair.nil?
8
8
 
9
9
  @ip_range = ip_range
10
10
  @user_id_group_pair = user_id_group_pair
@@ -38,7 +38,7 @@ module Sgdoc
38
38
 
39
39
  def doc_description
40
40
  # TODO desriptionを出力する使用を考える(IPベースの設定ファイルでいいかも)
41
- '-'
41
+ ' '
42
42
  end
43
43
  end
44
44
  end
@@ -14,7 +14,7 @@ module Sgdoc
14
14
  end
15
15
 
16
16
  def tags_to_json
17
- return '-' if tags.empty?
17
+ return ' ' if tags.empty?
18
18
 
19
19
  tags.each_with_object({}) do |tag, memo|
20
20
  memo[tag.key] = tag.value
@@ -10,7 +10,7 @@
10
10
 
11
11
  ### Inbound
12
12
 
13
- | Protocol | Port | Source | _Description |
13
+ | Protocol | Port | Source | %Description |
14
14
  | ---- | ---- | ---- | ---- |
15
15
  <% if sg.inbound_permissions.each do |iperm| %>
16
16
  | <%= iperm.protocol %> | <%= iperm.port %> | <%= iperm.target %> | <%= iperm.doc_description %> |
@@ -20,7 +20,7 @@
20
20
 
21
21
  ### Outbound
22
22
 
23
- | Protocol | Port | Destination | _Description |
23
+ | Protocol | Port | Destination | %Description |
24
24
  | ---- | ---- | ---- | ---- |
25
25
  <% if sg.outbound_permissions.each do |operm| %>
26
26
  | <%= operm.protocol %> | <%= operm.port %> | <%= operm.target %> | <%= operm.doc_description %> |
data/lib/sgdoc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sgdoc
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sgdoc
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
  - Yuji Takaesu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-08 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -119,6 +119,7 @@ files:
119
119
  - ".gitignore"
120
120
  - ".rspec"
121
121
  - ".travis.yml"
122
+ - Dockerfile
122
123
  - Gemfile
123
124
  - LICENSE.txt
124
125
  - README.ja.md