Scott Baker | 8f32cc8 | 2016-08-08 10:34:53 -0700 | [diff] [blame] | 1 | from xosresource import XOSResource |
Zack Williams | b7e9776 | 2016-10-05 16:12:36 -0700 | [diff] [blame] | 2 | from services.hpc.models import CDNPrefix, ContentProvider |
Scott Baker | 8f32cc8 | 2016-08-08 10:34:53 -0700 | [diff] [blame] | 3 | |
| 4 | class XOSCDNPrefix(XOSResource): |
| 5 | provides = "tosca.nodes.CDNPrefix" |
| 6 | xos_model = CDNPrefix |
| 7 | name_field = "prefix" |
| 8 | copyin_props = [] |
| 9 | |
| 10 | def get_xos_args(self): |
| 11 | args = {"prefix": self.obj_name} |
| 12 | |
| 13 | cp_name = self.get_requirement("tosca.relationships.MemberOfContentProvider") |
| 14 | if cp_name: |
| 15 | args["contentProvider"] = self.get_xos_object(ContentProvider, name=cp_name) |
| 16 | |
| 17 | default_os = self.get_requirement("tosca.relationships.DefaultOriginServer") |
| 18 | if default_os: |
| 19 | args["defaultOriginServer"] = self.engine.name_to_xos_model(self.user, default_os) |
| 20 | |
| 21 | return args |
| 22 | |
| 23 | def can_delete(self, obj): |
| 24 | return super(XOSCDNPrefix, self).can_delete(obj) |
| 25 | |