Skip to content

Commit 600722e

Browse files
committed
fix: api changes
1 parent 3004b84 commit 600722e

File tree

659 files changed

+39797
-5364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+39797
-5364
lines changed

packages/common/api-helper/macros/src/lib.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const ENDPOINT_ARGUMENTS: &[&str] = &[
3636
];
3737

3838
struct EndpointRouter {
39+
name: Option<syn::Ident>,
3940
routes: Punctuated<Endpoint, Token![,]>,
4041
cors_config: Option<syn::Expr>,
4142
mounts: Punctuated<Mount, Token![,]>,
@@ -44,6 +45,7 @@ struct EndpointRouter {
4445

4546
impl Parse for EndpointRouter {
4647
fn parse(input: ParseStream) -> syn::Result<Self> {
48+
let mut name = None;
4749
let mut routes = None;
4850
let mut cors_config = None;
4951
let mut mounts = None;
@@ -60,6 +62,16 @@ impl Parse for EndpointRouter {
6062

6163
// Parse various keys
6264
match key.to_string().as_str() {
65+
"name" => {
66+
if name.is_none() {
67+
name = Some(input.parse()?);
68+
} else {
69+
return Err(syn::Error::new(
70+
key.span(),
71+
format!("Duplicate key `{}`.", key),
72+
));
73+
}
74+
}
6375
"routes" => {
6476
if routes.is_none() {
6577
let routes_content;
@@ -134,6 +146,7 @@ impl Parse for EndpointRouter {
134146
let mounts = mounts.unwrap_or_default();
135147

136148
Ok(EndpointRouter {
149+
name,
137150
routes,
138151
cors_config,
139152
mounts,
@@ -144,6 +157,12 @@ impl Parse for EndpointRouter {
144157

145158
impl EndpointRouter {
146159
fn render(self) -> syn::Result<TokenStream2> {
160+
let name = if let Some(name) = self.name {
161+
name.to_token_stream()
162+
} else {
163+
quote! { Router }
164+
};
165+
147166
let endpoints = self
148167
.routes
149168
.into_iter()
@@ -186,8 +205,8 @@ impl EndpointRouter {
186205
.collect::<Vec<_>>();
187206

188207
Ok(quote! {
189-
pub struct Router;
190-
impl Router {
208+
pub struct #name;
209+
impl #name {
191210
#[doc(hidden)]
192211
#[tracing::instrument(level="debug", name = "router_matcher", skip_all)]
193212
pub async fn __inner(

packages/common/fdb-util/src/keys.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub const IMAGE_ID: usize = 52;
5454
pub const ACTOR2: usize = 53;
5555
pub const PENDING_ACTOR: usize = 54;
5656
pub const PENDING_ACTOR_BY_IMAGE_ID: usize = 55;
57+
pub const CONTAINER: usize = 56;
5758

5859
// Directories with fdbrs must use string paths instead of tuples
5960
pub mod dir {
@@ -120,6 +121,7 @@ pub fn key_from_str(key: &str) -> Option<usize> {
120121
"actor2" => Some(ACTOR2),
121122
"pending_actor" => Some(PENDING_ACTOR),
122123
"pending_actor_by_image_id" => Some(PENDING_ACTOR_BY_IMAGE_ID),
124+
"container" => Some(CONTAINER),
123125
_ => None,
124126
}
125127
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name = "CONTAINER_FAILED_TO_CREATE"
3+
description = "Container failed to create: {error}"
4+
description_basic = "Container failed to create."
5+
http_status = 400
6+
---
7+
8+
# Container Failed To Create
9+
10+
Container failed to create.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_LOGS_INVALID_CONTAINER_IDS"
3+
description = "Invalid container IDs format."
4+
http_status = 400
5+
---
6+
7+
# Invalid Container Ids
8+
9+
The provided list of container IDs is not in a valid JSON format. Please provide a valid JSON array of UUIDs.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_LOGS_NO_CONTAINER_IDS"
3+
description = "No container IDs provided."
4+
http_status = 400
5+
---
6+
7+
# No Container Ids
8+
9+
No container IDs were provided in the request. Please provide at least one valid container ID.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_LOGS_NO_VALID_CONTAINER_IDS"
3+
description = "No valid container IDs found."
4+
http_status = 400
5+
---
6+
7+
# No Valid Container Ids
8+
9+
None of the provided container IDs are valid for this game/environment. Please provide valid container IDs.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_METRICS_INVALID_INTERVAL"
3+
description = "Invalid interval provided."
4+
http_status = 400
5+
---
6+
7+
# Invalid Interval
8+
9+
The provided interval must be greater than 0. Please provide a valid interval value in milliseconds.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_METRICS_INVALID_METRICS"
3+
description = "Invalid metrics format."
4+
http_status = 400
5+
---
6+
7+
# Invalid Metrics
8+
9+
The provided list of metrics is not in a valid JSON format. Please provide a valid JSON array of metric names.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_METRICS_NO_METRICS"
3+
description = "No metrics specified."
4+
http_status = 400
5+
---
6+
7+
# No Metrics
8+
9+
No metrics were specified in the request. Please provide at least one metric name to query.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name = "CONTAINER_METRICS_UNSUPPORTED_METRICS"
3+
description = "Unsupported metrics requested."
4+
http_status = 400
5+
---
6+
7+
# Unsupported Metrics
8+
9+
The requested metrics are not supported. Supported metrics include: cpu, memory, memory_limit, network_rx_bytes, network_tx_bytes.

0 commit comments

Comments
 (0)