blob: 4b5518bdb65d4e44a07c00402c97b160a7f9cd44 [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
6
7class UserCredential(PlCoreBase):
8 user = models.ForeignKey(User, related_name='credentials', help_text="The User this credential is associated with")
9
10 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
11 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
12 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
13
14
15 def __unicode__(self):
16 return self.name
17
18class SiteCredential(PlCoreBase):
19 site = models.ForeignKey(Site, related_name='credentials', help_text="The User this credential is associated with")
20
21 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
22 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
23 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
24
25
26 def __unicode__(self):
27 return self.name
28
29class SliceCredential(PlCoreBase):
30 slice = models.ForeignKey(Slice, related_name='credentials', help_text="The User this credential is associated with")
31
32 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
33 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
34 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
35
36
37 def __unicode__(self):
38 return self.name
Sapan Bhatiafdd62ec2014-09-01 01:45:28 -040039
40class DeploymentCredential(PlCoreBase):
41 deployment = models.ForeignKey(Deployment, related_name='credentials', help_text="The User this credential is associated with")
42
43 name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
44 key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
45 enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
46
47
48 def __unicode__(self):
49 return self.name