Expand description
§DSH API client
The struct DshApiClient is the base of this library and has many associated methods
that you can use to call the operations of the DSH resource management API.
In order to use these methods, you first need to acquire an instance of this struct. This is a two-step process.
- First you need to get a
DshApiClientFactory:- Either use the
DshApiClientFactory::default(), method, which is configured from environment variables, - or you can create a factory explicitly by providing the
platform,tenantand APIpasswordyourself and feeding them to theDshApiClientFactory::create()function.
- Either use the
- Once you have the
DshApiClientFactory, you can call itsclient()method.
You can now call the client’s methods to interact with the DSH resource management API.
§Example
This example will print a list of all the applications that are deployed in a tenant environment. This example requires that the tenant’s name, platform and API password are configured via environment variables.
ⓘ
use dsh_api::dsh_api_client_factory::DshApiClientFactory;
let client = DshApiClientFactory::default().client().await?;
for (application_id, application) in client.list_applications()? {
println!("{} -> {}", application_id, application);
}