swa 0.7.7 → 0.8.0

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
  SHA256:
3
- metadata.gz: 6d195d1632c4f915a413f9a7b4f40127eff5497a45b6217159147a392ec4089d
4
- data.tar.gz: 40720608d5be447d93641459922835fa71d4b698c9d1270eb25d8322db9c87fa
3
+ metadata.gz: 36e1c1b0403a6cdb2a09bce49b2cc378f6b67f8abfbded1d6baf41d46e70504e
4
+ data.tar.gz: 91755af27947ed3028f7da36e44e1e2a53ed0555ce99a0107a557ee4767e6632
5
5
  SHA512:
6
- metadata.gz: 0a7a37485d2d422b1cf1625f8359ea33a798b450d55c2c4b539995ce302f305340a6893344db6de7c5a8ffcf26224d30b468fe92a7fc7a3638e55f9f476877b4
7
- data.tar.gz: 157497f4a9da0f7361a2db3435855cdd40ed9aed25c2cae91f9648c34c3bb4577dcb745bce30b3f9c3410fa06efe81d44126540f8de85b1ab1653dd080302802
6
+ metadata.gz: 2c93335b35ff3b0e070847deee928481a77634d295dfe2e2240308fec7c8f776cfa8f6ab9658bfface70dfcb124f7b10ec55ae75c5375be98ce0161b3f8d1b1e
7
+ data.tar.gz: 1e64bf3fe18ba6398dc7d3af897a0223099b85a7112464a112a662d2caa763d35aa14c05d19de042ccdd35b36d4b78707938c720d8c5066504ca94c99fa21f57
@@ -0,0 +1,69 @@
1
+ require "aws-sdk-lakeformation"
2
+ require "swa/cli/base_command"
3
+ require "swa/cli/collection_behaviour"
4
+ require "swa/cli/item_behaviour"
5
+ require "swa/lake_formation/resource_info"
6
+
7
+ module Swa
8
+ module CLI
9
+
10
+ class LakeFormationCommand < BaseCommand
11
+
12
+ subcommand ["permissions"], "Show permissions" do
13
+
14
+ self.description = <<-EOF
15
+ List permissions.
16
+ EOF
17
+
18
+ include CollectionBehaviour
19
+
20
+ private
21
+
22
+ def collection
23
+ query_for(:list_permissions, :principal_resource_permissions, Swa::LakeFormation::Permission)
24
+ end
25
+
26
+ end
27
+
28
+ protected
29
+
30
+ def lf_client
31
+ ::Aws::LakeFormation::Client.new(aws_config)
32
+ end
33
+
34
+ def query_for(query_method, response_key, model)
35
+ records = lf_client.public_send(query_method).public_send(response_key)
36
+ model.list(records)
37
+ end
38
+
39
+ subcommand ["resources"], "Show resources" do
40
+
41
+ self.description = <<-EOF
42
+ List resources.
43
+ EOF
44
+
45
+ include CollectionBehaviour
46
+
47
+ private
48
+
49
+ def collection
50
+ query_for(:list_resources, :resource_info_list, Swa::LakeFormation::ResourceInfo)
51
+ end
52
+
53
+ end
54
+
55
+ protected
56
+
57
+ def lf_client
58
+ ::Aws::LakeFormation::Client.new(aws_config)
59
+ end
60
+
61
+ def query_for(query_method, response_key, model)
62
+ records = lf_client.public_send(query_method).public_send(response_key)
63
+ model.list(records)
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+ end
@@ -6,6 +6,7 @@ require "swa/cli/elb_command"
6
6
  require "swa/cli/glue_command"
7
7
  require "swa/cli/iam_command"
8
8
  require "swa/cli/kms_command"
9
+ require "swa/cli/lake_formation_command"
9
10
  require "swa/cli/s3_command"
10
11
 
11
12
  module Swa
@@ -20,6 +21,7 @@ module Swa
20
21
  subcommand "glue", "Glue stuff", GlueCommand
21
22
  subcommand "iam", "IAM stuff", IamCommand
22
23
  subcommand "kms", "KMS stuff", KmsCommand
24
+ subcommand ["lf", "lakeformation"], "LakeFormation stuff", LakeFormationCommand
23
25
  subcommand "s3", "S3 stuff", S3Command
24
26
 
25
27
  protected
@@ -0,0 +1,32 @@
1
+ require "swa/record"
2
+
3
+ module Swa
4
+ module LakeFormation
5
+
6
+ class Permission < Record
7
+
8
+ def summary
9
+ [
10
+ principal_id,
11
+ permissions.join(","),
12
+ resource_summary
13
+ ].join(" ")
14
+ end
15
+
16
+ delegate :permissions
17
+ delegate :principal
18
+
19
+ def principal_id
20
+ aws_record.principal.data_lake_principal_identifier
21
+ end
22
+
23
+ def resource_summary
24
+ h = aws_record.resource.to_hash.compact
25
+ type, details = h.first
26
+ "#{type}:#{details.values.join("/")}"
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ require "swa/record"
2
+
3
+ module Swa
4
+ module LakeFormation
5
+
6
+ class ResourceInfo < Record
7
+
8
+ def summary
9
+ [
10
+ resource_arn,
11
+ role_arn
12
+ ].join(" ")
13
+ end
14
+
15
+ delegate :resource_arn
16
+ delegate :role_arn
17
+
18
+ end
19
+
20
+ end
21
+ end
data/lib/swa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Swa
2
- VERSION = "0.7.7"
2
+ VERSION = "0.8.0"
3
3
  end
data/swa.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency "aws-sdk-glue", "~> 1"
31
31
  spec.add_runtime_dependency "aws-sdk-iam", "~> 1"
32
32
  spec.add_runtime_dependency "aws-sdk-kms", "~> 1"
33
+ spec.add_runtime_dependency "aws-sdk-lakeformation", "~> 1"
33
34
  spec.add_runtime_dependency "aws-sdk-s3", "~> 1"
34
35
  spec.add_runtime_dependency "pry"
35
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-22 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: aws-sdk-lakeformation
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: aws-sdk-s3
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -282,6 +296,7 @@ files:
282
296
  - lib/swa/cli/iam_command.rb
283
297
  - lib/swa/cli/item_behaviour.rb
284
298
  - lib/swa/cli/kms_command.rb
299
+ - lib/swa/cli/lake_formation_command.rb
285
300
  - lib/swa/cli/main_command.rb
286
301
  - lib/swa/cli/s3_command.rb
287
302
  - lib/swa/cli/selector.rb
@@ -315,6 +330,8 @@ files:
315
330
  - lib/swa/iam/user.rb
316
331
  - lib/swa/kms/alias.rb
317
332
  - lib/swa/kms/key.rb
333
+ - lib/swa/lake_formation/permission.rb
334
+ - lib/swa/lake_formation/resource_info.rb
318
335
  - lib/swa/polyfill.rb
319
336
  - lib/swa/record.rb
320
337
  - lib/swa/resource.rb
@@ -343,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
360
  - !ruby/object:Gem::Version
344
361
  version: '0'
345
362
  requirements: []
346
- rubygems_version: 3.4.10
363
+ rubygems_version: 3.5.3
347
364
  signing_key:
348
365
  specification_version: 4
349
366
  summary: AWS, backwards