We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i need the members' is_leader attribute, can you add it to the result of members::list(&client)?
members::list(&client)
The text was updated successfully, but these errors were encountered:
@jimmycuadra Or just add members::leader(&client) for getting leader, url is /v2/members/leader
members::leader(&client)
/v2/members/leader
Sorry, something went wrong.
I solved it by adding this function into member.rs :)
/// Leader of members /// /// # Parameters /// /// * client: A `Client` to use to make the API call. pub fn leader<C>( client: &Client<C>, ) -> impl Future<Item = Response<Member>, Error = Vec<Error>> + Send where C: Clone + Connect, { let http_client = client.http_client().clone(); first_ok(client.endpoints().to_vec(), move |member| { let url = build_url(member, "/leader"); let uri = Uri::from_str(url.as_str()) .map_err(Error::from) .into_future(); println!("uri: {:?}", uri); let http_client = http_client.clone(); let response = uri.and_then(move |uri| http_client.get(uri).map_err(Error::from)); response.and_then(|response| { let status = response.status(); let cluster_info = ClusterInfo::from(response.headers()); let body = response.into_body().concat2().map_err(Error::from); body.and_then(move |ref body| { if status == StatusCode::OK { match serde_json::from_slice::<Member>(body) { Ok(data) => { /* for member in data.members { println!(""); } */ println!("data: {:?}", data); Ok(Response { data: data, cluster_info, }) }, Err(error) => Err(Error::Serialization(error)), } } else { match serde_json::from_slice::<ApiError>(body) { Ok(error) => Err(Error::Api(error)), Err(error) => Err(Error::Serialization(error)), } } }) }) }) }
No branches or pull requests
i need the members' is_leader attribute, can you add it to the result of
members::list(&client)
?The text was updated successfully, but these errors were encountered: