[][src]Crate bodhi

This library provides a Rust-y wrapper around the bodhi REST API.

bodhi is the web service for managing updates for fedora-based linux distributions. It provides a REST API for querying its database, and for creating new updates, comments, etc.

The library is structured like this:

  • BodhiService, which contains all information related to connecting to a remote bodhi instance
  • a set of *Query structs and implementations for querying bodhi, which wrap the REST API with a Rust-y API
  • a set of Create implementations for creating new data on bodhi
  • a set of Edit implementations for editing data on bodhi
  • data type and enum definitions, used for (de)serializing JSON values with serde

Data type definitions

The data type definitions used for deserializing the server JSON responses are contained in the data module. Some definitions are used only internally (for example, for deserializing paginated results), and are not publicly exported. They are located next to the Query they are used for.

Rust API Convenience

For convenience, some enumerated types that are just strings in the actual REST API are wrapped as proper enum types, and queries that return paginated results are not exposed to users of this library, but handled completely internally to return a union of all result pages.

NOTE: Some Query modifiers can be called multiple times (methods marked with plural names), and other filters are mutually exclusive and should only be called once on a query (methods marked with singular name). If a filter that only allows one argument is called more than once, the last supplied argument will override arguments that were supplied to previous method calls.

Usage

To query a remote bodhi instance, first construct a BodhiService instance with the desired properties (server URL, request timeout, retry limit).

Then, construct the required queries, and run the query against the BodhiService instance. In theory, this would let you run the same query multiple times, possibly against different server instances or with different connection settings:

let bodhi = bodhi::BodhiServiceBuilder::default().build().unwrap();

let package_query = bodhi::PackageQuery::new().name("rust");

let packages = bodhi.query(package_query).unwrap();

Re-exports

pub use data::*;
pub use service::BodhiService;
pub use service::BodhiServiceBuilder;
pub use create::*;
pub use edit::*;
pub use query::*;

Modules

create

This module contains implementations for creating Comments, Overrides, and Updates on a bodhi instance. Creating Releases is possible with the REST API, but not implemented yet.

data

This module contains the data types that are needed to deserialize bodhi server responses which are also public outside this crate. Some internal data types for queries are implemented in the corresponding query module.

edit

This module contains implementations for editing Overrides and Updates on a bodhi instance. Editing Releases is possible with the REST API, but not implemented yet.

error

This module contains some common error types for wrapping networking-related issues, server-side issues, and client-side issues (including JSON deserialization problems).

query

This module contains all the REST API query wrappers that attempt to map the REST-y API to an idiomatic Rust API, using builder patterns to construct complex queries.

service

This module contains the structures and methods to interact with a (remote) bodhi server instance.