Commit 75154da6 authored by Ritika Kaushal's avatar Ritika Kaushal
Browse files

added property for csp prefix for services

parent 18a4e5fa
Pipeline #107460 failed with stages
in 2 minutes and 2 seconds
{ {
"base_url": "https://osdu-ship.msft-osdu-test.org", "base_url": "https://osdu-ship.msft-osdu-test.org",
"csp_base_url_prefix": "no", "csp_base_url_prefix": "no",
"data_partition_id": "opendes", "csp_prefix_wellbore_service": "osdu-wellbore",
"csp_prefix_search_service": "osdu-search",
"data_partition_id": "opendes",
"legal": { "legal": {
"legaltags": ["opendes-public-usa-dataset-7643990"], "legaltags": ["opendes-public-usa-dataset-7643990"],
"otherRelevantDataCountries": ["US"], "otherRelevantDataCountries": ["US"],
......
...@@ -30,7 +30,7 @@ def wellbore( ...@@ -30,7 +30,7 @@ def wellbore(
config = Configuration(LocalFileLoader(), config_path) config = Configuration(LocalFileLoader(), config_path)
las_parser = LasParser(LocalFileLoader()) las_parser = LasParser(LocalFileLoader())
client = OsduClient(config.base_url, token, config.data_partition_id,config.csp_base_url_prefix) client = OsduClient(config.base_url, token, config.data_partition_id,config.csp_base_url_prefix,config.csp_prefix_wellbore_service,config.csp_prefix_search_service)
service = WellBoreService(client, WellLogService(client)) service = WellBoreService(client, WellLogService(client))
failed_ingests = [] failed_ingests = []
......
...@@ -80,3 +80,21 @@ class Configuration: ...@@ -80,3 +80,21 @@ class Configuration:
rtype: str rtype: str
""" """
return self._config.get("csp_base_url_prefix") return self._config.get("csp_base_url_prefix")
@property
def csp_prefix_wellbore_service(self) -> str:
"""
Gets the csp_prefix_wellbore_service.
return: the csp prefix for wellbore search
rtype: str
"""
return self._config.get("csp_prefix_wellbore_service")
@property
def csp_prefix_search_service(self) -> str:
"""
Gets the csp_prefix_ search service.
return: the csp prefix for search service
rtype: str
"""
return self._config.get("csp_prefix_search_service")
...@@ -26,7 +26,7 @@ class DataLoaderWebResponseError(Exception): ...@@ -26,7 +26,7 @@ class DataLoaderWebResponseError(Exception):
class OsduClient: class OsduClient:
def __init__(self, base_url: str, access_token: str, data_partition_id: str, csp_base_url_prefix: str) -> None: def __init__(self, base_url: str, access_token: str, data_partition_id: str, csp_base_url_prefix: str, csp_prefix_wellbore_service: str, csp_prefix_search_service: str) -> None:
""" """
Create a new instance of a OsduClient Create a new instance of a OsduClient
...@@ -38,6 +38,9 @@ class OsduClient: ...@@ -38,6 +38,9 @@ class OsduClient:
self._base_url = base_url self._base_url = base_url
self._data_partition_id = data_partition_id self._data_partition_id = data_partition_id
self._csp_base_url_prefix = csp_base_url_prefix self._csp_base_url_prefix = csp_base_url_prefix
self._csp_prefix_wellbore_service = csp_prefix_wellbore_service
self._csp_prefix_search_service = csp_prefix_search_service
def _create_headers(self) -> Dict[str, str]: def _create_headers(self) -> Dict[str, str]:
""" """
Create a new set of auth headers for OSDU Create a new set of auth headers for OSDU
...@@ -207,8 +210,8 @@ class OsduClient: ...@@ -207,8 +210,8 @@ class OsduClient:
def _get_base_url( self,service_name: str) -> str: def _get_base_url( self,service_name: str) -> str:
if self._csp_base_url_prefix == "yes": if self._csp_base_url_prefix == "yes":
if service_name == "wellbore": if service_name == "wellbore":
return f"{self._base_url}/osdu-wellbore" return f"{self._base_url}/{self._csp_prefix_wellbore_service}"
if service_name == "search": if service_name == "search":
return f"{self._base_url}/osdu-search" return f"{self._base_url}/{self._csp_prefix_search_service}"
else: else:
return self._base_url return self._base_url
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment