You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/12/16 21:22:37 UTC

[GitHub] [netbeans] sdedic opened a new pull request, #5118: Support for OCI profiles.

sdedic opened a new pull request, #5118:
URL: https://github.com/apache/netbeans/pull/5118

   The OCI config (`~/.oci/config` by default) may contain multiple profiles, each providing a different auth token (= different effective permissions) and/or connecting to a different tenancy in specific region. The current implementation assumed just the default profile for all operations.
   
   I've changed the implementation so that:
   - adding a OCI cloud will allow the user to select from available profiles
   - a profile becomes "connected" - it gets a record in NB configuration and will display in the Services tree
   - the Services view honours different auth/region/tenancy settings for different profiles displayed. 
   - all operations in Services view should now operate with the appropriate profile
   - one of the profiles is active, initially the default one. Active profile selection is preserved in settings.
   
   It is possible to temporarily set an active profile; the settings will be eventually propagated through RequestProcessors tasks initiated by the wrapped execution.
   
   ADM vulnerability scan features now accept profile to run with, and the relevant LSP audit command accepts an optional profile setting.
   


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] mbien commented on pull request #5118: Support for OCI profiles.

Posted by GitBox <gi...@apache.org>.
mbien commented on PR #5118:
URL: https://github.com/apache/netbeans/pull/5118#issuecomment-1370337096

   looks like this one causes the VSCode ext job to fail. We should probably trigger that one with the LSP label too, right?


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic commented on pull request #5118: Support for OCI profiles.

Posted by GitBox <gi...@apache.org>.
sdedic commented on PR #5118:
URL: https://github.com/apache/netbeans/pull/5118#issuecomment-1369577305

   Some more changes coming, sorry -- @jhorvath suggested offline that the tenancy name should be shown instead of region, asi it probably makes more sense to the user. The tenancy name however need to be fetched from the remote, since OCI profile only contains tenancy OCID


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic merged pull request #5118: Support for OCI profiles.

Posted by GitBox <gi...@apache.org>.
sdedic merged PR #5118:
URL: https://github.com/apache/netbeans/pull/5118


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] jhorvath commented on a diff in pull request #5118: Support for OCI profiles.

Posted by GitBox <gi...@apache.org>.
jhorvath commented on code in PR #5118:
URL: https://github.com/apache/netbeans/pull/5118#discussion_r1053262312


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/ConnectProfilePanel.java:
##########
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle;
+
+import java.awt.CardLayout;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import org.openide.util.ImageUtilities;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author sdedic
+ */
+public class ConnectProfilePanel extends javax.swing.JPanel{
+    private List<OCIProfile> allProfiles;
+    
+    private DefaultListModel<OCIProfile> model = new DefaultListModel<>();
+    /**
+     * Creates new form AddProfilePanel
+     */
+    public ConnectProfilePanel() {
+        initComponents();
+        ((CardLayout)cards.getLayout()).show(cards, "msg");
+        lblMessageIcon.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/cloud/oracle/resources/info.png", false));
+        lstProfiles.setCellRenderer(new R());
+
+        textMessage.setEditable(false);
+        textMessage.addHyperlinkListener(new HyperlinkListener() {
+             @Override
+             public void hyperlinkUpdate(HyperlinkEvent hle) {
+                 if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
+                     Desktop desktop = Desktop.getDesktop();
+                     try {
+                         desktop.browse(hle.getURL().toURI());
+                     } catch (Exception ex) {
+                         ex.printStackTrace();
+                     }
+                 }
+             }
+         });
+    }
+    
+    public void setProfiles(List<OCIProfile> profiles) {
+        DefaultListModel mdl = new DefaultListModel();
+        for (OCIProfile p : profiles) {
+            mdl.addElement(p);
+        }
+        lstProfiles.setModel(mdl);
+        model = mdl;
+        
+        // switch the card:
+        ((CardLayout)cards.getLayout()).show(cards, "profiles");
+    }
+    
+    public void showErrorMessage(String msg) {
+        lblMessageIcon.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/cloud/oracle/resources/error.png", false));
+        textMessage.setContentType("text/html");
+        textMessage.setText(msg);
+        ((CardLayout)cards.getLayout()).show(cards, "msg");
+    }
+    
+    public void setSelectedProfiles(List<OCIProfile> profiles) {
+        lstProfiles.clearSelection();
+        for (OCIProfile p : profiles) {
+            int index = model.indexOf(p);
+            if (index >= 0) {
+                lstProfiles.getSelectionModel().addSelectionInterval(index, index);
+            }
+        }
+    }
+    
+    public boolean isContentValid() {
+        return !lstProfiles.getSelectedValuesList().isEmpty();
+    }
+    
+    public List<OCIProfile> getSelectedProfiles() {
+        return new ArrayList<>(lstProfiles.getSelectedValuesList());
+    }
+
+    @NbBundle.Messages({
+        "# {0} profile name",
+        "# {1} region",
+        "LBL_DefaultConfigProfile={0} - {1}",
+        "# {0} profile name",
+        "# {1} region",
+        "# {2} custom config filename",
+        "LBL_CustomConfigProfile={2}: {0} - {1}"
+    })
+    static class R extends DefaultListCellRenderer {
+
+        @Override
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+            OCIProfile p = (OCIProfile)value;
+            Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+            if (!(c instanceof JLabel)) {
+                return c;
+            }
+            JLabel l = (JLabel)c;
+            l.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/cloud/oracle/resources/tenancy.svg", false));
+            if (p.isDefaultConfig()) {
+                l.setText(Bundle.LBL_DefaultConfigProfile(p.getId(), p.getConfigProvider().getRegion().getRegionId()));

Review Comment:
   I would prefer tenancy name instead of default region here.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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