Module generic

Source
Expand description

§Generic API function calls

These functions are only available when the generic feature is enabled.

Module that contains methods to call the API methods in a generic way. What this means is that the API functions can be called indirect, where the path of the method must be provided as an argument.

This has a number of consequences, which are caused by the limitations of the rust language with respect to abstraction:

  • The number and types of the required parameters for each method are not known at compile time, which means that (emulated) dynamic typing is used and parameter errors will occur at run-time instead of compile time.
    • Path parameters must be provided as &str.
    • Body parameters must be provided as a json formatted String that can be deserialized at run-time into the expected type.
  • The response type for each method is not known at compile time.
    • For GET methods the responses will be returned as dynamic trait objects that implement erased_serde::Serialize, defined in the erased_serde crate. These objects can be serialized into json, yaml or toml without any type information.
    • If DELETE, HEAD, PATCH, POST and PUT methods return data this will be ignored and only errors will be returned.

§Examples

Get the configuration of the application my-application and print it as json.

let application = client.get("application_configuration", &["my-application"]).await?;
println!("{}", serde_json::to_string_pretty(&application)?);

Update the secret abcdef to the value ABCDEF.

 let secret = serde_json::to_string("ABCDEF")?;
 client.put("put_secret_by_tenant_by_id", &["abcdef"], &secret).await?;

§API functions

DshApiClient methods that call the DSH resource management API.

Structs§

MethodDescriptor
Describes one method

Constants§

DELETE_METHODS
delete method descriptors
GET_METHODS
get method descriptors
HEAD_METHODS
head method descriptors
PATCH_METHODS
patch method descriptors
POST_METHODS
post method descriptors
PUT_METHODS
put method descriptors