lib/rancher/api/models/machine.rb in rancher-api-beta-0.8.0.pre.beta vs lib/rancher/api/models/machine.rb in rancher-api-beta-0.8.1
- old
+ new
@@ -1,47 +1,24 @@
# frozen_string_literal: true
-require 'rancher/api/models/machine/driver_config'
-
module Rancher
module Api
class Machine
include Her::Model
include Helpers::Model
- DIGITAL_OCEAN = 'digitalocean'
- VMWARE_VSPHERE = 'vmwarevsphere'
-
- attributes :name, :state, :amazonec2Config, :azureConfig, :description,
- :digitaloceanConfig, :driver, :exoscaleConfig, :externalId,
- :labels, :openstackConfig, :packetConfig, :rackspaceConfig,
- :removed, :softlayerConfig, :virtualboxConfig,
- :vmwarevcloudairConfig, :vmwarevsphereConfig
-
+ include Rancher::Api::Helpers::Machine
+ belongs_to :account
+ belongs_to :hosttemplate
+ has_one :account
has_many :hosts
- class << self
- def transitioning
- all.select { |m| m.transitioning.eql?('yes') }
- end
-
- def active
- where(state: 'active')
- end
- end
-
- 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
+ attributes :accountId, :created, :data, :description, :driver,
+ :externalId, :id, :kind, :name, :removeTime,
+ :removed, :state, :uuid, :transitioning, :transitioningMessage,
+ :transitioningProgress, :amazonec2Config, :authCertificateAuthority, :authKey, :azureConfig,
+ :digitaloceanConfig, :dockerVersion, :engineEnv, :engineInsecureRegistry, :engineInstallUrl,
+ :engineLabel, :engineOpt, :engineRegistryMirror, :engineStorageDriver, :hostTemplateId,
+ :labels, :packetConfig
end
end
end