s3sizecalc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/s3sizecalc/calculator.rb +19 -2
- data/lib/s3sizecalc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc31e53445a70a96cb117d1a3801ba5d4f0b9b51
|
4
|
+
data.tar.gz: 672648c5f0857fe362dd7f0f57c2d049d4836845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64b2bbd48c67129261408d4dbde98e9feb9890d0e00904e9fb43f28f89d055221929ec561db2619a15f46aaa419f749a81bf8878cd418acd8f76cec82af50f86
|
7
|
+
data.tar.gz: cdc947b4a5e5635b55502ef10ca6d017531c704959b74b788ca01e6799af52d940f965808a0faba7ffe8e7a7a1926dec6ab76f5f2a3c861103c155a70a677350
|
@@ -57,11 +57,28 @@ module S3SizeCalc
|
|
57
57
|
|
58
58
|
def s3(region = current_region)
|
59
59
|
name = :"@s3_#{region.gsub("-", "_")}"
|
60
|
-
instance_variable_get(name) or instance_variable_set(name, Aws::S3::Resource.new(region: (region)))
|
60
|
+
instance_variable_get(name) or instance_variable_set(name, Aws::S3::Resource.new(aws_configuration.merge region: (region)))
|
61
61
|
end
|
62
62
|
|
63
63
|
def ec2
|
64
|
-
@ec2 ||= Aws::EC2::Resource.new(region:
|
64
|
+
@ec2 ||= Aws::EC2::Resource.new(aws_configuration.merge region: current_region)
|
65
|
+
end
|
66
|
+
|
67
|
+
def aws_configuration
|
68
|
+
return @aws_configuration if @aws_configuration
|
69
|
+
|
70
|
+
@aws_configuration = {}
|
71
|
+
|
72
|
+
[:access_key_id, :secret_access_key].each do |option|
|
73
|
+
@aws_configuration.update(option => @options[option]) if @options[option]
|
74
|
+
end
|
75
|
+
|
76
|
+
if [@options.shared_credentials_path, @options.profile].any?
|
77
|
+
credentials = Aws::SharedCredentials.new path: @options.shared_credentials_path, profile_name: @options.profile
|
78
|
+
@aws_configuration.update credentials: credentials
|
79
|
+
end
|
80
|
+
|
81
|
+
@aws_configuration
|
65
82
|
end
|
66
83
|
end
|
67
84
|
end
|
data/lib/s3sizecalc/version.rb
CHANGED