-
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.
[wicketd] add stub API for fetching artifacts (#1998)
Add a basic stub API for fetching artifacts, and update the OpenAPI schema. The implementation hasn't been filled out yet.
- Loading branch information
1 parent
41d0fed
commit 3257446
Showing
5 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
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,40 @@ | ||
// 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/. | ||
|
||
// Copyright 2022 Oxide Computer Company | ||
|
||
use hyper::body::Bytes; | ||
use schemars::JsonSchema; | ||
use serde::Deserialize; | ||
use slog::Logger; | ||
|
||
/// Path parameters for Silo requests | ||
#[derive(Clone, Debug, Deserialize, JsonSchema)] | ||
#[allow(dead_code)] | ||
pub(crate) struct ArtifactId { | ||
/// The artifact's name. | ||
pub(crate) name: String, | ||
|
||
/// The version of the artifact. | ||
pub(crate) version: String, | ||
} | ||
|
||
/// The artifact store, used to cache artifacts. | ||
pub struct ArtifactStore { | ||
log: Logger, | ||
// TODO: implement this | ||
} | ||
|
||
impl ArtifactStore { | ||
pub(crate) fn new(log: &Logger) -> Self { | ||
let log = log.new(slog::o!("component" => "wicketd artifact store")); | ||
Self { log } | ||
} | ||
|
||
pub(crate) fn get_artifact(&self, id: &ArtifactId) -> Option<Bytes> { | ||
slog::debug!(self.log, "Artifact requested (this is a stub implementation which always 404s): {:?}", id); | ||
// TODO: implement this | ||
None | ||
} | ||
} |
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