blob: 79bae2cc8dad71e58dd450a699b6c0751a7ee7d7 [file] [log] [blame]
Scott Baker31acc652016-06-23 15:47:56 -07001from xosresource import XOSResource
Zack Williams8af11362016-10-07 16:01:09 -07002from services.monitoring.models import MonitoringChannel, CeilometerService
Scott Baker31acc652016-06-23 15:47:56 -07003
4class XOSCeilometerTenant(XOSResource):
5 provides = "tosca.nodes.CeilometerTenant"
6 xos_model = MonitoringChannel
7 name_field = None
8
9 def get_xos_args(self, throw_exception=True):
10 args = super(XOSCeilometerTenant, self).get_xos_args()
11
12 provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
13 if provider_name:
14 args["provider_service"] = self.get_xos_object(CeilometerService, throw_exception=throw_exception, name=provider_name)
15
16 return args
17
18 def get_existing_objs(self):
19 args = self.get_xos_args(throw_exception=False)
20 provider_service = args.get("provider", None)
21 if provider_service:
22 return [ self.get_xos_object(provider_service=provider_service) ]
23 return []
24
25 def postprocess(self, obj):
26 pass
27
28 def can_delete(self, obj):
29 return super(XOSCeilometerTenant, self).can_delete(obj)
30