-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[repo depot 2/n] sled agent APIs to manage update artifact storage (#…
- Loading branch information
Showing
24 changed files
with
1,567 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "repo-depot-client" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MPL-2.0" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
omicron-workspace-hack.workspace = true | ||
progenitor.workspace = true | ||
reqwest.workspace = true | ||
schemars.workspace = true | ||
serde.workspace = true | ||
slog.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! Interface for Sled Agent's Repo Depot to make API requests. | ||
progenitor::generate_api!( | ||
spec = "../../openapi/repo-depot.json", | ||
inner_type = slog::Logger, | ||
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| { | ||
slog::debug!(log, "client request"; | ||
"method" => %request.method(), | ||
"uri" => %request.url(), | ||
"body" => ?&request.body(), | ||
); | ||
}), | ||
post_hook = (|log: &slog::Logger, result: &Result<_, _>| { | ||
slog::debug!(log, "client response"; "result" => ?result); | ||
}), | ||
derives = [schemars::JsonSchema], | ||
); | ||
|
||
/// A type alias for errors returned by this crate. | ||
pub type ClientError = crate::Error<crate::types::Error>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "Oxide TUF Repo Depot API", | ||
"description": "API for fetching update artifacts", | ||
"contact": { | ||
"url": "https://oxide.computer", | ||
"email": "[email protected]" | ||
}, | ||
"version": "0.0.1" | ||
}, | ||
"paths": { | ||
"/artifact/sha256/{sha256}": { | ||
"get": { | ||
"summary": "Fetch an artifact from the depot.", | ||
"operationId": "artifact_get_by_sha256", | ||
"parameters": [ | ||
{ | ||
"in": "path", | ||
"name": "sha256", | ||
"required": true, | ||
"schema": { | ||
"type": "string", | ||
"format": "hex string (32 bytes)" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "", | ||
"content": { | ||
"*/*": { | ||
"schema": {} | ||
} | ||
} | ||
}, | ||
"4XX": { | ||
"$ref": "#/components/responses/Error" | ||
}, | ||
"5XX": { | ||
"$ref": "#/components/responses/Error" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Error": { | ||
"description": "Error information from a response.", | ||
"type": "object", | ||
"properties": { | ||
"error_code": { | ||
"type": "string" | ||
}, | ||
"message": { | ||
"type": "string" | ||
}, | ||
"request_id": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"message", | ||
"request_id" | ||
] | ||
} | ||
}, | ||
"responses": { | ||
"Error": { | ||
"description": "Error", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Error" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.