sdedic commented on code in PR #7700:
URL: https://github.com/apache/netbeans/pull/7700#discussion_r1738247669


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/MetricsItem.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.developer;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.netbeans.modules.cloud.oracle.adm.URLProvider;
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Dusan Petrovic
+ */
+public class MetricsItem extends OCIItem implements URLProvider {
+    
+    private static final String DEFAULT_AGGREGATION_FUNCTION = "mean()";
+    private static final String DEFAULT_INTERVAL = "1m";
+    private static final String BASE_URL = 
"https://cloud.oracle.com/monitoring/explore";;
+    private static final String DEFAULT_ADVANCED_MODE = "false";
+    private static final String DEFAULT_AGGREGATE_METRICS = "false";
+
+    final String namespace;
+    final String region;
+
+    public MetricsItem(String compartmentId, String name, String namespace, 
String region) {
+        super(OCID.of(null, "MetricsNamespace/Metrics"), compartmentId, name);
+        this.namespace = namespace;
+        this.region = region;
+    }
+    
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public URL getURL() {
+        StringBuilder sb = new StringBuilder(BASE_URL);
+        sb.append("?");
+        
sb.append("panelConfigs[0][advanced]=").append(DEFAULT_ADVANCED_MODE).append("&");

Review Comment:
   See [`pchar` and `query` 
BNF](https://datatracker.ietf.org/doc/html/rfc3986#page-50) in that RFC - it 
allows parenthesis, but [at the same time 
says](https://datatracker.ietf.org/doc/html/rfc3986#page-13)  `each syntax rule 
lists the characters
      allowed within that component (i.e., not delimiting it), and any of
      those characters that are also in the reserved set are "reserved" for
      use as subcomponent delimiters within the component`
   I read it that using `[]` is outside the spec (gen-delims), and using `()` 
could be future-unsafe, but URL (a specialization of URI) spec explicitly 
permits it now.
   
   But it's rather an academic discussion at this code level, since it works in 
fact -  as it can be easily fixed in case of issues.



-- 
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