Struct consul_rs::api::ConsulConfig [−][src]
pub struct ConsulConfig {
pub config: Option<Config>,
pub watch_services: Option<Vec<WatchService>>,
}Fields
config: Option<Config>watch_services: Option<Vec<WatchService>>Implementations
pub async fn service_register(
&self,
service: &AgentServiceRegistration
) -> Result<StatusCode>
pub async fn service_register(
&self,
service: &AgentServiceRegistration
) -> Result<StatusCode>service_register is used to register a new service with the local agent
use consul_rs::api::CONSUL_CONFIG; use async_std::task::block_on; use consul_rs::agent::AgentServiceRegistration; let clone_consul = CONSUL_CONFIG.clone(); let consul = block_on(clone_consul.read()); let mut service = AgentServiceRegistration::default(); service.ID = Some(String::from("321")); service.Name = Some(String::from("test")); service.Port = Some(8080); service.Address = Some(String::from("127.0.0.1")); let s = block_on(consul.service_register(&service)).unwrap(); println!("{}", s);
pub async fn service_register_opts(
&self,
service: &AgentServiceRegistration,
opts: &ServiceRegisterOpts
) -> Result<StatusCode>pub async fn service_register_self(
&self,
service: &AgentServiceRegistration,
opts: &ServiceRegisterOpts
) -> Result<StatusCode>service_deregister is used to register a new service with the local agent
use consul_rs::api::CONSUL_CONFIG; use async_std::task::block_on; use consul_rs::ConsulTrait; use consul_rs::agent::AgentServiceRegistration; let clone_consul = CONSUL_CONFIG.clone(); let consul = block_on(clone_consul.read()); let service_id = String::from("321"); let s = block_on(consul.service_deregister(service_id)).unwrap(); println!("{}", s);
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for ConsulConfigimpl Send for ConsulConfigimpl Sync for ConsulConfigimpl Unpin for ConsulConfigimpl UnwindSafe for ConsulConfigBlanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = TShould always be Self
pub fn vzip(self) -> VAttaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more