diff --git a/server/src/app.module.ts b/server/src/app.module.ts index 7fcf890d66..17a5c12992 100644 --- a/server/src/app.module.ts +++ b/server/src/app.module.ts @@ -6,6 +6,7 @@ import { FunctionsModule } from './functions/functions.module'; import { DomainsModule } from './domains/domains.module'; import { DeploymentCenterModule } from './deployment-center/deployment-center.module'; import { StacksModule } from './stacks/stacks.module'; +import { SidecarAddOnsModule } from './sidecaraddons/sidecaraddons.module'; import { StaticSitesModule } from './staticsites/staticsites.module'; import { WorkflowModule } from './workflows/workflows.module'; @@ -19,6 +20,7 @@ import { WorkflowModule } from './workflows/workflows.module'; DeploymentCenterModule, StaticSitesModule, StacksModule, + SidecarAddOnsModule, WorkflowModule, HomeModule, ], diff --git a/server/src/sidecaraddons/models/SidecarAddOnModel.ts b/server/src/sidecaraddons/models/SidecarAddOnModel.ts new file mode 100644 index 0000000000..a9459566a1 --- /dev/null +++ b/server/src/sidecaraddons/models/SidecarAddOnModel.ts @@ -0,0 +1,51 @@ +export interface AddOnConfig { + addOnAttributes: AddOnAttribute[]; + sidecarImages: SidecarImage[]; +} + +export interface AddOnAttribute { + displayText: string; + id: string; + type: string; + isRequired: boolean; +} + +export interface SidecarImage { + releaseChannel: string; + displayText: string; + value: string; + isEarlyAccess: boolean; + deprecated: boolean; + supportedLinuxFxVersions: string[]; + sitecontainerMetadata: SitecontainerMetadata; +} + +export interface SitecontainerMetadata { + appSettingMappings: AppSettingMapping[]; + volumeMappings: VolumeMapping[]; + port: any; + startUpCommand: any; +} + +export interface AppSettingMapping { + appSettingName: string; + environmentVariableName: any; +} + +export interface VolumeMapping { + volumeSubPath: any; + containerMountPath: any; + readOnly: boolean; +} + +export interface SidecarAddOn { + id: string; + displayText: string; + organization: string; + legalInformation: string; + value: string; + supportedOs: string; + supportedFeatures: string[]; + additionalInformation: string; + addOnConfig: AddOnConfig; +} diff --git a/server/src/sidecaraddons/service/SidecarAddOnService.ts b/server/src/sidecaraddons/service/SidecarAddOnService.ts new file mode 100644 index 0000000000..7f22e7e0e5 --- /dev/null +++ b/server/src/sidecaraddons/service/SidecarAddOnService.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@nestjs/common'; +import { SidecarAddOn } from '../models/SidecarAddOnModel'; +import { redisSidecarAddOn } from '../sidecaraddons/redis'; + +@Injectable() +export class SidecarAddOnService { + getSidecarAddOns(): SidecarAddOn[] { + const redisSidecarAddOnCopy = JSON.parse(JSON.stringify(redisSidecarAddOn)); + + let sidecarAddOns: SidecarAddOn[] = [redisSidecarAddOnCopy]; + + return sidecarAddOns; + } +} diff --git a/server/src/sidecaraddons/sidecaraddons.controller.ts b/server/src/sidecaraddons/sidecaraddons.controller.ts new file mode 100644 index 0000000000..612a6ab9dc --- /dev/null +++ b/server/src/sidecaraddons/sidecaraddons.controller.ts @@ -0,0 +1,12 @@ +import { Controller, Query, Post, Get } from '@nestjs/common'; +import { SidecarAddOnService } from './service/SidecarAddOnService'; + +@Controller('sidecaraddons') +export class SidecarAddOnsController { + constructor(private _sidecarAddOnService: SidecarAddOnService) {} + + @Get('') + sideCarAddOns(@Query('api-version') apiVersion: string) { + return this._sidecarAddOnService.getSidecarAddOns(); + } +} diff --git a/server/src/sidecaraddons/sidecaraddons.module.ts b/server/src/sidecaraddons/sidecaraddons.module.ts new file mode 100644 index 0000000000..d683cc2342 --- /dev/null +++ b/server/src/sidecaraddons/sidecaraddons.module.ts @@ -0,0 +1,11 @@ +import { Module } from '@nestjs/common'; +import { SharedModule } from '../shared/shared.module'; +import { SidecarAddOnsController } from './sidecaraddons.controller'; +import { SidecarAddOnService } from './service/SidecarAddOnService'; + +@Module({ + imports: [SharedModule], + controllers: [SidecarAddOnsController], + providers: [SidecarAddOnService], +}) +export class SidecarAddOnsModule {} diff --git a/server/src/sidecaraddons/sidecaraddons/redis.ts b/server/src/sidecaraddons/sidecaraddons/redis.ts new file mode 100644 index 0000000000..4d7c524852 --- /dev/null +++ b/server/src/sidecaraddons/sidecaraddons/redis.ts @@ -0,0 +1,53 @@ +import { SidecarAddOn } from '../models/SidecarAddOnModel'; + +const getRedisSidecarAddOn: () => SidecarAddOn = () => { + return { + id: 'redis', + displayText: '', + organization: 'redis', + legalInformation: '', + value: 'redis', + supportedOs: 'Linux', + supportedFeatures: ['LOGS', 'TRACES'], + additionalInformation: '', + addOnConfig: { + addOnAttributes: [ + { + displayText: '', + id: '', + type: '', + isRequired: true, + }, + ], + sidecarImages: [ + { + releaseChannel: 'Latest', + displayText: '', + value: '', + isEarlyAccess: true, + deprecated: false, + supportedLinuxFxVersions: ['DOTNETCORE|*', 'PYTHON|*'], + sitecontainerMetadata: { + appSettingMappings: [ + { + appSettingName: '', + environmentVariableName: null, + }, + ], + volumeMappings: [ + { + volumeSubPath: null, + containerMountPath: null, + readOnly: false, + }, + ], + port: null, + startUpCommand: null, + }, + }, + ], + }, + }; +}; + +export const redisSidecarAddOn: SidecarAddOn = getRedisSidecarAddOn();