Class: Core::ConnectorSettings
- Inherits:
-
Object
- Object
- Core::ConnectorSettings
show all
- Defined in:
- lib/core/connector_settings.rb
Defined Under Namespace
Classes: ConnectorNotFoundError
Constant Summary
collapse
- DEFAULT_REQUEST_PIPELINE =
'ent-search-generic-ingestion'
true
- DEFAULT_REDUCE_WHITESPACE =
true
- DEFAULT_RUN_ML_INFERENCE =
true
- DEFAULT_PAGE_SIZE =
100
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(es_response, connectors_meta) ⇒ ConnectorSettings
Returns a new instance of ConnectorSettings.
35
36
37
38
|
# File 'lib/core/connector_settings.rb', line 35
def initialize(es_response, connectors_meta)
@elasticsearch_response = es_response.with_indifferent_access
@connectors_meta = connectors_meta.with_indifferent_access
end
|
Class Method Details
.fetch_by_id(connector_id) ⇒ Object
.fetch_crawler_connectors(page_size = DEFAULT_PAGE_SIZE) ⇒ Object
.fetch_native_connectors(page_size = DEFAULT_PAGE_SIZE) ⇒ Object
40
41
42
43
|
# File 'lib/core/connector_settings.rb', line 40
def self.fetch_native_connectors(page_size = DEFAULT_PAGE_SIZE)
query = { term: { is_native: true } }
fetch_connectors_by_query(query, page_size)
end
|
Instance Method Details
#[](property_name) ⇒ Object
54
55
56
57
|
# File 'lib/core/connector_settings.rb', line 54
def [](property_name)
@elasticsearch_response[:_source][property_name]
end
|
#configuration ⇒ Object
75
76
77
|
# File 'lib/core/connector_settings.rb', line 75
def configuration
self[:configuration]
end
|
#connector_status ⇒ Object
63
64
65
|
# File 'lib/core/connector_settings.rb', line 63
def connector_status
self[:status]
end
|
#connector_status_allows_sync? ⇒ Boolean
87
88
89
|
# File 'lib/core/connector_settings.rb', line 87
def
return_if_present(@elasticsearch_response.dig(:pipeline, :extract_binary_content), @connectors_meta.dig(:pipeline, :default_extract_binary_content), DEFAULT_EXTRACT_BINARY_CONTENT)
end
|
99
100
101
102
103
|
# File 'lib/core/connector_settings.rb', line 99
def formatted
properties = ["ID: #{id}"]
properties << "Service type: #{service_type}" if service_type
"connector (#{properties.join(', ')})"
end
|
#id ⇒ Object
50
51
52
|
# File 'lib/core/connector_settings.rb', line 50
def id
@elasticsearch_response[:_id]
end
|
#index_name ⇒ Object
59
60
61
|
# File 'lib/core/connector_settings.rb', line 59
def index_name
self[:index_name]
end
|
#needs_service_type? ⇒ Boolean
105
106
107
|
# File 'lib/core/connector_settings.rb', line 105
def needs_service_type?
service_type.to_s.strip.empty?
end
|
#reduce_whitespace? ⇒ Boolean
91
92
93
|
# File 'lib/core/connector_settings.rb', line 91
def reduce_whitespace?
return_if_present(@elasticsearch_response.dig(:pipeline, :reduce_whitespace), @connectors_meta.dig(:pipeline, :default_reduce_whitespace), DEFAULT_REDUCE_WHITESPACE)
end
|
#request_pipeline ⇒ Object
83
84
85
|
# File 'lib/core/connector_settings.rb', line 83
def request_pipeline
return_if_present(@elasticsearch_response.dig(:pipeline, :name), @connectors_meta.dig(:pipeline, :default_name), DEFAULT_REQUEST_PIPELINE)
end
|
#run_ml_inference? ⇒ Boolean
95
96
97
|
# File 'lib/core/connector_settings.rb', line 95
def run_ml_inference?
return_if_present(@elasticsearch_response.dig(:pipeline, :run_ml_inference), @connectors_meta.dig(:pipeline, :default_run_ml_inference), DEFAULT_RUN_ML_INFERENCE)
end
|
#scheduling_settings ⇒ Object
79
80
81
|
# File 'lib/core/connector_settings.rb', line 79
def scheduling_settings
self[:scheduling]
end
|
#service_type ⇒ Object
71
72
73
|
# File 'lib/core/connector_settings.rb', line 71
def service_type
self[:service_type]
end
|
#valid_index_name? ⇒ Boolean