Class: TwistlockControl::Entities::Service

Inherits:
PersistedEntity show all
Defined in:
lib/twistlock_control/entities/service.rb

Overview

A Service class describes a provisionable network service.

Direct Known Subclasses

CompositeService, Container

Class Method Summary collapse

Methods inherited from PersistedEntity

all, find_by_id, find_with_ids, inherited, #remove, #repository, #save

Methods inherited from TwistlockControl::Entity

#==, #serialize

Class Method Details

.deserialize(attrs) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/twistlock_control/entities/service.rb', line 7

def self.deserialize(attrs)
	return nil if attrs.nil?

	case attrs['service_type']
	when 'container' then Container.new(attrs)
	when 'composite' then CompositeService.new(attrs)
	else
		fail "Unknown service_type: #{attrs[:service_type]}"
	end
end