from typing import Unpack
from q2_sdk.core.install_steps.base import (
InstallStep,
InstallStepAttribute,
InstallStepArguments,
)
from q2_sdk.hq.db.vendor_address import VendorAddress as VendorAddressDbObj
[docs]
class VendorAddress(InstallStep):
def __init__(self, address, description, **kwargs: Unpack[InstallStepArguments]):
super().__init__(**kwargs)
self.address = InstallStepAttribute(address)
self.description = InstallStepAttribute(description)
self.install_order = 20
[docs]
async def install(self):
await super().install()
await VendorAddressDbObj(
self.logger, hq_credentials=self.hq_credentials
).create(self.address.value, description=self.description.value)
[docs]
async def uninstall(self):
await VendorAddressDbObj(
self.logger, hq_credentials=self.hq_credentials
).delete_by_url(self.address.value)