fda8384a5c
Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
1.8 KiB
TypeScript
76 lines
1.8 KiB
TypeScript
import { IsString, IsOptional, IsBoolean, IsArray, IsIn, IsNumber, Min } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
const poolStrategies = ['least-apps', 'round-robin', 'weighted-round-robin', 'least-loaded', 'weighted-resource', 'region-based'] as const;
|
|
type PoolStrategyDto = typeof poolStrategies[number];
|
|
|
|
export class CreateClusterPoolDto {
|
|
@ApiProperty({ example: 'production-pool' })
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiPropertyOptional({ example: 'Load-balanced pool for production workloads' })
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
@ApiProperty({ example: 'weighted-resource', enum: poolStrategies })
|
|
@IsIn(poolStrategies)
|
|
strategy: PoolStrategyDto;
|
|
|
|
@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 {
|
|
@ApiPropertyOptional({ example: 'production-pool-v2' })
|
|
@IsOptional()
|
|
@IsString()
|
|
name?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
@ApiPropertyOptional({ enum: poolStrategies })
|
|
@IsOptional()
|
|
@IsIn(poolStrategies)
|
|
strategy?: PoolStrategyDto;
|
|
|
|
@ApiPropertyOptional({ description: 'Array of cluster IDs in this pool' })
|
|
@IsOptional()
|
|
@IsArray()
|
|
@IsString({ each: true })
|
|
clusterIds?: string[];
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isActive?: boolean;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isDefault?: boolean;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(1)
|
|
priority?: number;
|
|
}
|