NIFI-13825 Add property for custom certificates to OpenSearch processors (#10)
Signed-off-by: David Handermann <exceptionfactory@apache.org>
diff --git a/src/extensions/vectorstores/OpenSearchVectorUtils.py b/src/extensions/vectorstores/OpenSearchVectorUtils.py
index 0acea68..ab44044 100644
--- a/src/extensions/vectorstores/OpenSearchVectorUtils.py
+++ b/src/extensions/vectorstores/OpenSearchVectorUtils.py
@@ -45,6 +45,12 @@
sensitive=True,
validators=[StandardValidators.NON_EMPTY_VALIDATOR],
)
+CERTIFICATE_PATH = PropertyDescriptor(
+ name="Certificate Path",
+ description="The path to the CA certificate to be used.",
+ required=False,
+ validators=[StandardValidators.NON_EMPTY_VALIDATOR],
+)
INDEX_NAME = PropertyDescriptor(
name="Index Name",
description="The name of the OpenSearch index.",
@@ -74,12 +80,16 @@
def create_authentication_params(context):
username = context.getProperty(USERNAME).getValue()
password = context.getProperty(PASSWORD).getValue()
+ certificate_path = context.getProperty(CERTIFICATE_PATH).getValue()
- params = {"verify_certs": "true"}
+ params = {}
if username is not None and password is not None:
params["http_auth"] = (username, password)
+ if certificate_path is not None:
+ params["ca_certs"] = certificate_path
+
return params
diff --git a/src/extensions/vectorstores/PutOpenSearchVector.py b/src/extensions/vectorstores/PutOpenSearchVector.py
index 329795e..c8ee1af 100644
--- a/src/extensions/vectorstores/PutOpenSearchVector.py
+++ b/src/extensions/vectorstores/PutOpenSearchVector.py
@@ -6,6 +6,7 @@
from nifiapi.flowfiletransform import FlowFileTransform, FlowFileTransformResult
from nifiapi.properties import ExpressionLanguageScope, PropertyDependency, PropertyDescriptor, StandardValidators
from OpenSearchVectorUtils import (
+ CERTIFICATE_PATH,
COSINESIMIL,
HTTP_HOST,
HUGGING_FACE_API_KEY,
@@ -188,6 +189,7 @@
HTTP_HOST,
USERNAME,
PASSWORD,
+ CERTIFICATE_PATH,
INDEX_NAME,
DOC_ID_FIELD_NAME,
VECTOR_FIELD,
diff --git a/src/extensions/vectorstores/QueryOpenSearchVector.py b/src/extensions/vectorstores/QueryOpenSearchVector.py
index 54f3f41..0fb2390 100644
--- a/src/extensions/vectorstores/QueryOpenSearchVector.py
+++ b/src/extensions/vectorstores/QueryOpenSearchVector.py
@@ -7,6 +7,7 @@
from nifiapi.flowfiletransform import FlowFileTransform, FlowFileTransformResult
from nifiapi.properties import ExpressionLanguageScope, PropertyDependency, PropertyDescriptor, StandardValidators
from OpenSearchVectorUtils import (
+ CERTIFICATE_PATH,
COSINESIMIL,
HTTP_HOST,
HUGGING_FACE_API_KEY,
@@ -138,6 +139,7 @@
HTTP_HOST,
USERNAME,
PASSWORD,
+ CERTIFICATE_PATH,
INDEX_NAME,
QUERY,
VECTOR_FIELD,