mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 23:39:09 +00:00
125 lines
2.7 KiB
TypeScript
125 lines
2.7 KiB
TypeScript
import { NetworkConfigEntity } from '@dadosfera/protospack-v2/dist/lib/NetworkConfig/interfaces/entities';
|
|
import {
|
|
ApiProperty,
|
|
ApiPropertyOptional,
|
|
OmitType,
|
|
PickType,
|
|
} from '@nestjs/swagger';
|
|
|
|
export enum NetworkConfigTypesEnum {
|
|
vpn = 'vpn',
|
|
}
|
|
export enum NetworkConfigPluginsEnum {
|
|
openvpn = 'openvpn',
|
|
}
|
|
export class NetworkConfigDto implements NetworkConfigEntity {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
customer_name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
@ApiProperty({ enum: NetworkConfigTypesEnum })
|
|
type: string;
|
|
@ApiProperty({ enum: NetworkConfigPluginsEnum })
|
|
plugin: string;
|
|
@ApiProperty()
|
|
properties: any;
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
@ApiProperty()
|
|
network_type_id: string;
|
|
@ApiProperty()
|
|
network_type_name: string;
|
|
@ApiProperty()
|
|
user_id: string;
|
|
@ApiProperty()
|
|
customer_id: string;
|
|
@ApiProperty()
|
|
keywords: string;
|
|
@ApiProperty()
|
|
tags: string;
|
|
}
|
|
export class NetworkConfigNoSecrets extends OmitType(NetworkConfigDto, [
|
|
'properties',
|
|
]) {}
|
|
export class NetworkConfigOpenVpnProperties {
|
|
@ApiProperty({ enum: NetworkConfigPluginsEnum })
|
|
plugin: NetworkConfigPluginsEnum;
|
|
@ApiProperty()
|
|
OVPN_FILE: string;
|
|
@ApiPropertyOptional()
|
|
CERTIFICATE_FILE?: string;
|
|
@ApiPropertyOptional()
|
|
OVPN_CREDENTIALS?: string;
|
|
@ApiPropertyOptional()
|
|
TLS_AUTH_FILE?: string;
|
|
}
|
|
export class FindAllNetworkConfigsRes {
|
|
@ApiProperty({ type: [NetworkConfigNoSecrets] })
|
|
network_configs: NetworkConfigNoSecrets[];
|
|
}
|
|
|
|
export class FindNetworkConfigByidRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigNoSecrets;
|
|
}
|
|
|
|
export class FindNetworkConfigByidDetails extends PickType(NetworkConfigDto, [
|
|
'id',
|
|
'name',
|
|
'description',
|
|
'type',
|
|
'network_type_id',
|
|
'customer_name',
|
|
]) {
|
|
@ApiProperty()
|
|
properties: NetworkConfigOpenVpnProperties | string;
|
|
}
|
|
export class FindNetworkConfigByidDetailsRes {
|
|
@ApiProperty()
|
|
network_config: FindNetworkConfigByidDetails;
|
|
}
|
|
export class CreateNetworkConfigReq extends PickType(NetworkConfigDto, [
|
|
'name',
|
|
'description',
|
|
'type',
|
|
'network_type_id',
|
|
'plugin',
|
|
]) {
|
|
@ApiProperty({
|
|
type: 'file',
|
|
properties: {
|
|
file: {
|
|
type: 'string',
|
|
format: 'binary',
|
|
},
|
|
},
|
|
})
|
|
OVPN_FILE: any;
|
|
}
|
|
export class CreateNetworkConfigRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigNoSecrets;
|
|
}
|
|
|
|
export class UpdateNetworkConfigReq {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
}
|
|
export class UpdateNetworkConfigRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigNoSecrets;
|
|
}
|
|
|
|
export class DeleteNetworkConfigRes {
|
|
@ApiProperty()
|
|
message: string;
|
|
}
|