in src/graph_notebook/configuration/generate_config.py [0:0]
def __init__(self, host: str, port: int,
neptune_service: str = NEPTUNE_DB_SERVICE_NAME,
auth_mode: AuthModeEnum = DEFAULT_AUTH_MODE,
load_from_s3_arn='', ssl: bool = True, ssl_verify: bool = True, aws_region: str = DEFAULT_REGION,
proxy_host: str = '', proxy_port: int = DEFAULT_PORT,
sparql_section: SparqlSection = None, gremlin_section: GremlinSection = None,
neo4j_section: Neo4JSection = None,
neptune_hosts: list = NEPTUNE_CONFIG_HOST_IDENTIFIERS):
self._host = host.strip()
self.port = port
self.ssl = ssl
self.ssl_verify = ssl_verify
self._proxy_host = proxy_host.strip()
self.proxy_port = proxy_port
self.sparql = sparql_section if sparql_section is not None else SparqlSection()
is_neptune_host = is_allowed_neptune_host(hostname=self.host, host_allowlist=neptune_hosts) \
or is_allowed_neptune_host(hostname=self.proxy_host, host_allowlist=neptune_hosts)
if is_neptune_host:
self.is_neptune_config = True
self.neptune_service = normalize_service_name(neptune_service)
self.auth_mode = auth_mode
self.load_from_s3_arn = load_from_s3_arn
self.aws_region = aws_region
if gremlin_section is not None:
default_protocol = DEFAULT_HTTP_PROTOCOL if self._proxy_host != '' else ''
if hasattr(gremlin_section, "connection_protocol"):
if self._proxy_host != '' and gremlin_section.connection_protocol != DEFAULT_HTTP_PROTOCOL:
print("Enforcing HTTP connection protocol for proxy connections.")
final_protocol = DEFAULT_HTTP_PROTOCOL
else:
final_protocol = gremlin_section.connection_protocol
else:
final_protocol = default_protocol
self.gremlin = GremlinSection(message_serializer=gremlin_section.message_serializer,
connection_protocol=final_protocol,
include_protocol=True,
neptune_service=self.neptune_service)
else:
self.gremlin = GremlinSection(include_protocol=True,
neptune_service=self.neptune_service)
self.neo4j = Neo4JSection()
else:
self.is_neptune_config = False
self.gremlin = gremlin_section if gremlin_section is not None else GremlinSection()
self.neo4j = neo4j_section if neo4j_section is not None else Neo4JSection()