@@ -60,7 +60,7 @@ public OnboardingAppStackListener() {
6060
6161 @ Override
6262 public Object handleRequest (SNSEvent event , Context context ) {
63- LOGGER .info (Utils .toJson (event ));
63+ // LOGGER.info(Utils.toJson(event));
6464
6565 List <SNSEvent .SNSRecord > records = event .getRecords ();
6666 SNSEvent .SNS sns = records .get (0 ).getSNS ();
@@ -140,13 +140,34 @@ public Object handleRequest(SNSEvent event, Context context) {
140140 Map .of ("tenantId" , tenantId , "resources" , Utils .toJson (tenantResource ))
141141 );
142142 }
143+ // } else if ("AWS::CloudFormation::Stack".equals(resourceType) && "rds".equals(logicalId)) {
144+ // //this is the rds sub-stack so get the cluster and instance ids
145+ // getRdsResources(physicalResourceId, tenantResources);
143146 }
144147 }
145148 } catch (SdkServiceException cfnError ) {
146149 LOGGER .error ("cfn:ListStackResources error" , cfnError );
147150 LOGGER .error (Utils .getFullStackTrace (cfnError ));
148151 throw cfnError ;
149152 }
153+
154+ // // Persist the tenant specific things as tenant settings
155+ // if (dbHost != null) {
156+ // LOGGER.info("Saving tenant database host setting");
157+ // Map<String, Object> systemApiRequest = new HashMap<>();
158+ // systemApiRequest.put("resource", "settings/tenant/" + tenantId + "/DB_HOST");
159+ // systemApiRequest.put("method", "PUT");
160+ // systemApiRequest.put("body", "{\"name\":\"DB_HOST\", \"value\":\"" + dbHost + "\"}");
161+ // publishEvent(systemApiRequest, SYSTEM_API_CALL);
162+ // }
163+ // if (albName != null) {
164+ // LOGGER.info("Saving tenant ALB setting");
165+ // Map<String, Object> systemApiRequest = new HashMap<>();
166+ // systemApiRequest.put("resource", "settings/tenant/" + tenantId + "/ALB");
167+ // systemApiRequest.put("method", "PUT");
168+ // systemApiRequest.put("body", "{\"name\":\"ALB\", \"value\":\"" + albName + "\"}");
169+ // publishEvent(systemApiRequest, SYSTEM_API_CALL);
170+ // }
150171 }
151172 return null ;
152173 }
@@ -169,4 +190,42 @@ protected static boolean filter(CloudFormationEvent cloudFormationEvent) {
169190 && STACK_NAME_PATTERN .matcher (cloudFormationEvent .getStackName ()).matches ()
170191 && EVENTS_OF_INTEREST .contains (cloudFormationEvent .getResourceStatus ()));
171192 }
193+
194+ // LOGGER.info("Stack Outputs:");
195+ // for (Output output : stack.outputs()) {
196+ // LOGGER.info("{} => {}", output.outputKey(), output.outputValue());
197+ // if ("RdsEndpoint".equals(output.outputKey())) {
198+ // if (Utils.isNotBlank(output.outputValue())) {
199+ // dbHost = output.outputValue();
200+ // }
201+ // }
202+ // if ("BillingPlan".equals(output.outputKey())) {
203+ // if (Utils.isNotBlank(output.outputValue())) {
204+ // billingPlan = output.outputValue();
205+ // }
206+ // }
207+ // }
208+
209+ // private void getRdsResources(String stackId, Map<String, String> consoleResources) {
210+ // try {
211+ // ListStackResourcesResponse resources = cfn.listStackResources(request -> request.stackName(stackId));
212+ // for (StackResourceSummary resource : resources.stackResourceSummaries()) {
213+ // String resourceType = resource.resourceType();
214+ // String physicalResourceId = resource.physicalResourceId();
215+ // AwsResource url = null;
216+ // if (resourceType.equalsIgnoreCase(AwsResource.RDS_INSTANCE.getResourceType())) {
217+ // url = AwsResource.RDS_INSTANCE;
218+ // } else if (resourceType.equalsIgnoreCase(AwsResource.RDS_CLUSTER.getResourceType())) {
219+ // url = AwsResource.RDS_CLUSTER;
220+ // }
221+ // if (url != null) {
222+ // consoleResources.put(url.name(), url.formatUrl(AWS_REGION, physicalResourceId));
223+ // }
224+ // }
225+ // } catch (SdkServiceException cfnError) {
226+ // LOGGER.error("cfn:ListStackResources error", cfnError);
227+ // LOGGER.error(Utils.getFullStackTrace(cfnError));
228+ // throw cfnError;
229+ // }
230+ // }
172231}
0 commit comments