Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24327420
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/assets/favicon.ico b/assets/favicon.ico
deleted file mode 100644
index b8e002c..0000000
Binary files a/assets/favicon.ico and /dev/null differ
diff --git a/src/app.rs b/src/app.rs
index 1a3b213..5a9205f 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,19 +1,23 @@
//! Docker Registry API application entry point
use crate::requests::*;
use limiting_factor::kernel::MinimalApplication;
pub fn run () {
let routes = routes![
+ // Monitoring
status,
- favicon,
+
+ // /docker/registry
get_registry_stats,
+
+ // /docker/registry/repository
get_repository_info,
get_all_repositories,
find_repository_by_layer,
find_repository_by_image,
];
MinimalApplication::start_application(routes);
}
diff --git a/src/requests.rs b/src/requests.rs
index 5772cf9..4c09978 100644
--- a/src/requests.rs
+++ b/src/requests.rs
@@ -1,77 +1,71 @@
//!
//! HTTP requests handled by the microservice.
//!
use crate::registry::{Registry, Repository};
use limiting_factor::api::replies::*;
-use rocket::response::NamedFile;
#[get("/status")]
pub fn status() -> &'static str {
"ALIVE"
}
-#[get("/favicon.ico")]
-pub fn favicon() -> Option<NamedFile> {
- NamedFile::open("assets/favicon.ico").ok()
-}
-
// -------------------------------------------------------------
-// /registry
+// /docker/registry
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-#[get("/registry/stats")]
+#[get("/stats")]
pub fn get_registry_stats() -> ApiJsonResponse<Registry> {
Registry::with_default_location()
.into_json_response()
}
// -------------------------------------------------------------
-// /repository
+// /docker/registry/repository
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#[get("/repository/<repository_name>")]
pub fn get_repository_info(repository_name: String) -> ApiJsonResponse<Repository> {
let repository = Registry::with_default_location()
.get_repository(&repository_name);
match repository {
None => Err(build_bad_request_response()),
Some(repo) => {
if repo.exists() {
Ok(repo.into_json_response()?)
} else {
Err(build_not_found_response())
}
}
}
}
#[get("/repository/getAll")]
pub fn get_all_repositories() -> ApiJsonResponse<Vec<Repository>> {
Registry::with_default_location()
.get_all_repositories()
.into_json_response()
}
#[get("/repository/findByLayer/<hash>")]
pub fn find_repository_by_layer(hash: String) -> ApiJsonResponse<Vec<Repository>> {
if !Repository::is_valid_hash(&hash) {
return Err(build_bad_request_response())
}
Registry::with_default_location()
.get_repositories_by_layer_hash(&hash)
.into_json_response()
}
#[get("/repository/findByImage/<hash>")]
pub fn find_repository_by_image(hash: String) -> ApiJsonResponse<Vec<Repository>> {
if !Repository::is_valid_hash(&hash) {
return Err(build_bad_request_response())
}
Registry::with_default_location()
.get_repositories_by_image_hash(&hash)
.into_json_response()
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Feb 16, 09:29 (15 h, 1 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3451561
Default Alt Text
(3 KB)
Attached To
Mode
rAPIREG Nasqueron private Docker registry API
Attached
Detach File
Event Timeline
Log In to Comment