connectors_utility 8.6.0.4.pre.20221114T235434Z → 8.6.0.4.pre.20221115T001258Z

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: 5925861ca9c2d09d5a4b27cbb1262e7dee74420815b0df1988d97b5f1c4cbb3b
4
- data.tar.gz: 06bc7686285b134ac9198bb8ad3579b759fda60d2e4962e1fe4fc730828a8428
3
+ metadata.gz: c3de813570562593126d6ae16c482b183f986e3808cf888efe66de65b3e94571
4
+ data.tar.gz: 50039a69879868de3b7326ff99ccfc4a7be5668251bc4c82210d0448fcc41a88
5
5
  SHA512:
6
- metadata.gz: ffb17fd4a35bbecacddc59b018b20b3d24ef1581e5ca6b182dc73aa42100da4976fbb0d2e2e2504767769a0ea259e3091c877e5ac8ad58683cd1a45022215a0b
7
- data.tar.gz: ce59bc3313006d3324d62c572cf9c743028cab4d052ea985a7ca183bf3bd9f55ad5edd6bf93fabd4eb54f2614226c1d8ed195a236d6916cb16682575c902b099
6
+ metadata.gz: 711ac64f54581a8a16a3002e5394e7239cd565277ae037275b7643a432fcd3017000fe43cbe11245029ad16130a5aa6ce712a3a8c2c6078587ab110dd2455fd3
7
+ data.tar.gz: bdf7e91260983c882e4d413a9008591eaa8706b26970ebe7716807427d2078bec801a41946e46418b08fc433fea12549aa037f6ba59924618889276f34ddd962
@@ -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
@@ -8,7 +8,6 @@
8
8
 
9
9
  require 'active_support/core_ext/hash/indifferent_access'
10
10
  require 'connectors/connector_status'
11
- require 'connectors/registry'
12
11
  require 'core/elastic_connector_actions'
13
12
  require 'utility'
14
13
 
@@ -36,6 +35,7 @@ module Core
36
35
  end
37
36
 
38
37
  def self.fetch_native_connectors(page_size = DEFAULT_PAGE_SIZE)
38
+ require 'connectors/registry' unless defined?(Connectors::REGISTRY)
39
39
  query = {
40
40
  bool: {
41
41
  filter: [
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.20221114T235434Z
4
+ version: 8.6.0.4.pre.20221115T001258Z
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