#sdk #logging #metrics #clevercloud #jsonschemas

clevercloud-sdk

A rust client and structures to interact with the Clever-Cloud API

22 releases (9 breaking)

Uses new Rust 2021

new 0.10.5 Jul 1, 2022
0.10.2 May 27, 2022
0.8.0 Mar 30, 2022
0.5.2 Dec 13, 2021
0.5.1 Nov 22, 2021

#58 in Testing

Download history 59/week @ 2022-03-15 135/week @ 2022-03-22 22/week @ 2022-03-29 248/week @ 2022-04-05 15/week @ 2022-04-12 11/week @ 2022-04-19 115/week @ 2022-04-26 120/week @ 2022-05-03 256/week @ 2022-05-10 163/week @ 2022-05-17 154/week @ 2022-05-24 234/week @ 2022-05-31 46/week @ 2022-06-07 17/week @ 2022-06-14 18/week @ 2022-06-21 38/week @ 2022-06-28

139 downloads per month

Custom license

56KB
1.5K SLoC

Clever-Cloud Software Development Kit - Rust edition

crates.io Released API docs Continuous integration

This crate provides structures and client to interact with the Clever-Cloud API.

Status

This crate is under development, you can use it, but it may have bugs or unimplemented features.

Installation

To install this dependency, just add the following line to your Cargo.toml manifest.

clevercloud-sdk = { version = "^0.10.5", features = ["metrics", "jsonschemas"] }

Usage

Below, you will find an example of executing a request to get information about myself.

use std::error::Error;

use clevercloud_sdk::{Client, v2::myself::{self, Myself}};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
    let client = Client::from(Credentials {
        token: "".to_string(),
        secret: "".to_string(),
        consumer_key: "".to_string(),
        consumer_secret: "".to_string(),
    });

    let _myself: Myself = myself::get(&client).await?;

    Ok(())
}

You could found more examples of how you could use the clevercloud-sdk by looking at the command line example.

Features

name description
trace Use tracing crate to expose traces
tokio Use tokio crate as back-end for tracing crate
jsonschemas Use schemars to add a derive instruction to generate json schemas representation of structures
logging Use the log facility crate to print logs. Implies oauth10a/logging feature
metrics Use lazy_static and prometheus crates to register metrics. Implies oauth10a/metrics feature

Metrics

Below, the exposed metrics gathered by prometheus:

name labels kind description
oauth10a_client_request endpoint: String, method: String, status: Integer Counter number of request on api
oauth10a_client_request_duration endpoint: String, method: String, status: Integer, unit: String Counter duration of request on api

License

See the license.

Getting in touch

Dependencies

~5–12MB
~203K SLoC