31 lines
930 B
Ruby
31 lines
930 B
Ruby
require "providers/provider_account"
|
|
|
|
module Devops
|
|
module Model
|
|
class OpenstackProviderAccount < ProviderAccount
|
|
|
|
field :username, type: String
|
|
field :auth_url, type: String
|
|
field :tenant, type: String
|
|
field :api_key, type: String
|
|
|
|
default_scope ->{ where(provider: Provider::Openstack::PROVIDER) }
|
|
|
|
validates_presence_of :username, message: "'username' is undefined"
|
|
validates_length_of :username, maximum: 31
|
|
validates_format_of :username, with: /\A[\w]+\z/, message: "invalid username"
|
|
|
|
validates_presence_of :auth_url, message: "'auth_url' is undefined"
|
|
validates_length_of :auth_url, maximum: 255
|
|
|
|
validates_presence_of :tenant, message: "'tenant' is undefined"
|
|
validates_length_of :tenant, maximum: 100
|
|
|
|
validates_presence_of :api_key, message: "'api_key' is undefined"
|
|
validates_length_of :api_key, maximum: 100
|
|
|
|
end
|
|
end
|
|
end
|
|
|