47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
import sys
|
|
import os
|
|
import logging
|
|
|
|
|
|
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
|
sys.path.append(project_root)
|
|
|
|
|
|
from services.API import AirlockAPIWrapper
|
|
from services.security import getAPI
|
|
|
|
logger = logging.getLogger()
|
|
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
def main():
|
|
try:
|
|
url = "https://172.17.22.240:3129"
|
|
username = os.getenv("USERNAME")
|
|
|
|
if not url:
|
|
raise ValueError("Missing URL in environment variables.")
|
|
if not username:
|
|
raise ValueError("Missing USERNAME in environment variables.")
|
|
|
|
logger.debug(f"Retrieved URL: {url}")
|
|
logger.debug(f"Retrieved Username: {username}")
|
|
|
|
except ValueError as e:
|
|
logger.error(f"Configuration error: {e}", exc_info=True)
|
|
raise
|
|
|
|
|
|
if username:
|
|
api = AirlockAPIWrapper(
|
|
base_url= url,
|
|
api_key = getAPI(username, "AirlockTools"), # pyright: ignore[reportArgumentType]
|
|
)
|
|
|
|
source = ""
|
|
target = ""
|
|
response = api.policy_clone(source, target)
|
|
print(response)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|