swa 0.8.0 → 0.8.2
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 +4 -4
 - data/lib/swa/cli/lake_formation_command.rb +14 -14
 - data/lib/swa/cli/s3_command.rb +12 -0
 - data/lib/swa/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5395b32bb927c4ec8f2ce5d25a63ee6b63050e84a8e0d45495a93bb7c44255c2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ac4ca651c8331b4504e8631f50ed04422fed4d0bf64d463493ee1ae2cdf0fefa
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1c7236e0302c1877965f1343676d51ac383e0f78fd7221521782c5a2569fc0b6aa1e005d10028189652b1173b748adbb0f6c9f3ea50568bb79b3380d345b8593
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 38219530e62eaa9aae49150dd249265565d738d0981ae6ed1f39f52f4573fdec9011185fb55ec3639069f9a4445ad4c2fb6c2d84d581d12d0c883ae9f56ceb21
         
     | 
| 
         @@ -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 
     | 
    
         
            -
                       
     | 
| 
      
 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/cli/s3_command.rb
    CHANGED
    
    | 
         @@ -106,6 +106,18 @@ module Swa 
     | 
|
| 
       106 
106 
     | 
    
         | 
| 
       107 
107 
     | 
    
         
             
                      end
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
      
 109 
     | 
    
         
            +
                      subcommand ["versions"], "Show versions" do
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                        include CollectionBehaviour
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                        protected
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                        def collection
         
     | 
| 
      
 116 
     | 
    
         
            +
                          bucket.object_versions(:prefix => object_key)
         
     | 
| 
      
 117 
     | 
    
         
            +
                        end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                      end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
       109 
121 
     | 
    
         
             
                      protected
         
     | 
| 
       110 
122 
     | 
    
         | 
| 
       111 
123 
     | 
    
         
             
                      def object
         
     | 
    
        data/lib/swa/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.8.2
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-03-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |