api.serializers

Classes to serialize the RESTful representation of Deis API models.

class api.serializers.AdminUserSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize admin status for a User model.

class Meta[source]
fields = [u'username', u'is_superuser']
model

alias of User

read_only_fields = [u'username']
class api.serializers.AppSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a App model.

class Meta[source]

Metadata options for a AppSerializer.

fields = [u'uuid', u'id', u'owner', u'url', u'structure', u'created', u'updated']
model

alias of App

read_only_fields = [u'uuid']
class api.serializers.BuildSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Build model.

class Meta[source]

Metadata options for a BuildSerializer.

fields = [u'owner', u'app', u'image', u'sha', u'procfile', u'dockerfile', u'created', u'updated', u'uuid']
model

alias of Build

read_only_fields = [u'uuid']
class api.serializers.CertificateSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Cert model.

class Meta[source]

Metadata options for a DomainCertSerializer.

extra_kwargs = {u'common_name': {u'required': False}, u'key': {u'write_only': True}, u'certificate': {u'write_only': True}}
model

alias of Certificate

read_only_fields = [u'expires', u'created', u'updated']
class api.serializers.ConfigSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Config model.

class Meta[source]

Metadata options for a ConfigSerializer.

model

alias of Config

ConfigSerializer.validate_cpu(value)[source]
ConfigSerializer.validate_memory(value)[source]
ConfigSerializer.validate_tags(value)[source]
class api.serializers.ContainerSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Container model.

class Meta[source]

Metadata options for a ContainerSerializer.

fields = [u'owner', u'app', u'release', u'type', u'num', u'state', u'created', u'updated', u'uuid']
model

alias of Container

ContainerSerializer.get_release(obj)[source]
class api.serializers.DomainSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Domain model.

class Meta[source]

Metadata options for a DomainSerializer.

fields = [u'uuid', u'owner', u'created', u'updated', u'app', u'domain']
model

alias of Domain

DomainSerializer.validate_domain(value)[source]

Check that the hostname is valid

class api.serializers.JSONFieldSerializer(read_only=False, write_only=False, required=None, default=<class rest_framework.fields.empty>, initial=<class rest_framework.fields.empty>, source=None, label=None, help_text=None, style=None, error_messages=None, validators=None, allow_null=False)[source]

A Django REST framework serializer for JSON data.

to_internal_value(data)[source]

Deserialize the field’s JSON data, for write operations.

to_representation(obj)[source]

Serialize the field’s JSON data, for read operations.

class api.serializers.JSONIntFieldSerializer(read_only=False, write_only=False, required=None, default=<class rest_framework.fields.empty>, initial=<class rest_framework.fields.empty>, source=None, label=None, help_text=None, style=None, error_messages=None, validators=None, allow_null=False)[source]

A JSON serializer that coerces its data to integers.

to_internal_value(data)[source]

Deserialize the field’s JSON integer data.

class api.serializers.JSONStringFieldSerializer(read_only=False, write_only=False, required=None, default=<class rest_framework.fields.empty>, initial=<class rest_framework.fields.empty>, source=None, label=None, help_text=None, style=None, error_messages=None, validators=None, allow_null=False)[source]

A JSON serializer that coerces its data to strings.

to_internal_value(data)[source]

Deserialize the field’s JSON string data.

class api.serializers.KeySerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Key model.

class Meta[source]

Metadata options for a KeySerializer.

model

alias of Key

class api.serializers.ModelSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]
get_validators()[source]

Hack to remove DRF’s UniqueTogetherValidator when it concerns the UUID.

See https://github.com/deis/deis/pull/2898#discussion_r23105147

class api.serializers.PushSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Push model.

class Meta[source]

Metadata options for a PushSerializer.

fields = [u'uuid', u'owner', u'app', u'sha', u'fingerprint', u'receive_user', u'receive_repo', u'ssh_connection', u'ssh_original_command', u'created', u'updated']
model

alias of Push

class api.serializers.ReleaseSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]

Serialize a Release model.

class Meta[source]

Metadata options for a ReleaseSerializer.

model

alias of Release

class api.serializers.UserSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]
class Meta[source]
extra_kwargs = {u'password': {u'write_only': True}}
fields = [u'email', u'username', u'password', u'first_name', u'last_name', u'is_superuser', u'is_staff', u'groups', u'user_permissions', u'last_login', u'date_joined', u'is_active']
model

alias of User

read_only_fields = [u'is_superuser', u'is_staff', u'groups', u'user_permissions', u'last_login', u'date_joined', u'is_active']
UserSerializer.create(validated_data)[source]