|
6 | 6 | from httpx import HTTPStatusError |
7 | 7 | from pystac import Catalog, Collection, Item, StacIO |
8 | 8 |
|
9 | | -from worker.common.iam import IAMClient |
10 | 9 | from worker.common.log_utils import configure_logging, log_with_context |
11 | | -from worker.common.secrets import worker_secrets |
12 | 10 | from worker.common.task_handler import TaskHandler |
13 | 11 | from worker.common.types import ExternalJob, JobResult, JobResultBuilder |
14 | 12 |
|
15 | 13 | configure_logging() |
16 | 14 |
|
17 | | -iam_client_id = worker_secrets.get_secret("iam_client_id", None) |
18 | | -iam_client_secret = worker_secrets.get_secret("iam_client_secret", None) |
19 | | -iam_oidc_token_endpoint_url = "https://iam-auth.apx.develop.eoepca.org/realms/eoepca/protocol/openid-connect/token" |
20 | | -iam_client = IAMClient( |
21 | | - token_endpoint_url=iam_oidc_token_endpoint_url, client_id=iam_client_id, client_secret=iam_client_secret |
22 | | -) |
23 | | - |
24 | 15 |
|
25 | 16 | class StacCatalogHandler(TaskHandler): |
26 | 17 | def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> JobResult: |
@@ -140,7 +131,7 @@ def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> J |
140 | 131 | return result.failure() |
141 | 132 |
|
142 | 133 | # Get token to access protected endpoints of catalog |
143 | | - token = iam_client.get_access_token() |
| 134 | + token = self.iam_client.get_access_token() |
144 | 135 | headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} |
145 | 136 |
|
146 | 137 | # Publish stac collection |
@@ -236,7 +227,7 @@ def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> J |
236 | 227 | return result.failure() |
237 | 228 |
|
238 | 229 | # Get token to access protected endpoints of catalog |
239 | | - token = iam_client.get_access_token() |
| 230 | + token = self.iam_client.get_access_token() |
240 | 231 | headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} |
241 | 232 |
|
242 | 233 | # Publish STAC item |
|
0 commit comments