# frozen_string_literal: true require 'rancher/api/models/machine/driver_config' module Rancher module Api module Helpers module Machine DIGITAL_OCEAN = 'digitalocean' VMWARE_VSPHERE = 'vmwarevsphere' def self.included(base) base.extend(ClassMethods) end module ClassMethods 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 end end end end