piculet 0.2.9 → 0.3.0.beta

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
  SHA1:
3
- metadata.gz: 50ef370817bd3615bed9c3ffeae81b5ef8b11978
4
- data.tar.gz: e618c98b81b2e93f9f2cf59b88c5aa58a4328e8b
3
+ metadata.gz: 0d8c3a5c55a605d8555f6b998433be8e08084b69
4
+ data.tar.gz: 3c7047cc2a79f5d48192e852f2663dc150f4b82d
5
5
  SHA512:
6
- metadata.gz: ae58fa15a2f1170f06114ad7cb17e29738802d1508e90b37ab8fb2f1cfb8811b20e839617a178a17972ba421a39f29c500c5a159d26f13b8acfb5265fffd206c
7
- data.tar.gz: e02c74ec15021344a327816f95b4260845d236f9288694f4d5ab85ac83139d7b499cba4e53d44f38698c7af5ab45c09ee352ed71bea6cb4908a01a1a6bd6b8a6
6
+ metadata.gz: c575bdf80393f19080da573719c3885481b10a66c94b07c6a9682461222681350dde59a8b289e4d320671956240c73f54baf4b25302500cf920835b4fffa0231
7
+ data.tar.gz: f692e646b3f49078ee1fb11bd6ef9ba694bfe8c45efe9888dc3f7ae4b1de3db9f9f05d9ef612ae1f198377cbd49f8786aa765e72937dc2c959b724b1d7fbd978
@@ -52,6 +52,10 @@ ARGV.options do |opt|
52
52
  opt.on('' , '--debug') { options[:debug] = true }
53
53
  opt.parse!
54
54
 
55
+ credentials_path ||= ENV['AWS_CONFIG_FILE']
56
+ profile_name ||= ENV['AWS_DEFAULT_PROFILE']
57
+ region ||= ENV['AWS_DEFAULT_REGION']
58
+
55
59
  aws_opts = {}
56
60
  if access_key and secret_key
57
61
  aws_opts = {
@@ -60,9 +64,25 @@ ARGV.options do |opt|
60
64
  }
61
65
  elsif profile_name or credentials_path
62
66
  credentials_opts = {}
63
- credentials_opts[:profile_name] = profile_name if profile_name
64
- credentials_opts[:path] = credentials_path if credentials_path
65
- provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(credentials_opts)
67
+ if credentials_path
68
+ credentials_opts[:path] = credentials_path
69
+ AWSConfig.credentials_file = credentials_path
70
+ end
71
+ if profile_name
72
+ credentials_opts[:profile_name] = profile_name
73
+ role_arn = AWSConfig[profile_name][:role_arn]
74
+ end
75
+ if role_arn
76
+ session_name = "piculet-session-#{Time.now.to_i}"
77
+ sts = AWS::STS.new(AWSConfig[profile_name].config_hash)
78
+ provider = AWS::Core::CredentialProviders::AssumeRoleProvider.new(
79
+ sts: sts,
80
+ role_arn: role_arn,
81
+ role_session_name: session_name
82
+ )
83
+ else
84
+ provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(credentials_opts)
85
+ end
66
86
  aws_opts[:credential_provider] = provider
67
87
  elsif (access_key and !secret_key) or (!access_key and secret_key) or mode.nil?
68
88
  puts opt.help
@@ -10,6 +10,7 @@ require 'hashie'
10
10
  require 'ipaddr'
11
11
 
12
12
  require 'aws-sdk-v1'
13
+ require 'aws_config'
13
14
 
14
15
  require 'piculet/ext/ec2-owner-id-ext'
15
16
  require 'piculet/ext/security-group'
@@ -1,3 +1,3 @@
1
1
  module Piculet
2
- VERSION = "0.2.9"
2
+ VERSION = "0.3.0.beta"
3
3
  end
@@ -7,7 +7,7 @@ module Piculet
7
7
 
8
8
  def_delegators(
9
9
  :@security_group,
10
- :vpc_id, :name, :vpc?)
10
+ :vpc_id, :name)
11
11
 
12
12
  def initialize(security_group, options)
13
13
  @security_group = security_group
@@ -42,6 +42,10 @@ module Piculet
42
42
  end
43
43
  end
44
44
 
45
+ def vpc?
46
+ !!@security_group
47
+ end
48
+
45
49
  def tags
46
50
  h = {}
47
51
  @security_group.tags.map {|k, v| h[k] = v }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piculet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2017-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.6.8
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.8
83
+ - !ruby/object:Gem::Dependency
84
+ name: aws_config
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.0
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -170,12 +198,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
198
  version: '0'
171
199
  required_rubygems_version: !ruby/object:Gem::Requirement
172
200
  requirements:
173
- - - ">="
201
+ - - ">"
174
202
  - !ruby/object:Gem::Version
175
- version: '0'
203
+ version: 1.3.1
176
204
  requirements: []
177
205
  rubyforge_project:
178
- rubygems_version: 2.5.1
206
+ rubygems_version: 2.6.13
179
207
  signing_key:
180
208
  specification_version: 4
181
209
  summary: Piculet is a tool to manage EC2 Security Group.