Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, machine_type: str, site_name: str):
self._configuration = getattr(Configuration(), site_name)
self.cloud_stack_client = CloudStack(
end_point=self._configuration.end_point,
api_key=self._configuration.api_key,
api_secret=self._configuration.api_secret,
event_loop=runtime._meta_runner.runners[asyncio].event_loop,
)
self._machine_type = machine_type
self._site_name = site_name
key_translator = StaticMapping(
remote_resource_uuid="id", drone_uuid="name", resource_status="state"
)
translator_functions = StaticMapping(
created=lambda date: datetime.strptime(date, "%Y-%m-%dT%H:%M:%S%z"),
updated=lambda date: datetime.strptime(date, "%Y-%m-%dT%H:%M:%S%z"),
state=lambda x, translator=StaticMapping(
Present=ResourceStatus.Booting,
Running=ResourceStatus.Running,
Stopped=ResourceStatus.Stopped,
Expunged=ResourceStatus.Deleted,