Class: Nomade::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/nomade/job.rb

Instance Method Summary collapse

Constructor Details

#initialize(image_full_name, config_hcl, config_json, config_hash) ⇒ Job

Returns a new instance of Job.



3
4
5
6
7
8
# File 'lib/nomade/job.rb', line 3

def initialize(image_full_name, config_hcl, config_json, config_hash)
  @image_full_name = image_full_name
  @config_hcl = config_hcl
  @config_json = config_json
  @config_hash = config_hash
end

Instance Method Details

#configuration(format) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/nomade/job.rb', line 10

def configuration(format)
  case format
  when :hcl
    @config_hcl
  when :json
    @config_json
  when :hash
    @config_hash
  else
    @config_hash
  end
end

#image_nameObject



35
36
37
# File 'lib/nomade/job.rb', line 35

def image_name
  image_name_and_version.split(":").first
end

#image_name_and_versionObject



31
32
33
# File 'lib/nomade/job.rb', line 31

def image_name_and_version
  @image_full_name
end

#image_versionObject



39
40
41
# File 'lib/nomade/job.rb', line 39

def image_version
  image_name_and_version.split(":").last
end

#job_nameObject



23
24
25
# File 'lib/nomade/job.rb', line 23

def job_name
  @config_hash["ID"]
end

#job_typeObject



27
28
29
# File 'lib/nomade/job.rb', line 27

def job_type
  @config_hash["Type"]
end