File: get_bucket.rb

package info (click to toggle)
ruby-fog-aliyun 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 720 kB
  • sloc: ruby: 5,804; makefile: 6; sh: 3
file content (53 lines) | stat: -rw-r--r-- 1,372 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true

module Fog
  module Aliyun
    class Storage
      class Real
        def bucket_exists?(bucket_name)
          @oss_client.bucket_exists?(bucket_name)
        end

        def get_bucket(bucket_name, options = {})
          unless bucket_name
            raise ArgumentError.new('bucket_name is required')
          end

          # Set the GetBucket max limitation to 1000
          maxKeys = options[:max_keys] || 1000
          maxKeys = maxKeys.to_i
          maxKeys = [maxKeys, 1000].min

          options[:limit] = maxKeys
          options.delete(:max_keys)

          @oss_protocol.list_objects(bucket_name, options)
        end

        def get_bucket_acl(bucket_name)
          @oss_protocol.get_bucket_acl(bucket_name)
        end

        def get_bucket_CORSRules(bucket_name)
          @oss_protocol.get_bucket_cors(bucket_name)
        end

        def get_bucket_lifecycle(bucket_name)
          @oss_protocol.get_bucket_lifecycle(bucket_name)
        end

        def get_bucket_logging(bucket_name)
          @oss_protocol.get_bucket_logging(bucket_name)
        end

        def get_bucket_referer(bucket_name)
          @oss_protocol.get_bucket_referer(bucket_name)
        end

        def get_bucket_website(bucket_name)
          @oss_protocol.get_bucket_website(bucket_name)
        end
      end
    end
  end
end