Skip to content

generated clients sketch #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 174 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ panic = "abort"
#[patch."https://github.com/oxidecomputer/steno"]
#steno = { path = "../steno" }

#
# Local client generation during development.
#
#[patch."https://github.com/oxidecomputer/progenitor"]
#progenitor = { path = "../progenitor/progenitor" }
#[patch."https://github.com/oxidecomputer/typify"]
#typify = { path = "../typify/typify" }

#
# We maintain a fork of pq-sys to address upstream issues. See the
# README.oxide.md in the "oxide" branch of our fork for details.
#
[patch.crates-io.pq-sys]
git = 'https://github.com/oxidecomputer/pq-sys'
branch = "oxide/omicron"

2 changes: 2 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ tempfile = "3.0"
thiserror = "1.0"
toml = "0.5.6"
walkdir = "2.3"
progenitor = { git = "https://github.com/oxidecomputer/progenitor" }
percent-encoding = "2.1.0"

[dependencies.api_identity]
path = "src/api/external/api_identity"
Expand Down
1 change: 1 addition & 0 deletions common/src/api/external/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ mod test {

#[test]
fn test_bail_unless() {
#![allow(clippy::eq_op)]
/* Success cases */
let no_bail = || {
bail_unless!(1 + 1 == 2, "wrong answer: {}", 3);
Expand Down
26 changes: 22 additions & 4 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,33 @@ pub mod api;
pub mod backoff;
pub mod cmd;
pub mod config;
pub mod http_client;
pub mod packaging;

mod sled_agent_client;
macro_rules! generate_logging_api {
($path:literal) => {
progenitor::generate_api!(
$path,
slog::Logger,
|log: &slog::Logger, request: &reqwest::Request| {
debug!(log, "client request";
"method" => %request.method(),
"uri" => %request.url(),
"body" => ?&request.body(),
);
},
|log: &slog::Logger, result: &Result<_, _>| {
debug!(log, "client response"; "result" => ?result);
},
);
};
}

pub mod sled_agent_client;
pub use sled_agent_client::Client as SledAgentClient;
pub use sled_agent_client::TestInterfaces as SledAgentTestInterfaces;
mod nexus_client;
pub mod nexus_client;
pub use nexus_client::Client as NexusClient;
mod oximeter_client;
pub mod oximeter_client;
pub use oximeter_client::Client as OximeterClient;

#[macro_use]
Expand Down
Loading