Skip to content

Commit

Permalink
feat(ingest/elasticsearch): add api_key auth (datahub-project#11475)
Browse files Browse the repository at this point in the history
  • Loading branch information
th0ger authored Sep 29, 2024
1 parent efcc918 commit 0187fc6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import defaultdict
from dataclasses import dataclass, field
from hashlib import md5
from typing import Any, Dict, Generator, Iterable, List, Optional, Tuple, Type
from typing import Any, Dict, Generator, Iterable, List, Optional, Tuple, Type, Union

from elasticsearch import Elasticsearch
from pydantic import validator
Expand Down Expand Up @@ -249,6 +249,10 @@ class ElasticsearchSourceConfig(PlatformInstanceConfigMixin, EnvConfigMixin):
password: Optional[str] = Field(
default=None, description="The password credential."
)
api_key: Optional[Union[Any, str]] = Field(
default=None,
description="API Key authentication. Accepts either a list with id and api_key (UTF-8 representation), or a base64 encoded string of id and api_key combined by ':'.",
)

use_ssl: bool = Field(
default=False, description="Whether to use SSL for the connection or not."
Expand Down Expand Up @@ -346,6 +350,7 @@ def __init__(self, config: ElasticsearchSourceConfig, ctx: PipelineContext):
self.client = Elasticsearch(
self.source_config.host,
http_auth=self.source_config.http_auth,
api_key=self.source_config.api_key,
use_ssl=self.source_config.use_ssl,
verify_certs=self.source_config.verify_certs,
ca_certs=self.source_config.ca_certs,
Expand Down

0 comments on commit 0187fc6

Please sign in to comment.