Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56949391
requests.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
requests.rs
View Options
//!
//! 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
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#[get(
"/registry/stats"
)]
pub
fn
get_registry_stats
()
->
ApiJsonResponse
<
Registry
>
{
Registry
::
with_default_location
()
.
into_json_response
()
}
// -------------------------------------------------------------
// /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
())
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 13, 12:11 (3 d, 9 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4243809
Default Alt Text
requests.rs (1 KB)
Attached To
Mode
rAPIREG Nasqueron private Docker registry API
Attached
Detach File
Event Timeline
Log In to Comment