Sha256: 976c029dde483018f011933960fc8d0ac92c07422fdcd7f56585249411808a4e

Contents?: true

Size: 882 Bytes

Versions: 6

Compression:

Stored size: 882 Bytes

Contents

require 'rancher/api/models/machine/driver_config'

module Rancher
  module Api
    class Machine
      DIGITAL_OCEAN = 'digitalocean'

      include Her::Model

      attributes :name, :state, :amazonec2Config, :azureConfig, :description,
                 :digitaloceanConfig, :driver, :exoscaleConfig, :externalId,
                 :labels, :openstackConfig, :packetConfig, :rackspaceConfig,
                 :removed, :softlayerConfig, :virtualboxConfig,
                 :vmwarevcloudairConfig, :vmwarevsphereConfig

      has_many :hosts

      def driver_config
        case driver
        when DIGITAL_OCEAN
          DriverConfig.new(attributes["#{DIGITAL_OCEAN}Config"])
        end
      end

      def driver_config=(dc)
        case driver
        when DIGITAL_OCEAN
          attributes["#{DIGITAL_OCEAN}Config"] = dc.attributes
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rancher-api-0.3.5 lib/rancher/api/models/machine.rb
rancher-api-0.3.3 lib/rancher/api/models/machine.rb
rancher-api-0.3.2 lib/rancher/api/models/machine.rb
rancher-api-0.3.1 lib/rancher/api/models/machine.rb
rancher-api-0.3.0 lib/rancher/api/models/machine.rb
rancher-api-0.2.0 lib/rancher/api/models/machine.rb