41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from typing import Dict, List, Optional
|
|
|
|
class AirlockAPIWrapper:
|
|
"""
|
|
A wrapper class for interacting with the Airlock API.
|
|
Provides methods for managing agents, policies, hashes, OTPs, and execution history.
|
|
"""
|
|
|
|
def __init__(self, base_url: str, api_key: str):
|
|
"""
|
|
Initialize the API wrapper.
|
|
|
|
Parameters:
|
|
- base_url (str): Base URL of the Airlock API.
|
|
- api_key (str): API key for authentication.
|
|
"""
|
|
self.base_url = base_url.rstrip("/")
|
|
self.api_key = api_key
|
|
self.headers = {"X-APIKey": self.api_key}
|
|
|
|
def pull_policy_exec_histories(self, type: List[str], checkpoint: str, policy: List[str]) -> str:
|
|
"""Retrieve execution history logs."""
|
|
|
|
def api(AirlockAPIWrapper):
|
|
"""
|
|
An implementation of the python AirlockAPIWrapper class to pass Python data into Rust
|
|
|
|
Parameters
|
|
----------
|
|
base_url : str
|
|
(Required) Base URL of the Airlock API, this should be in your .env file.
|
|
api_key : str
|
|
(Required) API Key for your profile in airlock, this should be in your credential manager.
|
|
headers : {"X-APIKey": self.api_key}
|
|
|
|
```def __init__(self, base_url: str, api_key: str):
|
|
self.base_url = base_ur.rstrip("/")
|
|
self.api_key = api_key
|
|
self.headers = {"X-APIKey": self.api_key}
|
|
```
|
|
""" |