File: get_bucket_logging.rb

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (36 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Fog
  module Parsers
    module Storage
      module Google
        class AccessControlList < Fog::Parsers::Base
          def reset
            @grant = { "Grantee" => {} }
            @response = { "BucketLoggingStatus" => {} }
          end

          def end_element(name)
            case name
            when "DisplayName", "ID"
              if @in_access_control_list
                @grant["Grantee"][name] = value
              else
                @response["Owner"][name] = value
              end
            when "Grant"
              @response["BucketLoggingStatus"]["LoggingEnabled"]["TargetGrants"] << @grant
              @grant = { "Grantee" => {} }
            when "LoggingEnabled"
              @response["BucketLoggingStatus"]["LoggingEnabled"] = { "TargetGrants" => [] }
            when "Permission"
              @grant[name] = value
            when "TargetBucket", "TargetPrefix"
              @response["BucketLoggingStatus"][name] = value
            when "URI"
              @grant["Grantee"][name] = value
            end
          end
        end
      end
    end
  end
end