Reference¶
ssb-collector-client package¶
ssb_collector_client.collector module¶
- class CollectorClient(collector_url, skip_keycloak_token=False)¶
Bases:
objectClient for interacting with the SSB Collector service.
This class provides methods to start, stop, and monitor collector tasks.
- Parameters:
collector_url (
str) – The base URL of the collector serviceskip_keycloak_token (bool)
Example
>>> client = CollectorClient("https://collector.example.com") >>> client.collector_url 'https://collector.example.com'
- running_tasks()¶
Get all running collector tasks.
- Returns:
The “requests.Response” object from the API call
- Return type:
Response
- start(specification)¶
Start a new collector task.
- Parameters:
specification (
dict[str,Any]) – The JSON object of the collector specification- Returns:
The “requests.Response” object from the API call
- Return type:
Response
- stop(task_id)¶
Stop a running collector task.
- Parameters:
task_id (
int) – The id of the task to stop.- Returns:
The “requests.Response” object from the API call
- Return type:
Response
- running_tasks(collector_url, skip_keycloak_token=False)¶
Get all running collector tasks.
- Parameters:
collector_url (
str) – The URL of the collector serviceskip_keycloak_token (
bool) – If True, the client will not fetch a Keycloak token for authentication. Default is False. Used for service-to-service communication where authentication is handled through NAIS service discovery.
- Returns:
The “requests.Response” object from the API call
- Return type:
Response
- start(collector_url, specification, skip_keycloak_token=False)¶
Start a new collector task.
- Parameters:
collector_url (
str) – The URL of the collector servicespecification (
dict[str,Any]) – The JSON object of the collector specificationskip_keycloak_token (
bool) – If True, the client will not fetch a Keycloak token for authentication. Default is False. Used for service-to-service communication where authentication is handled through NAIS service discovery.
- Returns:
The “requests.Response” object from the API call
- Return type:
Response
- stop(collector_url, task_id, skip_keycloak_token=False)¶
Stop a running collector task.
- Parameters:
collector_url (
str) – The URL of the collector servicetask_id (
int) – The id of the task to stop.skip_keycloak_token (
bool) – If True, the client will not fetch a Keycloak token for authentication. Default is False. Used for service-to-service communication where authentication is handled through NAIS service discovery.
- Returns:
The “requests.Response” object from the API call
- Return type:
Response