def _get_goal(self, context, fieldname, value, eager): try: return self._get(context, model=models.Goal, fieldname=fieldname, value=value, eager=eager) except exception.ResourceNotFound: raise exception.GoalNotFound(goal=value)
def get_goal_uuid(cls, uuid_or_name): if uuid_or_name is None: return query_func = None if not utils.is_uuid_like(uuid_or_name): query_func = objects.Goal.get_by_name else: query_func = objects.Goal.get_by_uuid try: goal = query_func(cls.ctx, uuid_or_name) except Exception as exc: LOG.exception(exc) raise exception.GoalNotFound(goal=uuid_or_name) if not goal.deleted_at: raise exception.NotSoftDeletedStateError(name=_('Goal'), id=uuid_or_name) return goal.uuid
def soft_delete_goal(self, goal_id): try: return self._soft_delete(models.Goal, goal_id) except exception.ResourceNotFound: raise exception.GoalNotFound(goal=goal_id)
def destroy_goal(self, goal_id): try: return self._destroy(models.Goal, goal_id) except exception.ResourceNotFound: raise exception.GoalNotFound(goal=goal_id)