pub struct AdminWebsocket { /* private fields */ }
Implementations§
Source§impl AdminWebsocket
impl AdminWebsocket
Sourcepub async fn connect(socket_addr: impl ToSocketAddrs) -> Result<Self>
pub async fn connect(socket_addr: impl ToSocketAddrs) -> Result<Self>
Connect to a Conductor API AdminWebsocket.
socket_addr
is a websocket address that implements ToSocketAddr
.
See trait ToSocketAddr
.
§Examples
use std::net::Ipv4Addr;
let admin_ws = holochain_client::AdminWebsocket::connect((Ipv4Addr::LOCALHOST, 30_000)).await?;
As string "localhost:30000"
As tuple ([127.0.0.1], 30000)
Sourcepub async fn connect_with_config(
socket_addr: impl ToSocketAddrs,
websocket_config: Arc<WebsocketConfig>,
) -> Result<Self>
pub async fn connect_with_config( socket_addr: impl ToSocketAddrs, websocket_config: Arc<WebsocketConfig>, ) -> Result<Self>
Connect to a Conductor API AdminWebsocket with a custom WebsocketConfig.
Sourcepub async fn issue_app_auth_token(
&self,
payload: IssueAppAuthenticationTokenPayload,
) -> ConductorApiResult<AppAuthenticationTokenIssued>
pub async fn issue_app_auth_token( &self, payload: IssueAppAuthenticationTokenPayload, ) -> ConductorApiResult<AppAuthenticationTokenIssued>
Issue an app authentication token for the specified app.
A token is required to create an [AppAgentWebsocket] connection.
pub async fn generate_agent_pub_key(&self) -> ConductorApiResult<AgentPubKey>
pub async fn revoke_agent_key( &self, app_id: String, agent_key: AgentPubKey, ) -> ConductorApiResult<Vec<(CellId, String)>>
Sourcepub async fn list_app_interfaces(
&self,
) -> ConductorApiResult<Vec<AppInterfaceInfo>>
pub async fn list_app_interfaces( &self, ) -> ConductorApiResult<Vec<AppInterfaceInfo>>
List all app interfaces attached to the conductor.
See the documentation for AdminWebsocket::attach_app_interface to understand the content
of AppInterfaceInfo
and help you to select an appropriate interface to connect to.
Sourcepub async fn attach_app_interface(
&self,
port: u16,
allowed_origins: AllowedOrigins,
installed_app_id: Option<String>,
) -> ConductorApiResult<u16>
pub async fn attach_app_interface( &self, port: u16, allowed_origins: AllowedOrigins, installed_app_id: Option<String>, ) -> ConductorApiResult<u16>
Attach an app interface to the conductor.
This will create a new websocket on the specified port. Alternatively, specify the port as 0 to allow the OS to choose a port. The selected port will be returned so you know where to connect your app client.
Allowed origins can be used to restrict which domains can connect to the interface.
This is used to protect the interface from scripts running in web pages. In development it
is acceptable to use AllowedOrigins::All
to allow all connections. In production you
should consider setting an explicit list of origins, such as "my_cli_app".to_string().into()
.
If you want to restrict this app interface so that it is only accessible to a specific
installed app then you can provide the installed_app_id. The client will still need to
authenticate with a valid token for the same app, but clients for other apps will not be
able to connect. If you want to allow all apps to connect then set this to None
.
pub async fn list_apps( &self, status_filter: Option<AppStatusFilter>, ) -> ConductorApiResult<Vec<AppInfo>>
pub async fn install_app( &self, payload: InstallAppPayload, ) -> ConductorApiResult<AppInfo>
pub async fn uninstall_app( &self, installed_app_id: String, force: bool, ) -> ConductorApiResult<()>
pub async fn enable_app( &self, installed_app_id: String, ) -> ConductorApiResult<EnableAppResponse>
pub async fn disable_app( &self, installed_app_id: String, ) -> ConductorApiResult<()>
pub async fn list_cell_ids(&self) -> ConductorApiResult<Vec<CellId>>
pub async fn get_dna_definition( &self, hash: DnaHash, ) -> ConductorApiResult<DnaDef>
pub async fn get_compatible_cells( &self, dna_hash: DnaHash, ) -> ConductorApiResult<CompatibleCells>
pub async fn grant_zome_call_capability( &self, payload: GrantZomeCallCapabilityPayload, ) -> ConductorApiResult<()>
pub async fn delete_clone_cell( &self, payload: DeleteCloneCellPayload, ) -> ConductorApiResult<()>
pub async fn storage_info(&self) -> ConductorApiResult<StorageInfo>
pub async fn dump_network_stats(&self) -> ConductorApiResult<String>
pub async fn update_coordinators( &self, update_coordinators_payload: UpdateCoordinatorsPayload, ) -> ConductorApiResult<()>
pub async fn graft_records( &self, cell_id: CellId, validate: bool, records: Vec<Record>, ) -> ConductorApiResult<()>
pub async fn agent_info( &self, cell_id: Option<CellId>, ) -> ConductorApiResult<Vec<AgentInfoSigned>>
pub async fn add_agent_info( &self, agent_infos: Vec<AgentInfoSigned>, ) -> ConductorApiResult<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdminWebsocket
impl RefUnwindSafe for AdminWebsocket
impl Send for AdminWebsocket
impl Sync for AdminWebsocket
impl Unpin for AdminWebsocket
impl UnwindSafe for AdminWebsocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.