Skip to content

Commit 12d2ef1

Browse files
committed
build: bump oauth10
1 parent c7d7cb8 commit 12d2ef1

File tree

32 files changed

+1001
-942
lines changed

32 files changed

+1001
-942
lines changed

Cargo.toml

100644100755
Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clevercloud-sdk"
3-
description = "A rust client and structures to interact with the Clever-Cloud API."
3+
description = "A Rust client and structures to interact with the Clever-Cloud API."
44
version = "0.15.0"
55
edition = "2024"
66
rust-version = "1.85.0"
@@ -12,12 +12,26 @@ keywords = ["clevercloud", "sdk", "logging", "metrics", "jsonschemas"]
1212

1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

15+
[features]
16+
default = ["logging"]
17+
jsonschemas = ["dep:schemars"]
18+
logging = ["dep:log", "oauth10a/logging", "tracing/log-always"]
19+
metrics = ["oauth10a/metrics"]
20+
tracing = ["oauth10a/tracing", "dep:tracing"]
21+
network-group = ["dep:base64", "x25519-dalek", "dep:rand_core", "dep:zeroize"]
22+
1523
[dependencies]
16-
chrono = { version = "^0.4.40", features = ["serde"] }
17-
oauth10a = { version = "^2.1.1", default-features = false, features = [
24+
base64 = { version = "^0.22.1", optional = true }
25+
chrono = { version = "^0.4.41", features = ["serde"] }
26+
oauth10a = { version = "^3.0.0", default-features = false, features = [
1827
"client",
28+
"serde",
29+
"rest",
30+
"sse",
31+
"zeroize",
1932
] }
20-
log = { version = "^0.4.26", optional = true }
33+
log = { version = "^0.4.27", optional = true }
34+
rand_core = { version = "^0.9.3", features = ["os_rng"], optional = true }
2135
schemars = { version = "^0.8.22", features = [
2236
"chrono",
2337
"indexmap1",
@@ -30,11 +44,12 @@ serde_repr = "^0.1.20"
3044
serde_json = "^1.0.140"
3145
thiserror = "^2.0.12"
3246
tracing = { version = "^0.1.41", optional = true }
33-
uuid = { version = "^1.16.0", features = ["serde", "v4"] }
34-
35-
[features]
36-
default = ["logging"]
37-
jsonschemas = ["schemars"]
38-
logging = ["oauth10a/logging", "tracing/log-always", "log"]
39-
metrics = ["oauth10a/metrics"]
40-
tracing = ["oauth10a/tracing", "dep:tracing"]
47+
uuid = { version = "^1.17.0", features = ["serde", "v4"] }
48+
x25519-dalek = { version = "^2.0.1", features = [
49+
"zeroize",
50+
"static_secrets",
51+
], optional = true }
52+
zeroize = { version = "^1.8.1", features = [
53+
"serde",
54+
"derive",
55+
], optional = true }

README.md

100644100755
Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![Released API docs](https://docs.rs/clevercloud-sdk/badge.svg)](https://docs.rs/clevercloud-sdk)
55
[![Continuous integration](https://github.com/CleverCloud/clevercloud-sdk-rust/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/CleverCloud/clevercloud-sdk-rust/actions/workflows/ci.yml)
66

7-
> This crate provides structures and a client to interact with the Clever-Cloud
8-
> API.
7+
> This crate provides structures and a client to interact with the Clever-Cloud API.
98
109
## Status
1110

@@ -25,17 +24,19 @@ Below, you will find an example of executing a request to get information about
2524
myself.
2625

2726
```rust
28-
use std::error::Error;
29-
30-
use clevercloud_sdk::{Client, v2::myself::{self, Myself}};
27+
use clevercloud_sdk::{
28+
Client,
29+
oauth10a::credentials::Credentials,
30+
v2::myself::{self, Myself},
31+
};
3132

3233
#[tokio::main]
33-
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
34-
let client = Client::from(Credentials {
35-
token: "".to_string(),
36-
secret: "".to_string(),
37-
consumer_key: "".to_string(),
38-
consumer_secret: "".to_string(),
34+
async fn main() -> Result<(), Box<dyn core::error::Error + Send + Sync>> {
35+
let client = Client::from(Credentials::OAuth1 {
36+
token: "",
37+
secret: "",
38+
consumer_key: "",
39+
consumer_secret: "",
3940
});
4041

4142
let _myself: Myself = myself::get(&client).await?;
@@ -48,21 +49,23 @@ You could found more examples of how you could use the clevercloud-sdk by lookin
4849

4950
## Features
5051

51-
| name | description |
52-
| ----------- |--------------------------------------------------------------------------------------------------|
53-
| trace | Use `tracing` crate to expose traces |
54-
| jsonschemas | Use `schemars` to add a derive instruction to generate json schemas representation of structures |
55-
| logging | Use the `log` facility crate to print logs. Implies `oauth10a/logging` feature |
56-
| metrics | Expose HTTP metrics through `oauth10a` crate feature. |
52+
| name | description |
53+
| ------------- |--------------------------------------------------------------------------------------------------|
54+
| trace | Use `tracing` crate to expose traces |
55+
| jsonschemas | Use `schemars` to add a derive instruction to generate json schemas representation of structures |
56+
| logging | Use the `log` facility crate to print logs. Implies `oauth10a/logging` feature |
57+
| metrics | Expose HTTP metrics through `oauth10a` crate feature. |
58+
| network-group | Enables Clever-Cloud Network Group API. |
5759

5860
### Metrics
5961

6062
Below, the exposed metrics gathered by prometheus:
6163

62-
| name | labels | kind | description |
63-
| -------------------------------- | --------------------------------------------------------------- | ------- | -------------------------- |
64-
| oauth10a_client_request | endpoint: String, method: String, status: Integer | Counter | number of request on api |
65-
| oauth10a_client_request_duration | endpoint: String, method: String, status: Integer, unit: String | Counter | duration of request on api |
64+
| name | labels | kind | description |
65+
| -------------------------------- | --------------------------------------------------------------- | ------- | ---------------------------------- |
66+
| oauth10a_client_request | endpoint: String, method: String, status: Integer | Counter | number of request on API |
67+
| oauth10a_client_request_duration | endpoint: String, method: String, status: Integer, unit: String | Counter | duration of request on API |
68+
| oauth10a_client_sse | endpoint: String | Counter | number of events received from API |
6669

6770
## License
6871

examples/cleverctl/src/cfg.rs

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
55
use std::path::PathBuf;
66

7-
use clevercloud_sdk::Credentials;
7+
use clevercloud_sdk::oauth10a::credentials::Credentials;
88
use config::{Config, ConfigError, File};
99
use serde::{Deserialize, Serialize};
1010

1111
// -----------------------------------------------------------------------------
1212
// Error enumeration
1313

14-
#[derive(thiserror::Error, Debug)]
14+
#[derive(Debug, thiserror::Error)]
1515
pub enum Error {
1616
#[error("failed to load configuration from file '{0}', {1}")]
1717
LoadConfiguration(String, ConfigError),
@@ -24,7 +24,7 @@ pub enum Error {
2424
// -----------------------------------------------------------------------------
2525
// Configuration structure
2626

27-
#[derive(Serialize, Deserialize, Eq, PartialEq, Clone, Debug)]
27+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2828
pub struct Configuration {
2929
#[serde(rename = "credentials", flatten)]
3030
pub credentials: Credentials,

examples/cleverctl/src/cmd/addon/config_provider/environment.rs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
// -----------------------------------------------------------------------------
1717
// Error enumeration
1818

19-
#[derive(thiserror::Error, Debug)]
19+
#[derive(Debug, thiserror::Error)]
2020
pub enum Error {
2121
#[error("failed to format output, {0}")]
2222
FormatOutput(Box<cmd::Error>),
@@ -37,7 +37,7 @@ pub enum Error {
3737
// -----------------------------------------------------------------------------
3838
// Environment enumeration
3939

40-
#[derive(Subcommand, PartialEq, Eq, Clone, Debug)]
40+
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
4141
pub enum Environment {
4242
#[clap(name = "get", about = "Get environment variables")]
4343
Get {

examples/cleverctl/src/cmd/addon/config_provider/mod.rs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub mod environment;
1616
// -----------------------------------------------------------------------------
1717
// Error enumeration
1818

19-
#[derive(thiserror::Error, Debug)]
19+
#[derive(Debug, thiserror::Error)]
2020
pub enum Error {
2121
#[error("failed to execute command on config-provider environment, {0}")]
2222
Environment(environment::Error),
@@ -25,7 +25,7 @@ pub enum Error {
2525
// -----------------------------------------------------------------------------
2626
// ConfigProvider structure
2727

28-
#[derive(Subcommand, Eq, PartialEq, Clone, Debug)]
28+
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
2929
pub enum ConfigProvider {
3030
#[clap(name = "environment", aliases = &["env"], subcommand, about = "Interact with config-provider environment")]
3131
Environment(Environment),

examples/cleverctl/src/cmd/addon/mod.rs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub mod config_provider;
1616
// -----------------------------------------------------------------------------
1717
// Error enumeration
1818

19-
#[derive(thiserror::Error, Debug)]
19+
#[derive(Debug, thiserror::Error)]
2020
pub enum Error {
2121
#[error("failed to format output, {0}")]
2222
FormatOutput(Box<cmd::Error>),
@@ -33,7 +33,7 @@ pub enum Error {
3333
// -----------------------------------------------------------------------------
3434
// Addon enumeration
3535

36-
#[derive(Subcommand, Eq, PartialEq, Clone, Debug)]
36+
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
3737
pub enum Command {
3838
#[clap(name = "list", about = "List addons of an organisation")]
3939
List {

examples/cleverctl/src/cmd/functions/deployments.rs

100644100755
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
use std::{collections::BTreeMap, path::PathBuf, sync::Arc};
77

8-
use clap::Subcommand;
98
use clevercloud_sdk::{
109
Client,
1110
oauth10a::reqwest,
@@ -22,7 +21,7 @@ use crate::{
2221
// ----------------------------------------------------------------------------
2322
// Error
2423

25-
#[derive(thiserror::Error, Debug)]
24+
#[derive(Debug, thiserror::Error)]
2625
pub enum Error {
2726
#[error("failed to format output, {0}")]
2827
FormatOutput(Box<cmd::Error>),
@@ -49,7 +48,7 @@ pub enum Error {
4948
// ----------------------------------------------------------------------------
5049
// Command
5150

52-
#[derive(Subcommand, PartialEq, Eq, Clone, Debug)]
51+
#[derive(Debug, Clone, PartialEq, Eq, clap::Subcommand)]
5352
pub enum Command {
5453
#[clap(name = "list", aliases = &["l"], about = "List functions information of an organisation")]
5554
List {

examples/cleverctl/src/cmd/functions/mod.rs

100644100755
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! This module provides command implementation related to functions product
44
use std::{collections::BTreeMap, sync::Arc};
55

6-
use clap::Subcommand;
76
use clevercloud_sdk::{Client, oauth10a::reqwest, v4::functions};
87
use tracing::info;
98

@@ -23,7 +22,7 @@ pub const DEFAULT_MAX_MEMORY: u64 = 64 * 1024 * 1024;
2322
// -----------------------------------------------------------------------------
2423
// Error enumeration
2524

26-
#[derive(thiserror::Error, Debug)]
25+
#[derive(Debug, thiserror::Error)]
2726
pub enum Error {
2827
#[error("failed to format output, {0}")]
2928
FormatOutput(Box<cmd::Error>),
@@ -57,7 +56,7 @@ pub enum Error {
5756
// Command
5857

5958
/// Command enum contains all operations that could be achieved on the user
60-
#[derive(Subcommand, Eq, PartialEq, Clone, Debug)]
59+
#[derive(Debug, Clone, PartialEq, Eq, clap::Subcommand)]
6160
pub enum Command {
6261
#[clap(name = "list", aliases = &["l"], about = "List functions information of an organisation")]
6362
List {

examples/cleverctl/src/cmd/mod.rs

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod zone;
2525
// -----------------------------------------------------------------------------
2626
// Error enumeration
2727

28-
#[derive(thiserror::Error, Debug)]
28+
#[derive(Debug, thiserror::Error)]
2929
pub enum Error {
3030
#[error("failed to parse output '{0}', available options are 'json' or 'yaml'")]
3131
ParseOutput(String),
@@ -46,7 +46,7 @@ pub enum Error {
4646
// -----------------------------------------------------------------------------
4747
// Output enumeration
4848

49-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug, Default)]
49+
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
5050
pub enum Output {
5151
#[default]
5252
Json,
@@ -103,7 +103,7 @@ pub trait Executor {
103103
// Command enumeration
104104

105105
/// Command enum contains all operations that the command line could handle
106-
#[derive(Subcommand, Eq, PartialEq, Clone, Debug)]
106+
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
107107
pub enum Command {
108108
#[clap(name = "self", aliases = &["sel", "se", "s"], subcommand, about = "Interact with the current user")]
109109
Myself(myself::Command),
@@ -133,7 +133,7 @@ impl Executor for Command {
133133

134134
/// Args structure contains all commands and global flags that the command line
135135
/// supports
136-
#[derive(Parser, Eq, PartialEq, Clone, Debug)]
136+
#[derive(Debug, Clone, PartialEq, Eq, Parser)]
137137
#[clap(author, version, about)]
138138
pub struct Args {
139139
/// Specify a configuration file

examples/cleverctl/src/cmd/myself.rs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
// -----------------------------------------------------------------------------
1515
// Error enumeration
1616

17-
#[derive(thiserror::Error, Debug)]
17+
#[derive(Debug, thiserror::Error)]
1818
pub enum Error {
1919
#[error("failed to format output, {0}")]
2020
FormatOutput(Box<cmd::Error>),
@@ -28,7 +28,7 @@ pub enum Error {
2828
// Command enumeration
2929

3030
/// Command enum contains all operations that could be achieved on the user
31-
#[derive(Subcommand, Eq, PartialEq, Clone, Debug)]
31+
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
3232
pub enum Command {
3333
#[clap(name = "get", aliases = &["ge", "g"], about = "Get information about the current user")]
3434
Get {

0 commit comments

Comments
 (0)