init
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
import { IsString, IsOptional, IsBoolean, IsNumber, IsEnum } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { ClusterStatus } from '../../common/enums';
|
||||
|
||||
export class CreateClusterDto {
|
||||
@ApiProperty({ example: 'production-cluster' })
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Main production K8s cluster' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ example: 'apiVersion: v1\nclusters:\n- cluster:...' })
|
||||
@IsString()
|
||||
kubeconfig: string;
|
||||
|
||||
@ApiProperty({ example: 'https://k8s-api.example.com:6443' })
|
||||
@IsString()
|
||||
apiServer: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'us-east-1' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
region?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'aws' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
provider?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: false })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isDefault?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ example: '4' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
defaultCpuLimit?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: '8Gi' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
defaultMemoryLimit?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 10 })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxAppsPerUser?: number;
|
||||
}
|
||||
|
||||
export class UpdateClusterDto {
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsEnum(ClusterStatus)
|
||||
status?: ClusterStatus;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
kubeconfig?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isDefault?: boolean;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
defaultCpuLimit?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
defaultMemoryLimit?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxAppsPerUser?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user