File: aliyun.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 (34 lines) | stat: -rw-r--r-- 800 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
# frozen_string_literal: true

class Aliyun < Fog::Bin
  class << self
    def class_for(key)
      case key
      when :storage
        Fog::Aliyun::Storage
      when :compute
        Fog::Compute::Aliyun
      else
        raise ArgumentError, "Unrecognized service: #{key}"
      end
    end

    def [](service)
      @@connections ||= Hash.new do |hash, key|
        hash[key] =
          case key
          when :storage
            Fog::Logger.warning('Aliyun[:storage] is not recommended, use Storage[:openstack] for portability')
            Fog::Storage.new(provider: 'aliyun')
          else
            raise ArgumentError, "Unrecognized service: #{key.inspect}"
          end
      end
      @@connections[service]
    end

    def services
      Fog::Aliyun.services
    end
  end
end