pub struct Consul { /* private fields */ }Expand description
Client used to talk to a Consul server. All calls to the key/value API are automatically prefixed with an arbitrary string that is constructed at client creation.
Implementations§
Source§impl Consul
impl Consul
Sourcepub async fn catalog_node_list(
&self,
last_index: Option<usize>,
) -> Result<WithIndex<Vec<Node>>>
pub async fn catalog_node_list( &self, last_index: Option<usize>, ) -> Result<WithIndex<Vec<Node>>>
The “list nodes” API call of the Catalog API
https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes
Sourcepub async fn catalog_node(
&self,
host: &str,
last_index: Option<usize>,
) -> Result<WithIndex<Option<CatalogNode>>>
pub async fn catalog_node( &self, host: &str, last_index: Option<usize>, ) -> Result<WithIndex<Option<CatalogNode>>>
The “retrieve map of services for a node” API call of the Catalog API
https://developer.hashicorp.com/consul/api-docs/catalog#retrieve-map-of-services-for-a-node
Sourcepub async fn catalog_service_list(
&self,
last_index: Option<usize>,
) -> Result<WithIndex<ServiceList>>
pub async fn catalog_service_list( &self, last_index: Option<usize>, ) -> Result<WithIndex<ServiceList>>
The “list services” API call of the Catalog api
https://developer.hashicorp.com/consul/api-docs/catalog#list-services
Sourcepub async fn catalog_service_nodes(
&self,
service: &str,
last_index: Option<usize>,
) -> Result<WithIndex<Vec<ServiceNode>>>
pub async fn catalog_service_nodes( &self, service: &str, last_index: Option<usize>, ) -> Result<WithIndex<Vec<ServiceNode>>>
The “list nodes for a service” API call of the Catalog api
https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes-for-service
Sourcepub async fn health_service_instances(
&self,
service: &str,
last_index: Option<usize>,
) -> Result<WithIndex<Vec<HealthServiceNode>>>
pub async fn health_service_instances( &self, service: &str, last_index: Option<usize>, ) -> Result<WithIndex<Vec<HealthServiceNode>>>
The “list service instances for a service” API call of the Health api
https://developer.hashicorp.com/consul/api-docs/health#list-service-instances-for-service
Sourcepub fn watch_all_service_health(
&self,
max_retry_interval: Duration,
) -> Receiver<AllServiceHealth>
pub fn watch_all_service_health( &self, max_retry_interval: Duration, ) -> Receiver<AllServiceHealth>
Launches a background task that watches all services and the nodes that serve them, and make that info available in a tokio watch channel. The worker terminates when the channel is dropped.
Source§impl Consul
impl Consul
pub async fn kv_get(&self, key: &str) -> Result<Option<Bytes>>
pub async fn kv_get_json<T: for<'de> Deserialize<'de>>( &self, key: &str, ) -> Result<Option<T>>
pub async fn kv_get_prefix( &self, key_prefix: &str, last_index: Option<usize>, ) -> Result<WithIndex<HashMap<String, Bytes>>>
pub async fn kv_put(&self, key: &str, bytes: Bytes) -> Result<()>
pub async fn kv_put_json<T: Serialize>( &self, key: &str, value: &T, ) -> Result<()>
pub async fn kv_delete(&self, key: &str) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Consul
impl !RefUnwindSafe for Consul
impl Send for Consul
impl Sync for Consul
impl Unpin for Consul
impl !UnwindSafe for Consul
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)