Class: Seiso::ImportMaster::Importers::ServiceInstanceImporter

Inherits:
BaseImporter
  • Object
show all
Defined in:
lib/seiso/import_master/importers/service_instance_importer.rb

Overview

Author

Willie Wheeler ([email protected])

Copyright

Copyright © 2014-2015 Expedia, Inc.

License

Apache 2.0

Instance Method Summary collapse

Methods inherited from BaseImporter

#detach_children

Constructor Details

#initialize(service_instance_mapper, uri_factory_v1, uri_factory_v2, seiso, rest_connector_v1, rest_connector_v2) ⇒ ServiceInstanceImporter

Returns a new instance of ServiceInstanceImporter.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/seiso/import_master/importers/service_instance_importer.rb', line 19

def initialize(
        service_instance_mapper,
        uri_factory_v1,
        uri_factory_v2,
        seiso,
        rest_connector_v1,
        rest_connector_v2)

      @service_instance_mapper = service_instance_mapper
      @uri_factory_v1 = uri_factory_v1
      @uri_factory_v2 = uri_factory_v2
	@seiso = seiso
      @rest_connector_v1 = rest_connector_v1
      @rest_connector_v2 = rest_connector_v2
end

Instance Method Details

#import(doc) ⇒ Object

Imports the service instance document



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/seiso/import_master/importers/service_instance_importer.rb', line 36

def import(doc)
	sdm_service_instances = doc['items']
    sdm_ports = detach_children(sdm_service_instances, 'serviceInstance', 'key', 'ports')
    sdm_roles = detach_children(sdm_service_instances, 'serviceInstance', 'key', 'ipAddressRoles')
      sdm_dependencies = detach_children(sdm_service_instances, 'serviceInstance', 'key', 'dependencies')
      sdm_seyren_checks = detach_children(sdm_service_instances, 'serviceInstance', 'key', 'seyrenChecks')

      import_service_instances sdm_service_instances
      import_ports sdm_ports
      import_ip_address_roles sdm_roles
      import_dependencies sdm_dependencies
      import_seyren_checks sdm_seyren_checks
end