Class: Inspec::Resources::DockerService
- Inherits:
-
Object
- Object
- Inspec::Resources::DockerService
- Includes:
- DockerObject
- Defined in:
- lib/inspec/resources/docker_service.rb
Instance Method Summary collapse
- #image ⇒ Object
- #image_name ⇒ Object
-
#initialize(opts = {}) ⇒ DockerService
constructor
A new instance of DockerService.
- #mode ⇒ Object
- #name ⇒ Object
- #ports ⇒ Object
- #replicas ⇒ Object
- #repo ⇒ Object
- #resource_id ⇒ Object
- #tag ⇒ Object
- #to_s ⇒ Object
Methods included from DockerObject
Constructor Details
#initialize(opts = {}) ⇒ DockerService
Returns a new instance of DockerService.
32 33 34 35 36 37 |
# File 'lib/inspec/resources/docker_service.rb', line 32 def initialize(opts = {}) # do sanitizion of input values o = opts.dup o = { name: opts } if opts.is_a?(String) @opts = (o) end |
Instance Method Details
#image ⇒ Object
43 44 45 |
# File 'lib/inspec/resources/docker_service.rb', line 43 def image object_info.images[0] if object_info.entries.size == 1 end |
#image_name ⇒ Object
47 48 49 |
# File 'lib/inspec/resources/docker_service.rb', line 47 def image_name parse_components_from_image(image)[:image_name] if object_info.entries.size == 1 end |
#mode ⇒ Object
59 60 61 |
# File 'lib/inspec/resources/docker_service.rb', line 59 def mode object_info.modes[0] if object_info.entries.size == 1 end |
#name ⇒ Object
39 40 41 |
# File 'lib/inspec/resources/docker_service.rb', line 39 def name object_info.names[0] if object_info.entries.size == 1 end |
#ports ⇒ Object
67 68 69 |
# File 'lib/inspec/resources/docker_service.rb', line 67 def ports object_info.ports[0] if object_info.entries.size == 1 end |
#replicas ⇒ Object
63 64 65 |
# File 'lib/inspec/resources/docker_service.rb', line 63 def replicas object_info.replicas[0] if object_info.entries.size == 1 end |
#repo ⇒ Object
51 52 53 |
# File 'lib/inspec/resources/docker_service.rb', line 51 def repo parse_components_from_image(image)[:repo] if object_info.entries.size == 1 end |
#resource_id ⇒ Object
76 77 78 |
# File 'lib/inspec/resources/docker_service.rb', line 76 def resource_id object_info.ids[0] || @opts[:id] || @opts[:name] || "" end |
#tag ⇒ Object
55 56 57 |
# File 'lib/inspec/resources/docker_service.rb', line 55 def tag parse_components_from_image(image)[:tag] if object_info.entries.size == 1 end |
#to_s ⇒ Object
71 72 73 74 |
# File 'lib/inspec/resources/docker_service.rb', line 71 def to_s service = @opts[:name] || @opts[:id] "Docker Service #{service}" end |