api.models

Data models for the Deis API.

class api.models.App(*args, **kwargs)[source]

Application used to service requests on behalf of end-users

create(*args, **kwargs)[source]

Create a new application with an initial config and release

delete(*args, **kwargs)[source]

Delete this application including all containers

deploy(user, release)[source]

Deploy a new release to this application

log(message)[source]

Logs a message to the application’s log file.

This is a workaround for how Django interacts with Python’s logging module. Each app needs its own FileHandler instance so it can write to its own log file. That won’t work in Django’s case because logging is set up before you run the server and it disables all existing logging configurations.

logs(log_lines='1000')[source]

Return aggregated log data for this application.

run(user, command)[source]

Run a one-off command in an ephemeral app container.

scale(user, structure)[source]

Scale containers up or down to match requested structure.

class api.models.AuditedModel(*args, **kwargs)[source]

Add created and updated fields to a model.

class Meta[source]

Mark AuditedModel as abstract.

class api.models.Build(*args, **kwargs)[source]

Instance of a software build used by runtime nodes

class api.models.Certificate(*args, **kwargs)[source]

Public and private key pair used to secure application traffic at the router.

class api.models.Config(*args, **kwargs)[source]

Set of configuration values applied as environment variables during runtime execution of the Application.

save(**kwargs)[source]

merge the old config with the new

class api.models.Container(*args, **kwargs)[source]

Docker container used to securely host an application process.

run(command)[source]

Run a one-off command

class api.models.Domain(id, created, updated, owner_id, app_id, domain)[source]
class api.models.Key(*args, **kwargs)[source]

An SSH public key.

class api.models.Push(*args, **kwargs)[source]

Instance of a push used to trigger an application build

class api.models.Release(*args, **kwargs)[source]

Software release deployed by the application platform

Releases contain a Build and a Config.

new(user, config, build, summary=None, source_version=u'latest')[source]

Create a new application release using the provided Build and Config on behalf of a user.

Releases start at v1 and auto-increment.

previous()[source]

Return the previous Release to this one.

Returns:the previous Release, or None
class api.models.UuidAuditedModel(*args, **kwargs)[source]

Add a UUID primary key to an AuditedModel.

class Meta[source]

Mark UuidAuditedModel as abstract.

api.models.close_db_connections(func, *args, **kwargs)[source]

Decorator to explicitly close db connections during threaded execution

Note this is necessary to work around: https://code.djangoproject.com/ticket/22420

api.models.select_app_name()[source]

Select a unique randomly generated app name

api.models.validate_app_structure(value)[source]

Error if the dict values aren’t ints >= 0.

api.models.validate_base64(value)[source]

Check that value contains only valid base64 characters.

api.models.validate_comma_separated(value)[source]

Error if the value doesn’t look like a list of hostnames or IP addresses separated by commas.

api.models.validate_domain(value)[source]

Error if the domain contains unexpected characters.

api.models.validate_id_is_docker_compatible(value)[source]

Check that the ID follows docker’s image name constraints

api.models.validate_reserved_names(value)[source]

A value cannot use some reserved names.