blob: c7a04da6c20f477f1a2a46c03476f92d211243fd [file] [log] [blame]
Sapan Bhatia2ff2db52014-09-08 10:42:23 -04001import os
2from django.db import models
3from core.models import PlCoreBase
4from core.models import User,Site,Slice
5from 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