Add automatic cluster pool allocation.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IsString, IsOptional, IsBoolean, IsArray, IsIn } from 'class-validator';
|
||||
import { IsString, IsOptional, IsBoolean, IsArray, IsIn, IsNumber, Min } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class CreateClusterPoolDto {
|
||||
@@ -11,14 +11,25 @@ export class CreateClusterPoolDto {
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ example: 'least-apps', enum: ['least-apps', 'round-robin'] })
|
||||
@IsIn(['least-apps', 'round-robin'])
|
||||
strategy: 'least-apps' | 'round-robin';
|
||||
@ApiProperty({ example: 'weighted-resource', enum: ['least-apps', 'round-robin', 'weighted-resource'] })
|
||||
@IsIn(['least-apps', 'round-robin', 'weighted-resource'])
|
||||
strategy: 'least-apps' | 'round-robin' | 'weighted-resource';
|
||||
|
||||
@ApiProperty({ example: ['uuid-1', 'uuid-2'], description: 'Array of cluster IDs in this pool' })
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
clusterIds: string[];
|
||||
|
||||
@ApiPropertyOptional({ example: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isDefault?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ example: 100 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
export class UpdateClusterPoolDto {
|
||||
@@ -32,10 +43,10 @@ export class UpdateClusterPoolDto {
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: ['least-apps', 'round-robin'] })
|
||||
@ApiPropertyOptional({ enum: ['least-apps', 'round-robin', 'weighted-resource'] })
|
||||
@IsOptional()
|
||||
@IsIn(['least-apps', 'round-robin'])
|
||||
strategy?: 'least-apps' | 'round-robin';
|
||||
@IsIn(['least-apps', 'round-robin', 'weighted-resource'])
|
||||
strategy?: 'least-apps' | 'round-robin' | 'weighted-resource';
|
||||
|
||||
@ApiPropertyOptional({ description: 'Array of cluster IDs in this pool' })
|
||||
@IsOptional()
|
||||
@@ -47,4 +58,15 @@ export class UpdateClusterPoolDto {
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isDefault?: boolean;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsString, IsOptional, IsBoolean, IsNumber, IsEnum } from 'class-validator';
|
||||
import { IsString, IsOptional, IsBoolean, IsNumber, IsEnum, IsArray, Min } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { ClusterStatus } from '../../common/enums';
|
||||
|
||||
@@ -25,6 +25,18 @@ export class CreateClusterDto {
|
||||
@IsString()
|
||||
region?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 10, description: 'Relative placement weight; higher means more preferred' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
weight?: number;
|
||||
|
||||
@ApiPropertyOptional({ example: ['ssd', 'iran', 'production'] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
tags?: string[];
|
||||
|
||||
@ApiPropertyOptional({ example: 'aws' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@@ -62,6 +74,16 @@ export class UpdateClusterDto {
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
region?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
provider?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsEnum(ClusterStatus)
|
||||
@@ -77,6 +99,18 @@ export class UpdateClusterDto {
|
||||
@IsBoolean()
|
||||
isDefault?: boolean;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
weight?: number;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
tags?: string[];
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
Reference in New Issue
Block a user