from typing import Unpack
from q2_sdk.core.install_steps.base import (
InstallStep,
InstallStepAttribute,
InstallStepArguments,
)
from q2_sdk.hq.db.audit_action import AuditAction as AuditActionDbObj
[docs]
class AuditAction(InstallStep):
"""Interacts with the Q2_AuditAction table"""
def __init__(
self,
short_name,
description,
category_name,
**kwargs: Unpack[InstallStepArguments],
):
super().__init__(**kwargs)
self.short_name = InstallStepAttribute(short_name)
self.description = InstallStepAttribute(description)
self.category_name = InstallStepAttribute(category_name)
[docs]
async def install(self):
await super().install()
await AuditActionDbObj(self.logger, hq_credentials=self.hq_credentials).create(
self.short_name.value, self.description.value, self.category_name.value
)
[docs]
async def uninstall(self):
await AuditActionDbObj(self.logger, hq_credentials=self.hq_credentials).delete(
self.short_name.value
)