Chef objects
This library depends upon chef_api
for most functionality, but
provides a set of models for common Chef objects, such as nodes, roles
and environments.
Usage
Models implement a version oftry_from()
in the context of [serde_json
]'s Value
type - which is what is returned by all requests.
use ;
use Node;
let client = from_credentials?;
let node = client.nodes.node.get?;
let node: Node = try_from?;
println!;
Once try_from
is stablised in Rust, we'll switch to that.
Lists
Many APIs in the Chef Server return a list of items. Models will try to
convert those lists in to Iterator
s:
use ;
use NodeList;
let client = from_credentials?;
let nodes: NodeList = client.nodes.get?.into;
for n in nodes