示例#1
0
    def create(self, values):
        data = values.copy()
        CredentialsAPI.transpose(data)

        if 'tenant_id' in values:
            if data['tenant_id'] is None and values['tenant_id'] is not None:
                raise fault.ItemNotFoundFault('Invalid tenant id: %s' % \
                                              values['tenant_id'])

        credentials_ref = models.Credentials()
        credentials_ref.update(data)
        credentials_ref.save()

        return CredentialsAPI.to_model(credentials_ref)
示例#2
0
 def create(self, values):
     credentials_ref = models.Credentials()
     credentials_ref.update(values)
     credentials_ref.save()
     return credentials_ref