-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added metrics support for Cloud Assets
- Loading branch information
1 parent
99d110c
commit d218baf
Showing
23 changed files
with
704 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/MetricsItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("&"); | ||
sb.append("panelConfigs[0][content][aggregate]=").append(DEFAULT_AGGREGATE_METRICS).append("&"); | ||
sb.append("panelConfigs[0][content][compartmentId]=").append(this.getCompartmentId()).append("&"); | ||
sb.append("panelConfigs[0][content][metricName]=").append(this.getName()).append("&"); | ||
sb.append("panelConfigs[0][content][namespace]=").append(this.getNamespace()).append("&"); | ||
sb.append("panelConfigs[0][content][interval]=").append(DEFAULT_INTERVAL).append("&"); | ||
sb.append("panelConfigs[0][content][statistic]=").append(DEFAULT_AGGREGATION_FUNCTION).append("&"); | ||
sb.append("region=").append(this.region); | ||
try { | ||
return new URL(sb.toString()); | ||
} catch (MalformedURLException ex) { | ||
Exceptions.printStackTrace(ex); | ||
} | ||
return null; | ||
} | ||
} |
Oops, something went wrong.