def __init__(self): super().__init__() try: table = config[CONFIG_TABLE] partition_key = config[CONFIG_PART_KEY] region = config[CONFIG_REGION] endpoint_url = config.get( CONFIG_ENDPOINT_URL, f"https://dynamodb.{region}.amazonaws.com") access_key = config.get(CONFIG_ACCESS_KEY) secret_key = config.get(CONFIG_SECRET_KEY) session_token = config.get(CONFIG_SESSION_TOKEN) except KeyError as e: raise MissingConfigException(e.args[0]) self.client = boto3.client( "dynamodb", region_name=region, endpoint_url=endpoint_url, aws_access_key_id=access_key, aws_secret_access_key=secret_key, aws_session_token=session_token, ) self.partition_key = partition_key self.table = table
def create(cls) -> StackStore: store_type = config.get("stackstore.implementation") if not store_type: raise MissingConfigException("stackstore.implementation") c = init_class(store_type) if not isinstance(c, StackStore): raise ImportError(f"Not a valid stackstore: {store_type}") return c
def create(cls): store_type = config.get("notification.implementation", DUMMY_NOTIFIER) if not store_type: raise MissingConfigException("notification.implementation") c = init_class(store_type) if not isinstance(c, Notifier): raise ImportError( f"Not a valid notification service: {store_type}") return c
def __init__(self): try: self.update_topic = config[CONFIG_UPDATED_TOPIC] self.delete_topic = config[CONFIG_DELETED_TOPIC] region = config[CONFIG_SNS_REGION] endpoint = config.get(CONFIG_SNS_ENDPOINT, f"https://sns.{region}.amazonaws.com") access_key = config.get(CONFIG_AWS_ACCESS_KEY_ID) secret_key = config.get(CONFIG_AWS_SECRET_ACCESS_KEY) session_token = config.get(CONFIG_AWS_SESSION_TOKEN) self.client = boto3.client( "sns", region_name=region, endpoint_url=endpoint, aws_access_key_id=access_key, aws_secret_access_key=secret_key, aws_session_token=session_token, ) except KeyError as e: raise MissingConfigException(e.args[0])
def get_class(cls) -> ClassVar[TerraformClient]: name = config.get( CONFIG_TERRAFORM_CLIENT, "pyrovision.base.terraform.local.LocalTerraformClient", ) return import_class(name)