Expand description
§DSH resource management API
This crate contains functions and definitions that provide support for using the functions of the DSH resource management API. The crate was originally developed as part of the dcli tool, but has now been promoted to a separate library.
§Examples
§Minimal example
The first minimal example will print a list of all the applications that are deployed in a tenant environment. This example requires that the tenant’s name, group id, user id, platform and API password are configured via environment variables.
use dsh_api::dsh_api_client_factory::DEFAULT_DSH_API_CLIENT_FACTORY;
let client = &DEFAULT_DSH_API_CLIENT_FACTORY.client().await?;
for (application_id, application) in client.list_applications()? {
println!("{} -> {}", application_id, application);
}§More elaborate example
In the next, more elaborate example, these tenant parameters are given explicitly.
This example will list all the applications in the tenant environment that have been
configured to require a token in order to access the Kafka broker.
This is accomplished via the find_applications()
methods, that returns a list of all applications for which the provided predicate
evaluates to true.
use dsh_api::dsh_api_client_factory::DshApiClientFactory;
use dsh_api::dsh_api_tenant::DshApiTenant;
use dsh_api::platform::DshPlatform;
use dsh_api::types::Application;
let tenant = DshApiTenant::new(
"my-tenant".to_string(),
1234,
DshPlatform::try_from("np-aws-lz-dsh")?
);
let password = "...".to_string();
let client_factory = DshApiClientFactory::create(tenant, password)?;
let client = client_factory.client().await?;
let predicate = |application: &Application| application.needs_token;
let applications = client.find_applications(&predicate).await?;
for (_, application) in applications {
println!("{}", application);
}§Features
The following features are defined:
actual- When this feature is enabled the library will include all the “actual” method versions of the REST API. By default, these methods will not be included.generic- When this feature is enabled the library will also include the generic methods. This feature is disabled by default.
Modules§
- app
- Manage apps in the App Catalog
- app_
configuration - Manage the App Catalog
- app_
manifest - View the App Catalog manifests
- application
- Manage applications
- bucket
- Manage buckets
- certificate
- Manage certificates
- display
- Display implementations for selected types
- dsh_
api_ client - Client for accessing the DSH api
- dsh_
api_ client_ factory - Factory for DSH API client
- dsh_
api_ tenant - Client tenant
- generic
- Generic API function calls
- platform
- Defines DSH platforms and their properties
- proxy
- Manage proxies
- query_
processor - Enums, traits and structs used by the various find methods.
- secret
- Manage secrets
- topic
- Manage Kafka topics
- types
- Types generated from openapi file
- vhost
- Manage vhosts
- volume
- Manage volumes
Enums§
- DshApi
Error - Enumeration of the recognized api errors
- Injection
- Enumeration that denotes an injection of a resource
- UsedBy
- Enumeration that denotes where a resource has been used
Constants§
- ENV_
VAR_ PLATFORM - Environment variable used to define the target platform
- ENV_
VAR_ PLATFORMS_ FILE_ NAME - Environment variable used to specify the name of a file with an alternative list of platforms
- ENV_
VAR_ TENANT - Environment variable used to define the client tenant
Statics§
- DEFAULT_
PLATFORMS - Specification of default platforms
- OPENAPI_
SPEC - Openapi specification version 1.9.0
Functions§
- api_
version - Returns the version of the openapi spec
- crate_
version - Returns the version of the lib crate
- guid_
environment_ variable - Create client tenant guid environment variable
- password_
environment_ variable - Create client password environment variable
- password_
file_ environment_ variable - Create client password file environment variable
Type Aliases§
- DshApi
Result - Generic result type