예제 #1
0
    def load(cls, context, webhook_id, show_deleted=False):
        """Retrieve a webhook from database.

        :param context: the security context for db operations.
        :param webhook_id: the unique ID of the webhook to retrieve.
        :param show_deleted: boolean indicating whether deleted objects
                             should be returned or not. Default is False.
        """
        webhook = db_api.webhook_get(context, webhook_id,
                                     show_deleted=show_deleted)
        if webhook is None:
            raise exception.WebhookNotFound(webhook=webhook_id)

        return cls._from_db_record(webhook)
예제 #2
0
    def load(cls, context, webhook_id, show_deleted=False):
        """Retrieve a webhook from database.

        :param context: the security context for db operations.
        :param webhook_id: the unique ID of the webhook to retrieve.
        :param show_deleted: boolean indicating whether deleted objects
                             should be returned or not. Default is False.
        """
        webhook = db_api.webhook_get(context,
                                     webhook_id,
                                     show_deleted=show_deleted)
        if webhook is None:
            raise exception.WebhookNotFound(webhook=webhook_id)

        return cls._from_db_record(webhook)
예제 #3
0
    def load(cls, context, webhook_id, show_deleted=False, project_safe=True):
        """Retrieve a webhook from database.

        :param context: the security context for db operations.
        :param webhook_id: the unique ID of the webhook to retrieve.
        :param show_deleted: boolean indicating whether deleted objects
                             should be returned or not. Default is False.
        :param project_safe: Optional parameter specifying whether only
                             policies belong to the context.project will be
                             loaded.
        """
        webhook = db_api.webhook_get(context, webhook_id,
                                     show_deleted=show_deleted,
                                     project_safe=project_safe)
        if webhook is None:
            raise exception.WebhookNotFound(webhook=webhook_id)

        return cls._from_db_record(webhook)