blob: ba58360d9322ab954d48ec72b9c8733c08a0f6d8 [file] [log] [blame]
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -04001import os
2from django.db import models
3from core.models import PlCoreBase
Tony Mack336e0f92014-11-30 15:53:08 -05004from core.models import User,Site,Slice,Controller
Tony Mackd84b1ff2015-03-09 13:03:56 -04005from core.models.plcorebase import StrippedCharField
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -04006from encrypted_fields import EncryptedCharField
Tony Mack336e0f92014-11-30 15:53:08 -05007from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -04008
9class UserCredential(PlCoreBase):
Sapan Bhatia475c5972014-11-05 10:32:41 -050010 user = models.ForeignKey(User, related_name='usercredentials', help_text="The User this credential is associated with")
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040011
12 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
Tony Mackd84b1ff2015-03-09 13:03:56 -040013 key_id = StrippedCharField(help_text="The backend id of this credential", max_length=1024)
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040014 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
15
16
17 def __unicode__(self):
18 return self.name
19
20class SiteCredential(PlCoreBase):
Sapan Bhatia475c5972014-11-05 10:32:41 -050021 site = models.ForeignKey(Site, related_name='sitecredentials', help_text="The User this credential is associated with")
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040022
23 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
Scott Bakeraaa46ed2015-03-10 11:55:28 -070024 key_id = StrippedCharField(help_text="The backend id of this credential", max_length=1024)
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040025 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
26
27
28 def __unicode__(self):
29 return self.name
30
31class SliceCredential(PlCoreBase):
Sapan Bhatia475c5972014-11-05 10:32:41 -050032 slice = models.ForeignKey(Slice, related_name='slicecredentials', help_text="The User this credential is associated with")
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040033
34 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
Tony Mackd84b1ff2015-03-09 13:03:56 -040035 key_id = StrippedCharField(help_text="The backend id of this credential", max_length=1024)
Sapan Bhatia7bcec3b2014-09-08 10:42:23 -040036 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
37
38
39 def __unicode__(self):
40 return self.name
Sapan Bhatia31138dd2014-09-01 01:45:28 -040041
Tony Mack336e0f92014-11-30 15:53:08 -050042class ControllerCredential(PlCoreBase):
43 objects = ControllerLinkManager()
44 deleted_objects = ControllerLinkDeletionManager()
45 controller = models.ForeignKey(Controller, related_name='controllercredentials', help_text="The User this credential is associated with")
Sapan Bhatia31138dd2014-09-01 01:45:28 -040046
47 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
48 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
49 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
50
51
52 def __unicode__(self):
53 return self.name