Sha256: c25bab1a51d63c8a558c1f1b1347186daedcb587071b2a1c9103f745598a6195

Contents?: true

Size: 939 Bytes

Versions: 4

Compression:

Stored size: 939 Bytes

Contents

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

module Rancher
  module Api
    class Machine
      DIGITAL_OCEAN = 'digitalocean'
      VMWARE_VSPHERE = 'vmwarevsphere'

      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, VMWARE_VSPHERE
          DriverConfig.new(attributes["#{driver}Config"])
        end
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rancher-api-0.4.0 lib/rancher/api/models/machine.rb
rancher-api-0.3.8 lib/rancher/api/models/machine.rb
rancher-api-0.3.7 lib/rancher/api/models/machine.rb
rancher-api-0.3.6 lib/rancher/api/models/machine.rb