blob: b74e5409dd553cfb045da6cca8af93b45d5668ba [file] [log] [blame]
Sapan Bhatia2ff2db52014-09-08 10:42:23 -04001import os
2from django.db import models
3from core.models import PlCoreBase
Sapan Bhatiaff5a1082014-09-01 02:12:01 -04004from core.models import User,Site,Slice,Deployment
Sapan Bhatia2ff2db52014-09-08 10:42:23 -04005from encrypted_fields import EncryptedCharField
Sapan Bhatiad92f8a62014-09-22 15:07:26 -04006from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
Sapan Bhatia2ff2db52014-09-08 10:42:23 -04007
8class UserCredential(PlCoreBase):
Sapan Bhatia14356b72014-11-05 10:32:41 -05009 user = models.ForeignKey(User, related_name='usercredentials', help_text="The User this credential is associated with")
Sapan Bhatia2ff2db52014-09-08 10:42:23 -040010
11 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
12 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
13 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
14
15
16 def __unicode__(self):
17 return self.name
18
19class SiteCredential(PlCoreBase):
Sapan Bhatia14356b72014-11-05 10:32:41 -050020 site = models.ForeignKey(Site, related_name='sitecredentials', help_text="The User this credential is associated with")
Sapan Bhatia2ff2db52014-09-08 10:42:23 -040021
22 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
23 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
24 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
25
26
27 def __unicode__(self):
28 return self.name
29
30class SliceCredential(PlCoreBase):
Sapan Bhatia14356b72014-11-05 10:32:41 -050031 slice = models.ForeignKey(Slice, related_name='slicecredentials', help_text="The User this credential is associated with")
Sapan Bhatia2ff2db52014-09-08 10:42:23 -040032
33 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
34 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
35 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
36
37
38 def __unicode__(self):
39 return self.name
Sapan Bhatiafdd62ec2014-09-01 01:45:28 -040040
41class DeploymentCredential(PlCoreBase):
Sapan Bhatiad92f8a62014-09-22 15:07:26 -040042 objects = DeploymentLinkManager()
43 deleted_objects = DeploymentLinkDeletionManager()
Sapan Bhatia14356b72014-11-05 10:32:41 -050044 deployment = models.ForeignKey(Deployment, related_name='deploymentcredentials', help_text="The User this credential is associated with")
Sapan Bhatiafdd62ec2014-09-01 01:45:28 -040045
46 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
47 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
48 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
49
50
51 def __unicode__(self):
52 return self.name