commandment.models.
Command
(**kwargs)[source]¶The command model represents a single MDM command that should be, has been, or has failed to be delivered to a single enrolled device.
Table: | commands |
---|
acknowledged_at
¶The datetime (utc) of when the Acknowledged, Error or NotNow response was returned.
Type: | acknowledged_at (datetime.datetime) |
---|
after
¶If not null, the command must not be sent until this datetime is in the past.
Type: | after (datetime.datetime) |
---|
device_id
¶The device ID on the devices table.
Type: | device_id (int) |
---|
find_by_uuid
(uuid: str)[source]¶Find and return an instance of the Command model matching the given UUID string.
Parameters: | uuid (str) – The command UUID |
---|---|
Returns: | Instance of the command, if any |
Return type: | Command |
from_model
(cmd: commandment.mdm.commands.Command)[source]¶This method turns a subclass of commands.Command into an SQLAlchemy model. The parameters of the command are encoded as a JSON dictionary inside the parameters column.
Parameters: | cmd (commands.Command) – The command to be turned into a database model. |
---|---|
Returns: | The database model, ready to be committed. |
Return type: | Command |
id
¶ID
Type: | id (int) |
---|
next_command
(device: commandment.models.Device)[source]¶Get the next available command in the queue for the specified device.
The next available command must match these predicates:
Parameters: | device (Device) – The database model matching the device checking in. |
---|---|
Returns: | The next command model to be processed. |
Return type: | Command |
parameters
¶The parameters that were used when generating the command, serialized into JSON. Omitting the RequestType and CommandUUID attributes.
Type: | parameters (str) |
---|
queued_at
¶The datetime (utc) of when the command was created. Defaults to UTC now
Type: | queued_at (datetime.datetime) |
---|
request_type
¶The command RequestType attribute
Type: | request_type (str) |
---|
sent_at
¶The datetime (utc) of when the command was delivered to the client.
Type: | sent_at (datetime.datetime) |
---|
status
¶The status of the command.
Type: | status (CommandStatus) |
---|
ttl
¶The number of retries remaining until the command will be dead/expired.
Type: | ttl (int) |
---|
uuid
¶Globally unique command UUID
Type: | uuid (GUID) |
---|
commandment.models.
CommandStatus
[source]¶CommandStatus describes all the possible states of a command in the device command queue.
The following statuses are based upon the return status of the MDM client:
Additionally, there are statuses to explain the lifecycle of the command before and after the MDM client processes them: