Module async_mesos::model [] [src]

Model builders for Mesos Protobufs.

These stateful builders ease the creation of protobuf models. The build method runs a minimal verification of the model and resturns Result<mesos::Model, failure::Error>.

Example

This example is taken from tests/mesos.rs in the main repository.

use async_mesos::model;

let cpu = model::ScalarResourceBuilder::default()
    .name("cpus")
    .value(0.1)
    .build()?;

let mem = model::ScalarResourceBuilder::default()
    .name("mem")
    .value(32.0)
    .build()?;

let command = model::ShellCommandBuilder::default()
    .command("sleep 100000")
    .build()?;

let task_info = model::TaskInfoBuilder::default()
    .name("sleep_task")
    .task_id(task_id)
    .agent_id(agent_id)
    .resources(vec![cpu, mem])
    .command(command)
    .build()?;

let operation = model::OfferLaunchOperationBuilder::default()
    .task_info(task_info)
    .build()?;
let call = client.accept(vec![offer_id], vec![operation]);
Ok(call)

Structs

OfferLaunchOperationBuilder

Builder for Mesos offer operation.

ScalarResourceBuilder
ShellCommandBuilder
TaskInfoBuilder