Class: Opsmgr::Settings::Microbosh::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/opsmgr/settings/microbosh/job.rb

Instance Method Summary collapse

Constructor Details

#initialize(job_hash) ⇒ Job

Returns a new instance of Job.



7
8
9
# File 'lib/opsmgr/settings/microbosh/job.rb', line 7

def initialize(job_hash)
  @job_hash = job_hash
end

Instance Method Details

#elb_name=(name) ⇒ Object



29
30
31
# File 'lib/opsmgr/settings/microbosh/job.rb', line 29

def elb_name=(name)
  job_hash['elb_name'] = name
end

#instances=(instance_count) ⇒ Object



33
34
35
36
# File 'lib/opsmgr/settings/microbosh/job.rb', line 33

def instances=(instance_count)
  job_hash['instances'].first['value'] = instance_count
  job_hash.delete('partitions')
end

#nameObject



11
12
13
14
15
# File 'lib/opsmgr/settings/microbosh/job.rb', line 11

def name
  job_hash.fetch('identifier')
rescue
  job_hash.fetch('type')
end

#networks=(networks) ⇒ Object



25
26
27
# File 'lib/opsmgr/settings/microbosh/job.rb', line 25

def networks=(networks)
  job_hash['network_references'] = networks
end

#property(property_name) ⇒ Object



17
18
19
# File 'lib/opsmgr/settings/microbosh/job.rb', line 17

def property(property_name)
  properties('properties').find { |property| property.name == property_name }
end

#resource(resource_name) ⇒ Object



21
22
23
# File 'lib/opsmgr/settings/microbosh/job.rb', line 21

def resource(resource_name)
  properties('resources').find { |resource| resource.name == resource_name }
end