def _create_dao_map(): """Create a map of DAOs. These will be re-usable so that the db connection can apply across different pipelines. Returns: Dictionary of DAOs. """ try: return { 'backend_service_dao': backend_service_dao.BackendServiceDao(), 'bucket_dao': bucket_dao.BucketDao(), 'cloudsql_dao': cloudsql_dao.CloudsqlDao(), 'dao': dao.Dao(), 'folder_dao': folder_dao.FolderDao(), 'forwarding_rules_dao': forwarding_rules_dao.ForwardingRulesDao(), 'instance_dao': instance_dao.InstanceDao(), 'instance_group_dao': instance_group_dao.InstanceGroupDao(), 'instance_group_manager_dao': instance_group_manager_dao.InstanceGroupManagerDao(), 'instance_template_dao': instance_template_dao.InstanceTemplateDao(), 'organization_dao': organization_dao.OrganizationDao(), 'project_dao': project_dao.ProjectDao(), } except data_access_errors.MySQLError as e: LOGGER.error('Error to creating DAO map.\n%s', e) sys.exit()
def _get_instance_templates(self): """Retrieves instance templates. Returns: list: InstanceTemplate """ return instance_template_dao.InstanceTemplateDao(self.global_configs).\ get_instance_templates(self.snapshot_timestamp)
def _create_dao_map(global_configs): """Create a map of DAOs. These will be reusable so that the db connection can apply across different pipelines. Args: global_configs (dict): Global configurations. Returns: dict: Dictionary of DAOs. """ try: return { 'appengine_dao': appengine_dao.AppEngineDao(global_configs), 'backend_service_dao': backend_service_dao.BackendServiceDao(global_configs), 'bucket_dao': bucket_dao.BucketDao(global_configs), 'cloudsql_dao': cloudsql_dao.CloudsqlDao(global_configs), 'dao': dao.Dao(global_configs), 'firewall_rule_dao': firewall_rule_dao.FirewallRuleDao(global_configs), 'folder_dao': folder_dao.FolderDao(global_configs), 'forseti_system_dao': forseti_system_dao.ForsetiSystemDao(global_configs), 'forwarding_rules_dao': forwarding_rules_dao.ForwardingRulesDao(global_configs), 'ke_dao': ke_dao.KeDao(global_configs), 'instance_dao': instance_dao.InstanceDao(global_configs), 'instance_group_dao': instance_group_dao.InstanceGroupDao(global_configs), 'instance_group_manager_dao': instance_group_manager_dao.InstanceGroupManagerDao(global_configs), 'instance_template_dao': instance_template_dao.InstanceTemplateDao(global_configs), 'organization_dao': organization_dao.OrganizationDao(global_configs), 'project_dao': project_dao.ProjectDao(global_configs), 'service_account_dao': service_account_dao.ServiceAccountDao(global_configs), } except data_access_errors.MySQLError as e: LOGGER.error('Error to creating DAO map.\n%s', e) sys.exit()