connectors_utility 8.6.0.4.pre.20221114T235050Z → 8.6.0.4.pre.20221115T000648Z

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3b178cb45ca62a666074e0370d28f4b82477d2ee32e6e7a74b24c218f02c121
4
- data.tar.gz: 0b99bd3126a5fdc7cad2ee2b9dc5862284992911043fc7c1931aaac9ea3844d8
3
+ metadata.gz: ceb30af08ba8499ef1904431c3f76c306920553c8c3650168e3a5204034c8dc5
4
+ data.tar.gz: 57c105b727b1490fcb1a9811c242e657513c829a0546a9f1ae15b2f342165e75
5
5
  SHA512:
6
- metadata.gz: 31b38cf34d989cb09c2ab61356f330a22224fe58f76b5a02db12da13ed3d3e6329244cc75b9eeb293312510df9ccb1e0ff615ec65c9dc0e832e8dbe2c5c25328
7
- data.tar.gz: e9b2b753f2ac8135372303f750cb6630d364d0af802a7b5d980cb5ea470e57a3d23c949d2d60356e585da7c9d15383528982ecb80d1eaca2bb36f12854633950
6
+ metadata.gz: bba6b08e29142cc0e738d39ccf7480b00a13b731a810f78f00d23c9e4225ac3c62706cb88d2cb385d83a91133a4ed166fd0606fac43d6b85338575a8bbfa8062
7
+ data.tar.gz: 7df0bc92dff1d78661c2a1d5e0481173fca5b3f0a228720532129d2bd0307254de4c963893db0add89fa73ee39161ef34ea2498d1d7bf0b492584539b79de2a4
@@ -0,0 +1,52 @@
1
+ #
2
+ # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ # or more contributor license agreements. Licensed under the Elastic License;
4
+ # you may not use this file except in compliance with the Elastic License.
5
+ #
6
+
7
+ module Connectors
8
+ class Factory
9
+ attr_reader :connectors
10
+
11
+ def initialize
12
+ @connectors = {}
13
+ end
14
+
15
+ def register(name, klass)
16
+ @connectors[name] = klass
17
+ end
18
+
19
+ def registered?(name)
20
+ @connectors.has_key?(name)
21
+ end
22
+
23
+ def connector_class(name)
24
+ @connectors[name]
25
+ end
26
+
27
+ def connector(name, configuration, job_description: {})
28
+ klass = connector_class(name)
29
+ if klass.present?
30
+ return klass.new(configuration: configuration, job_description: job_description)
31
+ end
32
+ raise "Connector #{name} is not yet registered. You need to register it before use"
33
+ end
34
+
35
+ def registered_connectors
36
+ @connectors.keys.sort
37
+ end
38
+ end
39
+
40
+ REGISTRY = Factory.new
41
+
42
+ require_relative './example/connector'
43
+ REGISTRY.register(Connectors::Example::Connector.service_type, Connectors::Example::Connector)
44
+
45
+ # loading plugins (might replace this with a directory scan and conventions on names)
46
+ require_relative './gitlab/connector'
47
+
48
+ REGISTRY.register(Connectors::GitLab::Connector.service_type, Connectors::GitLab::Connector)
49
+
50
+ require_relative 'mongodb/connector'
51
+ REGISTRY.register(Connectors::MongoDB::Connector.service_type, Connectors::MongoDB::Connector)
52
+ end
@@ -4,7 +4,6 @@
4
4
  # you may not use this file except in compliance with the Elastic License.
5
5
  #
6
6
 
7
- require 'config'
8
7
  require 'logger'
9
8
  require 'active_support/core_ext/module'
10
9
  require 'active_support/core_ext/string/filters'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connectors_utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.6.0.4.pre.20221114T235050Z
4
+ version: 8.6.0.4.pre.20221115T000648Z
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -104,6 +104,7 @@ files:
104
104
  - NOTICE.txt
105
105
  - lib/connectors/connector_status.rb
106
106
  - lib/connectors/crawler/scheduler.rb
107
+ - lib/connectors/registry.rb
107
108
  - lib/connectors/sync_status.rb
108
109
  - lib/connectors_utility.rb
109
110
  - lib/core/connector_settings.rb