pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(
lattice: &str,
prefix: Option<&str>,
opts: ClientConnectOptions,
) -> Result<Self>
pub async fn new( lattice: &str, prefix: Option<&str>, opts: ClientConnectOptions, ) -> Result<Self>
Creates a new client with the given lattice ID, optional API prefix, and connection options. Errors if it is unable to connect to the NATS server
Sourcepub async fn put_manifest(
&self,
manifest: impl ManifestLoader,
) -> Result<(String, String)>
pub async fn put_manifest( &self, manifest: impl ManifestLoader, ) -> Result<(String, String)>
Puts the given manifest into the lattice. The lattice can be anything that implements the
ManifestLoader
trait (a path to a file, raw bytes, or an already parsed manifest).
Returns the name and version of the manifest that was put into the lattice
Sourcepub async fn list_manifests(&self) -> Result<Vec<ModelSummary>>
pub async fn list_manifests(&self) -> Result<Vec<ModelSummary>>
Gets a list of all manifests in the lattice. This does not return the full manifest, just a summary of its metadata and status
Sourcepub async fn get_manifest(
&self,
name: &str,
version: Option<&str>,
) -> Result<Manifest>
pub async fn get_manifest( &self, name: &str, version: Option<&str>, ) -> Result<Manifest>
Gets a manifest from the lattice by name and optionally its version. If no version is set, the latest version will be returned
Sourcepub async fn delete_manifest(
&self,
name: &str,
version: Option<&str>,
) -> Result<bool>
pub async fn delete_manifest( &self, name: &str, version: Option<&str>, ) -> Result<bool>
Deletes a manifest from the lattice by name and optionally its version. If no version is set, all versions will be deleted
Returns true if the manifest was deleted, false if it was a noop (meaning it wasn’t found or was already deleted)
Sourcepub async fn list_versions(&self, name: &str) -> Result<Vec<VersionInfo>>
pub async fn list_versions(&self, name: &str) -> Result<Vec<VersionInfo>>
Gets a list of all versions of a manifest in the lattice
Sourcepub async fn deploy_manifest(
&self,
name: &str,
version: Option<&str>,
) -> Result<(String, Option<String>)>
pub async fn deploy_manifest( &self, name: &str, version: Option<&str>, ) -> Result<(String, Option<String>)>
Deploys a manifest to the lattice. The optional version parameter can be used to deploy a specific version of a manifest. If no version is set, the latest version will be deployed
Please note that an OK response does not necessarily mean that the manifest was deployed successfully, just that the server accepted the deployment request.
Returns a tuple of the name and version of the manifest that was deployed
Sourcepub async fn put_and_deploy_manifest(
&self,
manifest: impl ManifestLoader,
) -> Result<(String, String)>
pub async fn put_and_deploy_manifest( &self, manifest: impl ManifestLoader, ) -> Result<(String, String)>
A shorthand method that is the equivalent of calling put_manifest
and then deploy_manifest
Returns the name and version of the manifest that was deployed. Note that this will always deploy the latest version of the manifest (i.e. the one that was just put)
Sourcepub async fn undeploy_manifest(&self, name: &str) -> Result<String>
pub async fn undeploy_manifest(&self, name: &str) -> Result<String>
Undeploys the given manifest from the lattice
Returns Ok(manifest_name) if the manifest undeploy request was acknowledged
Sourcepub async fn get_manifest_status(&self, name: &str) -> Result<Status>
pub async fn get_manifest_status(&self, name: &str) -> Result<Status>
Gets the status of the given manifest