jhorvath commented on code in PR #6746:
URL: https://github.com/apache/netbeans/pull/6746#discussion_r1420170559


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddDbConnectionToVault.java:
##########
@@ -629,17 +741,148 @@ private void addDbConnectionToVault(Result item) {
                             .builder()
                             .createSecretDetails(createDetails)
                             .build();
-                    CreateSecretResponse response = 
client.createSecret(request);
+                    client.createSecret(request);
                 }
             }
 
-        } catch (BmcException e) {
-            NotifyDescriptor.Message msg = new 
NotifyDescriptor.Message(e.getMessage());
+            // Add Vault to the ConfigMap artifact
+            DevopsClient devopsClient = 
DevopsClient.builder().build(OCIManager.getDefault().getActiveProfile().getConfigProvider());
+            ListDeployArtifactsRequest request = 
ListDeployArtifactsRequest.builder()
+                    .projectId(item.project.getKey().getValue()).build();
+            ListDeployArtifactsResponse response = 
devopsClient.listDeployArtifacts(request);
+            List<DeployArtifactSummary> artifacts = 
response.getDeployArtifactCollection().getItems();
+            boolean found = false;
+            for (DeployArtifactSummary artifact : artifacts) {
+                if ((item.project.getName() + 
"_oke_configmap").equals(artifact.getDisplayName())) { //NOI18N
+                    h.progress("updating  " + item.project.getName() + 
"_oke_configmap"); //NOI18N
+                    found = true;
+                    GetDeployArtifactRequest artRequest = 
GetDeployArtifactRequest.builder().deployArtifactId(artifact.getId()).build();
+                    GetDeployArtifactResponse artResponse = 
devopsClient.getDeployArtifact(artRequest);
+                    DeployArtifactSource source = 
artResponse.getDeployArtifact().getDeployArtifactSource();
+                    if (source instanceof InlineDeployArtifactSource) {
+                        byte[] content = ((InlineDeployArtifactSource) 
source).getBase64EncodedContent();
+                        String srcString = updateProperties(new 
String(content, StandardCharsets.UTF_8),
+                                item.vault.getCompartmentId(), 
item.vault.getKey().getValue(), item.datasourceName);
+                        byte[] base64Content = 
Base64.getEncoder().encode(srcString.getBytes(StandardCharsets.UTF_8));
+                        DeployArtifactSource updatedSource = 
InlineDeployArtifactSource.builder()
+                                .base64EncodedContent(base64Content).build();
+                        UpdateDeployArtifactDetails updateArtifactDetails = 
UpdateDeployArtifactDetails.builder()
+                                .deployArtifactSource(updatedSource)
+                                .build();
+                        UpdateDeployArtifactRequest updateArtifactRequest = 
UpdateDeployArtifactRequest.builder()
+                                
.updateDeployArtifactDetails(updateArtifactDetails)
+                                .deployArtifactId(artifact.getId())
+                                .build();
+                        
devopsClient.updateDeployArtifact(updateArtifactRequest);
+                    }
+                }
+            }
+            if (!found) {
+                NotifyDescriptor.Message msg = new 
NotifyDescriptor.Message(Bundle.NoConfigMap(item.project.getName()), 
NotifyDescriptor.WARNING_MESSAGE);

Review Comment:
   This is valid. ConfigMap was not found, so it is not updated, but secrets in 
the vaults are still created. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to