require "db/mongo/models/provider_accounts/provider_account" module Devops module Model class OpenstackProviderAccount < ProviderAccount attr_accessor :username, :auth_url, :tenant, :api_key def self.account_fields { username: "Openstack user name", auth_url: "Identity API endpoint", tenant: "Tenant to access", api_key: "Openstack user password" }.merge(ProviderAccount::ACCOUNT_FIELDS) end def initialize a={} super(a) self.provider = Provider::Openstack::PROVIDER self.username = a["username"] self.auth_url = a["auth_url"] self.tenant = a["tenant"] self.api_key = a["api_key"] end def to_list_hash s = super s["username"] = self.username s["auth_url"] = self.auth_url s["tenant"] = self.tenant end def to_mongo_hash s = super s["username"] = self.username s["auth_url"] = self.auth_url s["tenant"] = self.tenant s["api_key"] = self.api_key end def self.build_from_bson a a["account_name"] = a["_id"] OpenstackProviderAccount.new a end end end end