Sha256: 7c16993fb76f79b86d05c5b5c6fc3f3ec8111966893bfe2a5301516f2ba454f0

Contents?: true

Size: 854 Bytes

Versions: 7

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

module Cloud
  module Sh
    module Providers
      def self.providers
        @providers ||= {}
      end

      def self.add_provider(name, klass)
        providers[name] = klass
      end

      def self.build(account)
        return providers[account.kind].new(account) if providers.key?(account.kind)
        raise ArgumentError, "Don't know account kind #{account.kind} for account #{account.inspect}"
      end

      class Base
        include Cloud::Sh::Helpers::Commands

        attr_reader :account

        def initialize(account)
          @account = account
        end

        def servers
          raise NotImplementedError
        end

        def databases
          raise NotImplementedError
        end

        def clusters
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cloud-sh-1.0.6 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.5 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.4 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.3 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.2 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.1 lib/cloud/sh/providers/base.rb
cloud-sh-1.0.0 lib/cloud/sh/providers/base.rb