1 |
2b80fdd9
|
orrabin
|
class ExposedPort < DockerParameter
|
2 |
8e2848d5
|
Vanya Jauhal
|
belongs_to :container, :foreign_key => :reference_id, :inverse_of => :exposed_ports
|
3 |
2b80fdd9
|
orrabin
|
audited :associated_with => :container, :allow_mass_assignment => true
|
4 |
|
|
validates :key, :uniqueness => { :scope => :reference_id }
|
5 |
|
|
validates :key, :numericality => { :only_integer => true,
|
6 |
8e2848d5
|
Vanya Jauhal
|
:greater_than => 0,
|
7 |
|
|
:less_than_or_equal_to => 655_35,
|
8 |
|
|
:message => "%{value} is not a valid port number" }
|
9 |
|
|
|
10 |
|
|
validates :value, :presence => true,
|
11 |
|
|
:inclusion => { :in => %w(tcp udp),
|
12 |
|
|
:message => "%{value} is not a valid protocol" }
|
13 |
|
|
end |