fluke/devops-service/db/mongo/models/provider_accounts/openstack_provider_account.rb
Tim Lianov 0fe1218731 Revert "Merge branch 'qa' into release"
This reverts commit 49ba7a8b0d, reversing
changes made to eb753df4c9.
2016-01-21 12:10:36 -05:00

50 lines
1.1 KiB
Ruby

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.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