Project

General

Profile

Download (995 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / models / docker_container_wizard_states / exposed_port.rb @ bc82d5d5

1
module DockerContainerWizardStates
2
  class ExposedPort < Parameter
3
    # The Parameter class from which ExposedPort class inherits,validates for the
4
    # presence of an  associated domain, operating system, host or host group. We
5
    # will have to reset those validations for the  ExposedPort class as  they do
6
    # not make any sense for the context in which this class is being used here.
7
    ExposedPort.reset_callbacks(:validate)
8

    
9
    belongs_to :environment,  :foreign_key => :reference_id, :inverse_of => :exposed_ports,
10
                              :class_name => 'DockerContainerWizardStates::Environment'
11
    validates :name,  :uniqueness => { :scope => :reference_id },
12
                      :numericality => { :only_integer => true,
13
                                         :greater_than => 0,
14
                                         :less_than_or_equal_to => 655_35 }
15
    validates :value, :presence => true,
16
                      :inclusion => { :in => %w(tcp udp) }
17
  end
18
end