Pingping Lin | c537fd9 | 2017-01-17 20:52:09 -0800 | [diff] [blame^] | 1 | from services.vpgwc.models import VPGWCTenant, VPGWCService |
Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +0000 | [diff] [blame] | 2 | from xosresource import XOSResource |
| 3 | |
Pingping Lin | c537fd9 | 2017-01-17 20:52:09 -0800 | [diff] [blame^] | 4 | class XOSVPGWCTenant(XOSResource): |
| 5 | provides = "tosca.nodes.VPGWCTenant" |
| 6 | xos_model = VPGWCTenant |
Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +0000 | [diff] [blame] | 7 | copyin_props = ["s5s8_pgw_tag", "display_message"] |
| 8 | name_field = None |
| 9 | |
| 10 | def get_xos_args(self, throw_exception=True): |
Pingping Lin | c537fd9 | 2017-01-17 20:52:09 -0800 | [diff] [blame^] | 11 | args = super(XOSVPGWCTenant, self).get_xos_args() |
Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +0000 | [diff] [blame] | 12 | |
| 13 | provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception) |
| 14 | if provider_name: |
Pingping Lin | d6c6987 | 2016-09-19 23:31:54 +0000 | [diff] [blame] | 15 | args["provider_service"] = self.get_xos_object(VPGWCService, throw_exception=throw_exception, name=provider_name) |
Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +0000 | [diff] [blame] | 16 | |
| 17 | return args |
| 18 | |
| 19 | def get_existing_objs(self): |
| 20 | args = self.get_xos_args(throw_exception=False) |
| 21 | provider_service = args.get("provider", None) |
| 22 | if provider_service: |
| 23 | return [ self.get_xos_object(provider_service=provider_service) ] |
| 24 | return [] |
| 25 | |
| 26 | def postprocess(self, obj): |
| 27 | pass |
| 28 | |
| 29 | def can_delete(self, obj): |
Pingping Lin | c537fd9 | 2017-01-17 20:52:09 -0800 | [diff] [blame^] | 30 | return super(XOSVPGWCTenant, self).can_delete(obj) |
Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +0000 | [diff] [blame] | 31 | |