blob: 06cbd421e216bb8144411ef2ef7df63f76d2bd7a [file] [log] [blame]
from xosresource import XOSResource
from core.models import Tenant, Service
from services.vpgwu.models import VPGWUTenant
class XOSVPGWUTenant(XOSResource):
provides = "tosca.nodes.VPGWUTenant"
xos_model = VPGWUTenant
name_field = None
copyin_props = ["s5s8_pgw_tag", "display_message", "image_name"]
def get_xos_args(self, throw_exception=True):
args = super(XOSVPGWUTenant, self).get_xos_args()
provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=True)
if provider_name:
args["provider_service"] = self.get_xos_object(Service, throw_exception=True, name=provider_name)
return args
def get_existing_objs(self):
args = self.get_xos_args(throw_exception=False)
provider_service = args.get("provider", None)
if provider_service:
return [self.get_xos_object(provider_service=provider_service)]
return []
def postprocess(self, obj):
pass
def can_delete(self, obj):
return super(XOSVPGWUTenant, self).can_delete(obj)