Expand description
§DSH API client factory
This module provides factories for creating DshApiClient instances,
based on the platform and the tenant’s name.
These parameters can either be provided via environment variables
or via explicit function arguments.
There are two factory types, DshApiClientFactory and DshApiPlatformClientFactory.
§DshApiClientFactory
- Single platform and single tenant.
- Authentication and authorization using robot password or single-sign-on pattern.
- Token fetcher supports long-lived applications.
- Each created client has its own rest-client which might result in prblems when a large number of requests are made simultaneously..
§DshApiPlatformClientFactory
- Single platform and one or more tenants.
- Authentication and authorization using single-sign-on pattern.
- Access token can expire so applicable for short-lived applications only.
- Created clients share one rest-client, which improves performance when a large number of requests are made simultaneously.
Once you have created a client factory you can use its methods to get a DshApiClient
instance. The clients generated by either type of factory are functionally the same.
§Example
In this example explicit tenant parameters are used to create a DshApiClientFactory and a
DshApiClient.
ⓘ
let tenant = DshApiTenant::new("my-tenant", DshPlatform::new("nplz"));
let password = "...";
let client_factory = DshApiClientFactory::create_with_token_factory(tenant, password)?;
let client = client_factory.client().await?;
...Structs§
- DshApi
Client Factory - DSH API client factory
- DshApi
Platform Client Factory - Platform factory for DSH API client