[][src]Struct bodhi::service::BodhiServiceBuilder

pub struct BodhiServiceBuilder<'a> { /* fields omitted */ }

This struct contains information necessary to build an instance of BodhiService with the necessary flags. Additionally, depending on whether username and password were supplied as arguments, building the service instance will try to return a privileged session by authenticating via the fedora OpenID endpoint first.

It's possible to target either the fedora production or the staging instances of bodhi, or provide a custom URL, via the default(), staging(), and custom() methods, respectively.

// create service with anonymous session
let bodhi = bodhi::BodhiServiceBuilder::default()
    .timeout(std::time::Duration::from_secs(42))
    .retries(9001)
    .build();
// builder for an authenticated session
let builder = bodhi::BodhiServiceBuilder::staging()
    .timeout(std::time::Duration::from_secs(120))
    .retries(2)
    .authentication("bodhi-rs", "password1");
// builder.build();

Methods

impl<'a> BodhiServiceBuilder<'a>[src]

pub fn default() -> Self[src]

This method creates a new builder for the "production" instances of the fedora services.

pub fn staging() -> Self[src]

This method creates a new builder for the "staging" instances of the fedora services.

pub fn custom(url: String, openid_url: String) -> Self[src]

This method creates a custom builder, where both bodhi URL and authentication endpoint need to be specified manually.

pub fn timeout(self, timeout: Duration) -> Self[src]

This method can be used to override the default request timeout.

pub fn retries(self, retries: usize) -> Self[src]

This method can be used to override the default number of retries.

pub fn authentication(self, username: &'a str, password: &'a str) -> Self[src]

This method can be used to set credentials for authenticating with the fedora OpenID endpoint, so the resulting BodhiService can be used to send authenticated requests for creating and editing things on the server.

pub fn build(self) -> Result<BodhiService, BuilderError>[src]

This method builds a BodhiService given the arguments that were supplied to this BodhiServiceBuilder, including an attempt to authenticate with the fedora OpenID endpoint if credentials have been supplied.

Trait Implementations

impl<'a> Debug for BodhiServiceBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for BodhiServiceBuilder<'a>

impl<'a> Send for BodhiServiceBuilder<'a>

impl<'a> Sync for BodhiServiceBuilder<'a>

impl<'a> Unpin for BodhiServiceBuilder<'a>

impl<'a> UnwindSafe for BodhiServiceBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.