mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-01 19:19:08 +00:00
173 lines
3.4 KiB
TypeScript
173 lines
3.4 KiB
TypeScript
import {
|
|
NetworkConfigEntity,
|
|
NetworkConfigToCatalog,
|
|
} 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 interface ConnectionsApiNetworkConfig {
|
|
config_id: string;
|
|
created_at: string;
|
|
credentials: {
|
|
CERTIFICATE_FILE: string;
|
|
OVPN_CREDENTIALS: string;
|
|
TLS_AUTH_FILE: string;
|
|
OVPN_FILE: string;
|
|
};
|
|
customer_name: string;
|
|
description: string;
|
|
name: string;
|
|
plugin: string;
|
|
secret_id: string;
|
|
sensitive_fields: string[];
|
|
type: string;
|
|
updated_at: string;
|
|
}
|
|
export class NetworkConfigDto implements NetworkConfigEntity {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
@ApiProperty()
|
|
customer_name: string;
|
|
@ApiProperty()
|
|
customer_id: string;
|
|
@ApiProperty()
|
|
properties: any;
|
|
@ApiProperty()
|
|
user_id: string;
|
|
@ApiProperty()
|
|
keywords: string;
|
|
@ApiProperty()
|
|
tags: string;
|
|
|
|
@ApiProperty()
|
|
network_type_id: string;
|
|
@ApiProperty()
|
|
network_type_name: string;
|
|
@ApiProperty({ enum: NetworkConfigTypesEnum })
|
|
type: string;
|
|
@ApiProperty({ enum: NetworkConfigPluginsEnum })
|
|
plugin: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
}
|
|
|
|
export class CreateNetworkConfigReq extends PickType(NetworkConfigDto, [
|
|
'network_type_id',
|
|
'network_type_name',
|
|
'name',
|
|
'description',
|
|
]) {
|
|
@ApiProperty({ format: 'binary' })
|
|
ovpn_file: string;
|
|
}
|
|
|
|
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 NetworkConfigToCatalogDto implements NetworkConfigToCatalog {
|
|
@ApiProperty()
|
|
id: string;
|
|
|
|
@ApiProperty()
|
|
customer_id: string;
|
|
|
|
@ApiProperty()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
type: string;
|
|
|
|
@ApiProperty()
|
|
name: string;
|
|
|
|
@ApiProperty()
|
|
description: string;
|
|
|
|
@ApiProperty()
|
|
created_at: string;
|
|
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
|
|
@ApiProperty()
|
|
network_type_id: string;
|
|
|
|
@ApiProperty()
|
|
network_type_name: string;
|
|
}
|
|
export class FindAllNetworkConfigsRes {
|
|
@ApiProperty({ type: [NetworkConfigToCatalogDto] })
|
|
network_configs: NetworkConfigToCatalogDto[];
|
|
|
|
@ApiProperty()
|
|
message: string;
|
|
}
|
|
|
|
export class FindNetworkConfigByidRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigToCatalogDto;
|
|
}
|
|
|
|
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 CreateNetworkConfigRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigToCatalogDto;
|
|
}
|
|
|
|
export class UpdateNetworkConfigReq {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
}
|
|
export class UpdateNetworkConfigRes {
|
|
@ApiProperty()
|
|
network_config: NetworkConfigToCatalogDto;
|
|
}
|
|
|
|
export class DeleteNetworkConfigRes {
|
|
@ApiProperty()
|
|
message: string;
|
|
}
|