swa 0.8.0 → 0.8.1

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: 36e1c1b0403a6cdb2a09bce49b2cc378f6b67f8abfbded1d6baf41d46e70504e
4
- data.tar.gz: 91755af27947ed3028f7da36e44e1e2a53ed0555ce99a0107a557ee4767e6632
3
+ metadata.gz: dc012c238e6f8addd7891b70044fa5958d8ce541b0a8f835a5dc565199532c9f
4
+ data.tar.gz: 89190ad304d311425e0daa21509b3821e057ca2b411f9599740f152ec0fbd079
5
5
  SHA512:
6
- metadata.gz: 2c93335b35ff3b0e070847deee928481a77634d295dfe2e2240308fec7c8f776cfa8f6ab9658bfface70dfcb124f7b10ec55ae75c5375be98ce0161b3f8d1b1e
7
- data.tar.gz: 1e64bf3fe18ba6398dc7d3af897a0223099b85a7112464a112a662d2caa763d35aa14c05d19de042ccdd35b36d4b78707938c720d8c5066504ca94c99fa21f57
6
+ metadata.gz: 489ad35514b0bbfbdb6b82693c351610fced3582cb5f2b93c559298d3bac19abf73d7ae3240ee50daf26dd9e432a8671d37bed10828218aeaa399c339554f879
7
+ data.tar.gz: a4334e5402813b7cbe3baa7bbfccb88d2f4588578b6ec1f316282a6eb62d2d4d732692a3cdddb8d9066df73656bf563c0d893d1b536bd121309a51532f00bcfc
@@ -2,6 +2,7 @@ require "aws-sdk-lakeformation"
2
2
  require "swa/cli/base_command"
3
3
  require "swa/cli/collection_behaviour"
4
4
  require "swa/cli/item_behaviour"
5
+ require "swa/lake_formation/permission"
5
6
  require "swa/lake_formation/resource_info"
6
7
 
7
8
  module Swa
@@ -15,27 +16,26 @@ module Swa
15
16
  List permissions.
16
17
  EOF
17
18
 
19
+ ALLOWED_RESOURCE_TYPES = %w(CATALOG DATABASE TABLE DATA_LOCATION LF_TAG LF_TAG_POLICY LF_TAG_POLICY_DATABASE LF_TAG_POLICY_TABLE)
20
+
21
+ option ["--type", "-T"], "TYPE", "Resource type" do |value|
22
+ value = value.upcase
23
+ raise ArgumentError, "Invalid resource type: #{value}" unless ALLOWED_RESOURCE_TYPES.include?(value)
24
+ value
25
+ end
26
+
18
27
  include CollectionBehaviour
19
28
 
20
29
  private
21
30
 
22
31
  def collection
23
- query_for(:list_permissions, :principal_resource_permissions, Swa::LakeFormation::Permission)
32
+ query_args = {}
33
+ query_args[:resource_type] = type if type
34
+ query_for(:list_permissions, :principal_resource_permissions, Swa::LakeFormation::Permission, **query_args)
24
35
  end
25
36
 
26
37
  end
27
38
 
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
39
  subcommand ["resources"], "Show resources" do
40
40
 
41
41
  self.description = <<-EOF
@@ -58,8 +58,8 @@ module Swa
58
58
  ::Aws::LakeFormation::Client.new(aws_config)
59
59
  end
60
60
 
61
- def query_for(query_method, response_key, model)
62
- records = lf_client.public_send(query_method).public_send(response_key)
61
+ def query_for(query_method, response_key, model, **query_args)
62
+ records = lf_client.public_send(query_method, **query_args).public_send(response_key)
63
63
  model.list(records)
64
64
  end
65
65
 
data/lib/swa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Swa
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
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.8.0
4
+ version: 0.8.1
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-03-07 00:00:00.000000000 Z
11
+ date: 2024-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler