aws_clim 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 464aaeca6985ddf65ea4a3c072f44aa7561b52e2815ef66d8eda598d2c455259
4
+ data.tar.gz: 38c760109126b5fa42ab730e2b9d770c66af761180a32366ca23a76ff76fc175
5
+ SHA512:
6
+ metadata.gz: 4f8b84374a0b5997ca009752cc4cad9308769e4ec4b37f782487e11e0fca612d0a31b2ad6417071aaef61cb77b85e71c481ee90e7f5b2fe850b696d4b0d2918c
7
+ data.tar.gz: 361d4105ef8ce85e168e996d506c13bff92b3db2f6f071a3201fc5bb82543e94a35c4d012c125523fb93a230a0d418c52c20bfa865ca81f3c09093aa85590e16
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.4
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at andrewaguiar6@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aws_clim.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aws_clim (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ aws_clim!
15
+
16
+ BUNDLED WITH
17
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Andrew S Aguiar
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,44 @@
1
+ # AwsClim
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/aws_clim`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'aws_clim'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install aws_clim
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
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/[USERNAME]/aws_clim. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/aws_clim/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+
42
+ ## Code of Conduct
43
+
44
+ Everyone interacting in the AwsClim project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/aws_clim/blob/master/CODE_OF_CONDUCT.md).
Binary file
data/aws_clim.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ require_relative 'lib/aws_clim/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "aws_clim"
5
+ spec.version = AwsClim::VERSION
6
+ spec.authors = ["Andrew S Aguiar"]
7
+ spec.email = ["andrewaguiar6@gmail.com"]
8
+
9
+ spec.summary = "A very light and flexible wrapper for aws cli"
10
+ spec.description = "wraps aws cli in a very small and flexible ruby class"
11
+ spec.homepage = "https://github.com/andrewaguiar/aws_clim"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+
27
+ spec.require_paths = ["lib"]
28
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aws_clim"
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(__FILE__)
@@ -0,0 +1,3 @@
1
+ module AwsClim
2
+ VERSION = "1.0.0"
3
+ end
data/lib/aws_clim.rb ADDED
@@ -0,0 +1,421 @@
1
+ require 'json'
2
+ require 'open3'
3
+
4
+ class AwsClim
5
+ def initialize(profile = 'default', global_options = {})
6
+ @profile = profile
7
+ @global_options = global_options
8
+ end
9
+
10
+ class SimpleResult
11
+ attr_reader :data
12
+
13
+ def initialize(data)
14
+ @data = data
15
+ end
16
+
17
+ def error?
18
+ false
19
+ end
20
+
21
+ def success?
22
+ true
23
+ end
24
+ end
25
+
26
+ class ItemsResult < SimpleResult
27
+ include Enumerable
28
+
29
+ attr_reader :data, :items
30
+
31
+ def initialize(data)
32
+ super
33
+ @items = data['items']
34
+ end
35
+
36
+ def each(&block)
37
+ @data.fetch('items').each(&block)
38
+ end
39
+ end
40
+
41
+ class ErrorResult
42
+ attr_reader :message
43
+
44
+ def initialize(message)
45
+ @message = message
46
+ end
47
+
48
+ def to_s
49
+ "Error: #{@message}"
50
+ end
51
+
52
+ def success?
53
+ false
54
+ end
55
+
56
+ def error?
57
+ true
58
+ end
59
+ end
60
+
61
+ %w(
62
+ accessanalyzer
63
+ account
64
+ acm
65
+ acm-pca
66
+ alexaforbusiness
67
+ amp
68
+ amplify
69
+ amplifybackend
70
+ amplifyuibuilder
71
+ apigateway
72
+ apigatewaymanagementapi
73
+ apigatewayv2
74
+ appconfig
75
+ appconfigdata
76
+ appflow
77
+ appintegrations
78
+ application-autoscaling
79
+ application-insights
80
+ applicationcostprofiler
81
+ appmesh
82
+ apprunner
83
+ appstream
84
+ appsync
85
+ athena
86
+ auditmanager
87
+ autoscaling
88
+ autoscaling-plans
89
+ backup
90
+ backup-gateway
91
+ backupstorage
92
+ batch
93
+ billingconductor
94
+ braket
95
+ budgets
96
+ ce
97
+ chime
98
+ chime-sdk-identity
99
+ chime-sdk-media-pipelines
100
+ chime-sdk-meetings
101
+ chime-sdk-messaging
102
+ cloud9
103
+ cloudcontrol
104
+ clouddirectory
105
+ cloudformation
106
+ cloudfront
107
+ cloudhsm
108
+ cloudhsmv2
109
+ cloudsearch
110
+ cloudsearchdomain
111
+ cloudtrail
112
+ cloudwatch
113
+ codeartifact
114
+ codebuild
115
+ codecommit
116
+ codeguru-reviewer
117
+ codeguruprofiler
118
+ codepipeline
119
+ codestar
120
+ codestar-connections
121
+ codestar-notifications
122
+ cognito-identity
123
+ cognito-idp
124
+ cognito-sync
125
+ comprehend
126
+ comprehendmedical
127
+ compute-optimizer
128
+ configservice
129
+ configure
130
+ connect
131
+ connect-contact-lens
132
+ connectcampaigns
133
+ connectparticipant
134
+ controltower
135
+ cur
136
+ customer-profiles
137
+ databrew
138
+ dataexchange
139
+ datapipeline
140
+ datasync
141
+ dax
142
+ deploy
143
+ detective
144
+ devicefarm
145
+ devops-guru
146
+ directconnect
147
+ discovery
148
+ dlm
149
+ dms
150
+ docdb
151
+ drs
152
+ ds
153
+ dynamodb
154
+ dynamodbstreams
155
+ ebs
156
+ ec2
157
+ ec2-instance-connect
158
+ ecr
159
+ ecr-public
160
+ ecs
161
+ efs
162
+ eks
163
+ elastic-inference
164
+ elasticache
165
+ elasticbeanstalk
166
+ elastictranscoder
167
+ elb
168
+ elbv2
169
+ emr
170
+ emr-containers
171
+ emr-serverless
172
+ es
173
+ events
174
+ evidently
175
+ finspace
176
+ finspace-data
177
+ firehose
178
+ fis
179
+ fms
180
+ forecast
181
+ forecastquery
182
+ frauddetector
183
+ fsx
184
+ gamelift
185
+ gamesparks
186
+ glacier
187
+ globalaccelerator
188
+ glue
189
+ grafana
190
+ greengrass
191
+ greengrassv2
192
+ groundstation
193
+ guardduty
194
+ health
195
+ healthlake
196
+ history
197
+ honeycode
198
+ iam
199
+ identitystore
200
+ imagebuilder
201
+ importexport
202
+ inspector
203
+ inspector2
204
+ iot
205
+ iot-data
206
+ iot-jobs-data
207
+ iot1click-devices
208
+ iot1click-projects
209
+ iotanalytics
210
+ iotdeviceadvisor
211
+ iotevents
212
+ iotevents-data
213
+ iotfleethub
214
+ iotsecuretunneling
215
+ iotsitewise
216
+ iotthingsgraph
217
+ iottwinmaker
218
+ iotwireless
219
+ ivs
220
+ ivschat
221
+ kafka
222
+ kafkaconnect
223
+ kendra
224
+ keyspaces
225
+ kinesis
226
+ kinesis-video-archived-media
227
+ kinesis-video-media
228
+ kinesis-video-signaling
229
+ kinesisanalytics
230
+ kinesisanalyticsv2
231
+ kinesisvideo
232
+ kms
233
+ lakeformation
234
+ lambda
235
+ lex-models
236
+ lex-runtime
237
+ lexv2-models
238
+ lexv2-runtime
239
+ license-manager
240
+ license-manager-user-subscriptions
241
+ lightsail
242
+ location
243
+ logs
244
+ lookoutequipment
245
+ lookoutmetrics
246
+ lookoutvision
247
+ m2
248
+ machinelearning
249
+ macie
250
+ macie2
251
+ managedblockchain
252
+ marketplace-catalog
253
+ marketplace-entitlement
254
+ marketplacecommerceanalytics
255
+ mediaconnect
256
+ mediaconvert
257
+ medialive
258
+ mediapackage
259
+ mediapackage-vod
260
+ mediastore
261
+ mediastore-data
262
+ mediatailor
263
+ memorydb
264
+ meteringmarketplace
265
+ mgh
266
+ mgn
267
+ migration-hub-refactor-spaces
268
+ migrationhub-config
269
+ migrationhubstrategy
270
+ mobile
271
+ mq
272
+ mturk
273
+ mwaa
274
+ neptune
275
+ network-firewall
276
+ networkmanager
277
+ nimble
278
+ opensearch
279
+ opsworks
280
+ opsworks-cm
281
+ organizations
282
+ outposts
283
+ panorama
284
+ personalize
285
+ personalize-events
286
+ personalize-runtime
287
+ pi
288
+ pinpoint
289
+ pinpoint-email
290
+ pinpoint-sms-voice
291
+ pinpoint-sms-voice-v2
292
+ polly
293
+ pricing
294
+ privatenetworks
295
+ proton
296
+ qldb
297
+ qldb-session
298
+ quicksight
299
+ ram
300
+ rbin
301
+ rds
302
+ rds-data
303
+ redshift
304
+ redshift-data
305
+ redshift-serverless
306
+ rekognition
307
+ resiliencehub
308
+ resource-groups
309
+ resourcegroupstaggingapi
310
+ robomaker
311
+ rolesanywhere
312
+ route53
313
+ route53-recovery-cluster
314
+ route53-recovery-control-config
315
+ route53-recovery-readiness
316
+ route53domains
317
+ route53resolver
318
+ rum
319
+ s3
320
+ s3api
321
+ s3control
322
+ s3outposts
323
+ sagemaker
324
+ sagemaker-a2i-runtime
325
+ sagemaker-edge
326
+ sagemaker-featurestore-runtime
327
+ sagemaker-runtime
328
+ savingsplans
329
+ schemas
330
+ sdb
331
+ secretsmanager
332
+ securityhub
333
+ serverlessrepo
334
+ service-quotas
335
+ servicecatalog
336
+ servicecatalog-appregistry
337
+ servicediscovery
338
+ ses
339
+ sesv2
340
+ shield
341
+ signer
342
+ sms
343
+ snow-device-management
344
+ snowball
345
+ sns
346
+ sqs
347
+ ssm
348
+ ssm-contacts
349
+ ssm-incidents
350
+ sso
351
+ sso-admin
352
+ sso-oidc
353
+ stepfunctions
354
+ storagegateway
355
+ sts
356
+ support
357
+ support-app
358
+ swf
359
+ synthetics
360
+ textract
361
+ timestream-query
362
+ timestream-write
363
+ transcribe
364
+ transfer
365
+ translate
366
+ voice-id
367
+ waf
368
+ waf-regional
369
+ wafv2
370
+ wellarchitected
371
+ wisdom
372
+ workdocs
373
+ worklink
374
+ workmail
375
+ workmailmessageflow
376
+ workspaces
377
+ workspaces-web
378
+ xray
379
+ ).each do |service_name|
380
+ define_method service_name do |*ps|
381
+ execute(service_name, ps)
382
+ end
383
+ end
384
+
385
+ def execute(service, options)
386
+ cmd = "aws #{service} #{format_options(options)} --profile=#{@profile} #{format_options(@global_options)}"
387
+
388
+ out, err, status = Open3.capture3(cmd)
389
+
390
+ if status.success?
391
+ result = JSON.parse(out)
392
+ result.key?('items') ? ItemsResult.new(result) : SimpleResult.new(result)
393
+ else
394
+ ErrorResult.new(err)
395
+ end
396
+ end
397
+
398
+ private
399
+
400
+ def format_options(options)
401
+ return '' if options.nil?
402
+
403
+ if options.is_a?(Array)
404
+ options.map { |option|
405
+ format_option(option)
406
+ }.join(' ')
407
+ elsif options.is_a?(String)
408
+ "#{option}"
409
+ end
410
+ end
411
+
412
+ def format_option(option)
413
+ if option.is_a?(Array)
414
+ "--#{option[0]}=\"#{option[1]}\""
415
+ elsif option.is_a?(Hash)
416
+ format_options(option.to_a)
417
+ else
418
+ "#{option}"
419
+ end
420
+ end
421
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws_clim
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew S Aguiar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: wraps aws cli in a very small and flexible ruby class
14
+ email:
15
+ - andrewaguiar6@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".travis.yml"
22
+ - CODE_OF_CONDUCT.md
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - LICENSE.txt
26
+ - README.md
27
+ - aws_clim-0.1.0.gem
28
+ - aws_clim.gemspec
29
+ - bin/console
30
+ - lib/aws_clim.rb
31
+ - lib/aws_clim/version.rb
32
+ homepage: https://github.com/andrewaguiar/aws_clim
33
+ licenses:
34
+ - MIT
35
+ metadata:
36
+ homepage_uri: https://github.com/andrewaguiar/aws_clim
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.1.6
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: A very light and flexible wrapper for aws cli
56
+ test_files: []