chore: initial commit for phase03
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { Type } from '@sinclair/typebox';
|
||||
|
||||
export const ServerParamSchema = {
|
||||
params: Type.Object({
|
||||
orgId: Type.String({ format: 'uuid' }),
|
||||
serverId: Type.String({ format: 'uuid' }),
|
||||
}),
|
||||
};
|
||||
|
||||
export const CreateServerSchema = {
|
||||
body: Type.Object({
|
||||
name: Type.String({ minLength: 1, maxLength: 255 }),
|
||||
description: Type.Optional(Type.String()),
|
||||
nodeId: Type.String({ format: 'uuid' }),
|
||||
gameId: Type.String({ format: 'uuid' }),
|
||||
memoryLimit: Type.Number({ minimum: 128 * 1024 * 1024 }), // min 128MB in bytes
|
||||
diskLimit: Type.Number({ minimum: 256 * 1024 * 1024 }), // min 256MB
|
||||
cpuLimit: Type.Optional(Type.Number({ minimum: 10, maximum: 10000, default: 100 })),
|
||||
allocationId: Type.String({ format: 'uuid' }),
|
||||
environment: Type.Optional(Type.Record(Type.String(), Type.String())),
|
||||
startupOverride: Type.Optional(Type.String()),
|
||||
}),
|
||||
};
|
||||
|
||||
export const UpdateServerSchema = {
|
||||
body: Type.Object({
|
||||
name: Type.Optional(Type.String({ minLength: 1, maxLength: 255 })),
|
||||
description: Type.Optional(Type.String()),
|
||||
memoryLimit: Type.Optional(Type.Number({ minimum: 128 * 1024 * 1024 })),
|
||||
diskLimit: Type.Optional(Type.Number({ minimum: 256 * 1024 * 1024 })),
|
||||
cpuLimit: Type.Optional(Type.Number({ minimum: 10, maximum: 10000 })),
|
||||
environment: Type.Optional(Type.Record(Type.String(), Type.String())),
|
||||
startupOverride: Type.Optional(Type.String()),
|
||||
}),
|
||||
};
|
||||
|
||||
export const PowerActionSchema = {
|
||||
body: Type.Object({
|
||||
action: Type.Union([
|
||||
Type.Literal('start'),
|
||||
Type.Literal('stop'),
|
||||
Type.Literal('restart'),
|
||||
Type.Literal('kill'),
|
||||
]),
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user