awsclient 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/awsclient.gemspec +35 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/awsclient.rb +543 -0
- data/lib/awsclient/version.rb +3 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 140edab8dbc431d146d87d2009bd234f824e90d5
|
4
|
+
data.tar.gz: 3335b92142e7289551cddc2c652e732f18542a86
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38ef292bb764362134302ebafacf50bc762e140e500cee09ee23b3d4b11072b89137bdf8c3fcb650280a5705caeb30d4a090bdac8b5f84bdbd055881725e91e4
|
7
|
+
data.tar.gz: a92e392b546952b01e72dba7540d91f580d9d45640de92e6bffec632e4b8f9528748d42ecd13fc2f209a71d06e3d6a9a4b2dd6b5d647525cf59b6a4607500154
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Jeremy Hahn
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Awsclient
|
2
|
+
|
3
|
+
This Ruby gem provides a library of AWS API client objects that work using credential files, instance roles, or assumed roles.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'awsclient'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install awsclient
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Require the library in your project.
|
24
|
+
|
25
|
+
require 'awsclient'
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jeremyhahn/awsclient.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/awsclient.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'awsclient/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "awsclient"
|
8
|
+
spec.version = Awsclient::VERSION
|
9
|
+
spec.authors = ["Jeremy Hahn"]
|
10
|
+
spec.email = ["mail@jeremyhahn.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Provides a full featured AWS client library with dynamic credential loading.}
|
13
|
+
spec.description = %q{Provides a set of AWS API client objects that can be instantiated using credential files / profiles, instance roles, or assumed roles. }
|
14
|
+
spec.homepage = "https://github.com/jeremyhahn/awsclient"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'aws-sdk', '~> 2'
|
35
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "awsclient"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/awsclient.rb
ADDED
@@ -0,0 +1,543 @@
|
|
1
|
+
require "awsclient/version"
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
module Awsclient
|
5
|
+
|
6
|
+
class Connection
|
7
|
+
|
8
|
+
attr_accessor :credentials
|
9
|
+
attr_accessor :region
|
10
|
+
|
11
|
+
SERVICES = [
|
12
|
+
:acm, :apigateway, :autoscaling, :cloudformation, :cloudfront, :cloudhsm,
|
13
|
+
:cloudsearch, :cloudtrail, :cloudwatch, :cloudwatchevents, :cloudwatchlogs,
|
14
|
+
:codecommit, :codedeploy, :codepipeline, :cognitoidentity, :cognitosync, :configservice,
|
15
|
+
:datapipeline, :databasemigrationservice, :devicefarm, :directconnect, :directoryservice,
|
16
|
+
:dynamodb, :dynamodbstreams, :ec2, :ecr, :ecs, :efs, :emr, :elasticache, :elasticbeanstalk,
|
17
|
+
:elasticloadbalancing, :elastictranscoder, :elasticsearchservice, :firehose, :gamelift, :glacier,
|
18
|
+
:iam, :importexport, :inspector, :iot, :iotdataplane, :kms, :kinesis, :lambda, :lambdapreview,
|
19
|
+
:machinelearning, :marketplacecommerceanalysis, :opsworks, :rds, :redshift, :route53, :route53domains,
|
20
|
+
:s3, :ses, :sns, :sqs, :ssm, :sts, :swf, :simpledb, :storagegateway, :support, :waf, :workspaces
|
21
|
+
]
|
22
|
+
|
23
|
+
SERVICES.each do |svc|
|
24
|
+
attr_accessor svc
|
25
|
+
end
|
26
|
+
|
27
|
+
def credentials
|
28
|
+
unless @credentials
|
29
|
+
self.credentials = load_credentials
|
30
|
+
end
|
31
|
+
@credentials
|
32
|
+
end
|
33
|
+
|
34
|
+
def credentials=(credentials)
|
35
|
+
@credentials = credentials
|
36
|
+
reload
|
37
|
+
end
|
38
|
+
|
39
|
+
def load_credentials(profile_name='default')
|
40
|
+
creds = ::Aws::SharedCredentials.new(profile_name: profile_name)
|
41
|
+
return creds if creds.set?
|
42
|
+
instance_profile_credentials
|
43
|
+
end
|
44
|
+
|
45
|
+
def instance_profile_credentials
|
46
|
+
::Aws::InstanceProfileCredentials.new
|
47
|
+
end
|
48
|
+
|
49
|
+
def assume_role!(role_name, duration_seconds = 3600)
|
50
|
+
role_arn = "arn:aws:iam::#{account_id}:role/#{role_name}"
|
51
|
+
self.credentials = ::Aws::AssumeRoleCredentials.new(
|
52
|
+
client: sts,
|
53
|
+
role_arn: role_arn,
|
54
|
+
role_session_name: random_string(32),
|
55
|
+
duration_seconds: duration_seconds
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
def role=(role_name)
|
60
|
+
assume_role!(role_name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def profile?
|
64
|
+
credentials.respond_to?(:profile_name)
|
65
|
+
end
|
66
|
+
|
67
|
+
def profile
|
68
|
+
credentials.profile_name
|
69
|
+
end
|
70
|
+
|
71
|
+
def profile=(profile_name)
|
72
|
+
self.credentials = ::Aws::SharedCredentials.new(profile_name: profile_name)
|
73
|
+
end
|
74
|
+
|
75
|
+
def region
|
76
|
+
@region ||= 'us-east-1'
|
77
|
+
end
|
78
|
+
|
79
|
+
def underscored_region
|
80
|
+
region.gsub('-', '_')
|
81
|
+
end
|
82
|
+
|
83
|
+
def account_id
|
84
|
+
iam.get_user.user.arn.split(':')[4]
|
85
|
+
end
|
86
|
+
|
87
|
+
def acm(options = {})
|
88
|
+
@acm ||= ::Aws::ACM::Client.new(
|
89
|
+
credentials: credentials,
|
90
|
+
region: region
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
def apigateway(options = {})
|
95
|
+
@apigateway ||= ::Aws::APIGateway::Client.new({
|
96
|
+
credentials: credentials,
|
97
|
+
region: region
|
98
|
+
}.merge(options))
|
99
|
+
end
|
100
|
+
|
101
|
+
def autoscaling(options = {})
|
102
|
+
@autoscaling ||= ::Aws::AutoScaling::Client.new({
|
103
|
+
credentials: credentials,
|
104
|
+
region: region
|
105
|
+
}.merge(options))
|
106
|
+
end
|
107
|
+
|
108
|
+
def cloudformation(options = {})
|
109
|
+
@cloudformation ||= ::Aws::CloudFormation::Client.new({
|
110
|
+
credentials: credentials,
|
111
|
+
region: region
|
112
|
+
}.merge(options))
|
113
|
+
end
|
114
|
+
|
115
|
+
def cloudfront(options = {})
|
116
|
+
@cloudformation ||= ::Aws::CloudFront::Client.new({
|
117
|
+
credentials: credentials,
|
118
|
+
region: region
|
119
|
+
}.merge(options))
|
120
|
+
end
|
121
|
+
|
122
|
+
def cloudhsm(options = {})
|
123
|
+
@cloudformation ||= ::Aws::CloudHSM::Client.new({
|
124
|
+
credentials: credentials,
|
125
|
+
region: region
|
126
|
+
}.merge(options))
|
127
|
+
end
|
128
|
+
|
129
|
+
def cloudsearch(options = {})
|
130
|
+
@cloudformation ||= ::Aws::CloudSearch::Client.new({
|
131
|
+
credentials: credentials,
|
132
|
+
region: region
|
133
|
+
}.merge(options))
|
134
|
+
end
|
135
|
+
|
136
|
+
def cloudtrail(options = {})
|
137
|
+
@cloudtrail ||= ::Aws::CloudTrail::Client.new({
|
138
|
+
credentials: credentials,
|
139
|
+
region: region
|
140
|
+
}.merge(options))
|
141
|
+
end
|
142
|
+
|
143
|
+
def cloudwatch(options = {})
|
144
|
+
@cloudwatch ||= ::Aws::CloudWatch::Client.new({
|
145
|
+
credentials: credentials,
|
146
|
+
region: region
|
147
|
+
}.merge(options))
|
148
|
+
end
|
149
|
+
|
150
|
+
def cloudwatchevents(options = {})
|
151
|
+
@cloudwatchevents ||= ::Aws::CloudWatchEvents::Client.new({
|
152
|
+
credentials: credentials,
|
153
|
+
region: region
|
154
|
+
}.merge(options))
|
155
|
+
end
|
156
|
+
|
157
|
+
def cloudwatchlogs(options = {})
|
158
|
+
@cloudwatchlogs ||= ::Aws::CloudWatchLogs::Client.new({
|
159
|
+
credentials: credentials,
|
160
|
+
region: region
|
161
|
+
}.merge(options))
|
162
|
+
end
|
163
|
+
|
164
|
+
def codecommit(options = {})
|
165
|
+
@codecommit ||= ::Aws::CodeCommit::Client.new({
|
166
|
+
credentials: credentials,
|
167
|
+
region: region
|
168
|
+
}.merge(options))
|
169
|
+
end
|
170
|
+
|
171
|
+
def codedeploy(options = {})
|
172
|
+
@codedeploy ||= ::Aws::CodeDeploy::Client.new({
|
173
|
+
credentials: credentials,
|
174
|
+
region: region
|
175
|
+
}.merge(options))
|
176
|
+
end
|
177
|
+
|
178
|
+
def codepipeline(options = {})
|
179
|
+
@codepipeline ||= ::Aws::CodePipeline::Client.new({
|
180
|
+
credentials: credentials,
|
181
|
+
region: region
|
182
|
+
}.merge(options))
|
183
|
+
end
|
184
|
+
|
185
|
+
def cognitoidentity(options = {})
|
186
|
+
@cognitoidentity ||= ::Aws::CognitoIdentity::Client.new({
|
187
|
+
credentials: credentials,
|
188
|
+
region: region
|
189
|
+
}.merge(options))
|
190
|
+
end
|
191
|
+
|
192
|
+
def cognitosync(options = {})
|
193
|
+
@cognitosync ||= ::Aws::CognitoSync::Client.new({
|
194
|
+
credentials: credentials,
|
195
|
+
region: region
|
196
|
+
}.merge(options))
|
197
|
+
end
|
198
|
+
|
199
|
+
def configservice(options = {})
|
200
|
+
@codedeploy ||= ::Aws::ConfigService::Client.new({
|
201
|
+
credentials: credentials,
|
202
|
+
region: region
|
203
|
+
}.merge(options))
|
204
|
+
end
|
205
|
+
|
206
|
+
def datapipeline(options = {})
|
207
|
+
@datapipeline ||= ::Aws::DataPipeline::Client.new({
|
208
|
+
credentials: credentials,
|
209
|
+
region: region
|
210
|
+
}.merge(options))
|
211
|
+
end
|
212
|
+
|
213
|
+
def databasemigrationservice(options = {})
|
214
|
+
@databasemigrationservice ||= ::Aws::DatabaseMigrationService::Client.new({
|
215
|
+
credentials: credentials,
|
216
|
+
region: region
|
217
|
+
}.merge(options))
|
218
|
+
end
|
219
|
+
|
220
|
+
def devicefarm(options = {})
|
221
|
+
@devicefarm ||= ::Aws::DeviceFarm::Client.new({
|
222
|
+
credentials: credentials,
|
223
|
+
region: region
|
224
|
+
}.merge(options))
|
225
|
+
end
|
226
|
+
|
227
|
+
def directconnect(options = {})
|
228
|
+
@directconnect ||= ::Aws::DirectConnect::Client.new({
|
229
|
+
credentials: credentials,
|
230
|
+
region: region
|
231
|
+
}.merge(options))
|
232
|
+
end
|
233
|
+
|
234
|
+
def directoryservice(options = {})
|
235
|
+
@directoryservice ||= ::Aws::DirectoryService::Client.new({
|
236
|
+
credentials: credentials,
|
237
|
+
region: region
|
238
|
+
}.merge(options))
|
239
|
+
end
|
240
|
+
|
241
|
+
def dynamodb(options = {})
|
242
|
+
@dynamodb ||= ::Aws::DynamoDB::Client.new({
|
243
|
+
credentials: credentials,
|
244
|
+
region: region
|
245
|
+
}.merge(options))
|
246
|
+
end
|
247
|
+
|
248
|
+
def dynamodbstreams(options = {})
|
249
|
+
@dynamodbstreams ||= ::Aws::DynamoDBStreams::Client.new({
|
250
|
+
credentials: credentials,
|
251
|
+
region: region
|
252
|
+
}.merge(options))
|
253
|
+
end
|
254
|
+
|
255
|
+
def ec2(options = {})
|
256
|
+
@ec2 ||= ::Aws::EC2::Client.new({
|
257
|
+
credentials: credentials,
|
258
|
+
region: region
|
259
|
+
}.merge(options))
|
260
|
+
end
|
261
|
+
|
262
|
+
def ecr(options = {})
|
263
|
+
@ecr ||= ::Aws::ECR::Client.new({
|
264
|
+
credentials: credentials,
|
265
|
+
region: region
|
266
|
+
}.merge(options))
|
267
|
+
end
|
268
|
+
|
269
|
+
def ecs(options = {})
|
270
|
+
@ecs ||= ::Aws::ECS::Client.new({
|
271
|
+
credentials: credentials,
|
272
|
+
region: region
|
273
|
+
}.merge(options))
|
274
|
+
end
|
275
|
+
|
276
|
+
def efs(options = {})
|
277
|
+
@efs ||= ::Aws::EFS::Client.new({
|
278
|
+
credentials: credentials,
|
279
|
+
region: region
|
280
|
+
}.merge(options))
|
281
|
+
end
|
282
|
+
|
283
|
+
def emr(options = {})
|
284
|
+
@emr ||= ::Aws::EMR::Client.new({
|
285
|
+
credentials: credentials,
|
286
|
+
region: region
|
287
|
+
}.merge(options))
|
288
|
+
end
|
289
|
+
|
290
|
+
def elasticbeanstalk(options = {})
|
291
|
+
@elasticbeanstalk ||= ::Aws::ElasticBeanstalk::Client.new({
|
292
|
+
credentials: credentials,
|
293
|
+
region: region
|
294
|
+
}.merge(options))
|
295
|
+
end
|
296
|
+
|
297
|
+
def elasticloadbalancing(options = {})
|
298
|
+
@elasticloadbalancing ||= ::Aws::ElasticLoadBalancing::Client.new({
|
299
|
+
credentials: credentials,
|
300
|
+
region: region
|
301
|
+
}.merge(options))
|
302
|
+
end
|
303
|
+
|
304
|
+
def elastictranscoder(options = {})
|
305
|
+
@elastictranscoder ||= ::Aws::ElasticTranscoder::Client.new({
|
306
|
+
credentials: credentials,
|
307
|
+
region: region
|
308
|
+
}.merge(options))
|
309
|
+
end
|
310
|
+
|
311
|
+
def elasticsearchservice(options = {})
|
312
|
+
@elasticsearchservice ||= ::Aws::ElasticsearchService::Client.new({
|
313
|
+
credentials: credentials,
|
314
|
+
region: region
|
315
|
+
}.merge(options))
|
316
|
+
end
|
317
|
+
|
318
|
+
def firehose(options = {})
|
319
|
+
@firehose ||= ::Aws::Firehose::Client.new({
|
320
|
+
credentials: credentials,
|
321
|
+
region: region
|
322
|
+
}.merge(options))
|
323
|
+
end
|
324
|
+
|
325
|
+
def gamelift(options = {})
|
326
|
+
@gamelift ||= ::Aws::GameLift::Client.new({
|
327
|
+
credentials: credentials,
|
328
|
+
region: region
|
329
|
+
}.merge(options))
|
330
|
+
end
|
331
|
+
|
332
|
+
def glacier(options = {})
|
333
|
+
@glacier ||= ::Aws::Glacier::Client.new({
|
334
|
+
credentials: credentials,
|
335
|
+
region: region
|
336
|
+
}.merge(options))
|
337
|
+
end
|
338
|
+
|
339
|
+
def iam(options = {})
|
340
|
+
@iam ||= ::Aws::IAM::Client.new({
|
341
|
+
credentials: credentials,
|
342
|
+
region: region
|
343
|
+
}.merge(options))
|
344
|
+
end
|
345
|
+
|
346
|
+
def importexport(options = {})
|
347
|
+
@importexport ||= ::Aws::ImportExport::Client.new({
|
348
|
+
credentials: credentials,
|
349
|
+
region: region
|
350
|
+
}.merge(options))
|
351
|
+
end
|
352
|
+
|
353
|
+
def inspector(options = {})
|
354
|
+
@importexport ||= ::Aws::Inspector::Client.new({
|
355
|
+
credentials: credentials,
|
356
|
+
region: region
|
357
|
+
}.merge(options))
|
358
|
+
end
|
359
|
+
|
360
|
+
def iot(options = {})
|
361
|
+
@iot ||= ::Aws::IoT::Client.new({
|
362
|
+
credentials: credentials,
|
363
|
+
region: region
|
364
|
+
}.merge(options))
|
365
|
+
end
|
366
|
+
|
367
|
+
def iotdataplane(options = {})
|
368
|
+
@iotdataplane ||= ::Aws::IoTDataPlane::Client.new({
|
369
|
+
credentials: credentials,
|
370
|
+
region: region
|
371
|
+
}.merge(options))
|
372
|
+
end
|
373
|
+
|
374
|
+
def kms(options = {})
|
375
|
+
@kms ||= ::Aws::KMS::Client.new({
|
376
|
+
credentials: credentials,
|
377
|
+
region: region
|
378
|
+
}.merge(options))
|
379
|
+
end
|
380
|
+
|
381
|
+
def kinesis(options = {})
|
382
|
+
@kinesis ||= ::Aws::Kinesis::Client.new({
|
383
|
+
credentials: credentials,
|
384
|
+
region: region
|
385
|
+
}.merge(options))
|
386
|
+
end
|
387
|
+
|
388
|
+
def lambda(options = {})
|
389
|
+
@lambda ||= ::Aws::Lambda::Client.new({
|
390
|
+
credentials: credentials,
|
391
|
+
region: region
|
392
|
+
}.merge(options))
|
393
|
+
end
|
394
|
+
|
395
|
+
def lambdapreview(options = {})
|
396
|
+
@lambdapreview ||= ::Aws::LambdaPreview::Client.new({
|
397
|
+
credentials: credentials,
|
398
|
+
region: region
|
399
|
+
}.merge(options))
|
400
|
+
end
|
401
|
+
|
402
|
+
def machinelearning(options = {})
|
403
|
+
@machinelearning ||= ::Aws::MachineLearning::Client.new({
|
404
|
+
credentials: credentials,
|
405
|
+
region: region
|
406
|
+
}.merge(options))
|
407
|
+
end
|
408
|
+
|
409
|
+
def marketplacecommerceanalytics(options = {})
|
410
|
+
@marketplacecommerceanalytics ||= ::Aws::MarketplaceCommerceAnalytics::Client.new({
|
411
|
+
credentials: credentials,
|
412
|
+
region: region
|
413
|
+
}.merge(options))
|
414
|
+
end
|
415
|
+
|
416
|
+
def rds(options = {})
|
417
|
+
@rds ||= ::Aws::RDS::Client.new({
|
418
|
+
credentials: credentials,
|
419
|
+
region: region
|
420
|
+
}.merge(options))
|
421
|
+
end
|
422
|
+
|
423
|
+
def route53(options = {})
|
424
|
+
@route53 ||= ::Aws::Route53::Client.new({
|
425
|
+
credentials: credentials,
|
426
|
+
region: region
|
427
|
+
}.merge(options))
|
428
|
+
end
|
429
|
+
|
430
|
+
def route53domains(options = {})
|
431
|
+
@route53domains ||= ::Aws::Route53Domains::Client.new({
|
432
|
+
credentials: credentials,
|
433
|
+
region: region
|
434
|
+
}.merge(options))
|
435
|
+
end
|
436
|
+
|
437
|
+
def s3(options = {})
|
438
|
+
@s3 ||= ::Aws::S3::Client.new({
|
439
|
+
credentials: credentials,
|
440
|
+
region: region
|
441
|
+
}.merge(options))
|
442
|
+
end
|
443
|
+
|
444
|
+
def s3_bucket(name, options = {})
|
445
|
+
@bucket ||= ::Aws::S3::Bucket.new(name, {
|
446
|
+
credentials: credentials,
|
447
|
+
region: region
|
448
|
+
}.merge(options))
|
449
|
+
end
|
450
|
+
|
451
|
+
def ses(options = {})
|
452
|
+
@ses ||= ::Aws::SES::Client.new({
|
453
|
+
credentials: credentials,
|
454
|
+
region: region
|
455
|
+
}.merge(options))
|
456
|
+
end
|
457
|
+
|
458
|
+
def sns(options = {})
|
459
|
+
@sns ||= ::Aws::SNS::Client.new({
|
460
|
+
credentials: credentials,
|
461
|
+
region: region
|
462
|
+
}.merge(options))
|
463
|
+
end
|
464
|
+
|
465
|
+
def sqs(options = {})
|
466
|
+
@sqs ||= ::Aws::SQS::Client.new({
|
467
|
+
credentials: credentials,
|
468
|
+
region: region
|
469
|
+
}.merge(options))
|
470
|
+
end
|
471
|
+
|
472
|
+
def ssm(options = {})
|
473
|
+
@ssm ||= ::Aws::SSM::Client.new({
|
474
|
+
credentials: credentials,
|
475
|
+
region: region
|
476
|
+
}.merge(options))
|
477
|
+
end
|
478
|
+
|
479
|
+
def sts(options = {})
|
480
|
+
@sts ||= ::Aws::STS::Client.new({
|
481
|
+
credentials: credentials,
|
482
|
+
region: region
|
483
|
+
}.merge(options))
|
484
|
+
end
|
485
|
+
|
486
|
+
def swf(options = {})
|
487
|
+
@swf ||= ::Aws::SWF::Client.new({
|
488
|
+
credentials: credentials,
|
489
|
+
region: region
|
490
|
+
}.merge(options))
|
491
|
+
end
|
492
|
+
|
493
|
+
def simpledb(options = {})
|
494
|
+
@simpledb ||= ::Aws::SimpleDB::Client.new({
|
495
|
+
credentials: credentials,
|
496
|
+
region: region
|
497
|
+
}.merge(options))
|
498
|
+
end
|
499
|
+
|
500
|
+
def storagegateway(options = {})
|
501
|
+
@storagegateway ||= ::Aws::StorageGateway::Client.new({
|
502
|
+
credentials: credentials,
|
503
|
+
region: region
|
504
|
+
}.merge(options))
|
505
|
+
end
|
506
|
+
|
507
|
+
def support(options = {})
|
508
|
+
@support ||= ::Aws::Support::Client.new({
|
509
|
+
credentials: credentials,
|
510
|
+
region: region
|
511
|
+
}.merge(options))
|
512
|
+
end
|
513
|
+
|
514
|
+
def waf(options = {})
|
515
|
+
@waf ||= ::Aws::WAF::Client.new({
|
516
|
+
credentials: credentials,
|
517
|
+
region: region
|
518
|
+
}.merge(options))
|
519
|
+
end
|
520
|
+
|
521
|
+
def workspaces(options = {})
|
522
|
+
@workspaces ||= ::Aws::WorkSpaces::Client.new({
|
523
|
+
credentials: credentials,
|
524
|
+
region: region
|
525
|
+
}.merge(options))
|
526
|
+
end
|
527
|
+
|
528
|
+
private
|
529
|
+
|
530
|
+
def reload
|
531
|
+
SERVICES.each do |svc|
|
532
|
+
send("#{svc}=".to_sym, nil)
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
def random_string(length = nil)
|
537
|
+
length = rand(15..30)
|
538
|
+
o = [('a'..'z'), ('A'..'Z'), (1..9)].map { |i| i.to_a }.flatten
|
539
|
+
(0...length).map { o[rand(o.length)] }.join
|
540
|
+
end
|
541
|
+
|
542
|
+
end
|
543
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: awsclient
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremy Hahn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-sdk
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2'
|
69
|
+
description: 'Provides a set of AWS API client objects that can be instantiated using
|
70
|
+
credential files / profiles, instance roles, or assumed roles. '
|
71
|
+
email:
|
72
|
+
- mail@jeremyhahn.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- awsclient.gemspec
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/awsclient.rb
|
88
|
+
- lib/awsclient/version.rb
|
89
|
+
homepage: https://github.com/jeremyhahn/awsclient
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata:
|
93
|
+
allowed_push_host: https://rubygems.org
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.8
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Provides a full featured AWS client library with dynamic credential loading.
|
114
|
+
test_files: []
|