@@ -482,6 +482,13 @@ func (impl *DeploymentConfigurationServiceImpl) getConfigDataForAppConfiguration
482
482
configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
483
483
var err error
484
484
switch configDataQueryParams .ConfigType {
485
+ case bean2 .DefaultVersion .ToString ():
486
+ configDataDto , err = impl .getDeploymentAndCmCsConfigDataForDefaultVersion (ctx , configDataQueryParams )
487
+ if err != nil {
488
+ impl .logger .Errorw ("GetAllConfigData, error in config data for Default version" , "configDataQueryParams" , configDataQueryParams , "err" , err )
489
+ return nil , err
490
+ }
491
+ //no cm or cs to send for default versions
485
492
case bean2 .PreviousDeployments .ToString ():
486
493
configDataDto , err = impl .getDeploymentAndCmCsConfigDataForPreviousDeployments (ctx , configDataQueryParams , appId , envId , userHasAdminAccess )
487
494
if err != nil {
@@ -498,6 +505,38 @@ func (impl *DeploymentConfigurationServiceImpl) getConfigDataForAppConfiguration
498
505
return configDataDto , nil
499
506
}
500
507
508
+ func (impl * DeploymentConfigurationServiceImpl ) getDeploymentsConfigForDefaultVersion (ctx context.Context , chartRefId int ) (json.RawMessage , error ) {
509
+ deploymentTemplateRequest := generateManifest.DeploymentTemplateRequest {
510
+ ChartRefId : chartRefId ,
511
+ RequestDataMode : generateManifest .Values ,
512
+ Type : repository2 .DefaultVersions ,
513
+ }
514
+ deploymentTemplateResponse , err := impl .deploymentTemplateService .GetDeploymentTemplate (ctx , deploymentTemplateRequest )
515
+ if err != nil {
516
+ impl .logger .Errorw ("getDeploymentTemplateForEnvLevel, error in getting deployment template for " , "deploymentTemplateRequest" , deploymentTemplateRequest , "err" , err )
517
+ return nil , err
518
+ }
519
+ deploymentJson := json.RawMessage {}
520
+ err = deploymentJson .UnmarshalJSON ([]byte (deploymentTemplateResponse .Data ))
521
+ if err != nil {
522
+ impl .logger .Errorw ("getDeploymentTemplateForEnvLevel, error in unmarshalling string deploymentTemplateResponse data into json Raw message" , "data" , deploymentTemplateResponse .Data , "err" , err )
523
+ return nil , err
524
+ }
525
+ return deploymentJson , nil
526
+ }
527
+
528
+ func (impl * DeploymentConfigurationServiceImpl ) getDeploymentAndCmCsConfigDataForDefaultVersion (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
529
+ configData := & bean2.DeploymentAndCmCsConfigDto {}
530
+ deploymentTemplateJsonData , err := impl .getDeploymentsConfigForDefaultVersion (ctx , configDataQueryParams .IdentifierId )
531
+ if err != nil {
532
+ impl .logger .Errorw ("GetAllConfigData, error in getting deployment config for default version" , "chartRefId" , configDataQueryParams .IdentifierId , "err" , err )
533
+ return nil , err
534
+ }
535
+ deploymentConfig := bean2 .NewDeploymentAndCmCsConfig ().WithConfigData (deploymentTemplateJsonData ).WithResourceType (bean .DeploymentTemplate )
536
+ configData .WithDeploymentTemplateData (deploymentConfig )
537
+ return configData , nil
538
+ }
539
+
501
540
func (impl * DeploymentConfigurationServiceImpl ) getCmCsEditDataForPublishedOnly (ctx context.Context , configDataQueryParams * bean2.ConfigDataQueryParams , envId ,
502
541
appId int , clusterId int , userHasAdminAccess bool , systemMetadata * resourceQualifiers.SystemMetadata ) (* bean2.DeploymentAndCmCsConfigDto , error ) {
503
542
configDataDto := & bean2.DeploymentAndCmCsConfigDto {}
0 commit comments