Source code for q2_sdk.core.install_steps.vendor

from typing import Unpack

from q2_sdk.core.install_steps.base import (
    InstallStep,
    InstallStepAttribute,
    InstallStepArguments,
)
from q2_sdk.hq.db.vendor import Vendor as VendorDbObj


[docs] class Vendor(InstallStep): """Interacts with the Q2_Vendors table""" def __init__(self, vendor_name, **kwargs: Unpack[InstallStepArguments]): super().__init__(**kwargs) self.vendor_name = InstallStepAttribute(vendor_name)
[docs] async def install(self): await super().install() obj = VendorDbObj(self.logger, hq_credentials=self.hq_credentials) existing = await obj.get(short_name=self.vendor_name.value, show_all=True) if existing: return await obj.create(self.vendor_name.value)
[docs] async def uninstall(self): await VendorDbObj(self.logger, hq_credentials=self.hq_credentials).delete( self.vendor_name.value )