Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 1 | from xosresource import XOSResource |
Zack Williams | 8af1136 | 2016-10-07 16:01:09 -0700 | [diff] [blame] | 2 | from services.monitoring.models import MonitoringChannel, CeilometerService |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 3 | |
| 4 | class 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 | |