This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from bonndan/remove_state_provider
Remove state provider
- Loading branch information
Showing
37 changed files
with
232 additions
and
579 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
39 changes: 39 additions & 0 deletions
39
src/main/java/de/bonndan/nivio/input/rancher1/ItemDescriptionFactoryRancher1.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,39 @@ | ||
package de.bonndan.nivio.input.rancher1; | ||
|
||
import de.bonndan.nivio.input.ItemDescriptionFactory; | ||
import de.bonndan.nivio.input.dto.ItemDescription; | ||
import de.bonndan.nivio.input.dto.SourceReference; | ||
import de.bonndan.nivio.util.URLHelper; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ItemDescriptionFactoryRancher1 implements ItemDescriptionFactory { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ItemDescriptionFactoryRancher1.class); | ||
private final URL baseUrl; | ||
|
||
public ItemDescriptionFactoryRancher1(URL baseUrl) { | ||
this.baseUrl = baseUrl; | ||
} | ||
|
||
@Override | ||
public List<ItemDescription> getDescriptions(SourceReference reference) { | ||
|
||
String landscape = reference.getLandscapeDescription().getIdentifier(); | ||
|
||
String combine = URLHelper.combine(baseUrl, reference.getUrl()); | ||
try { | ||
URL url = new URL(combine); | ||
PrometheusExporter prometheusExporter = new PrometheusExporter(landscape, url); | ||
return prometheusExporter.getDescriptions(); | ||
} catch (MalformedURLException e) { | ||
logger.error("Could not work on prometheus url {}", combine); | ||
return new ArrayList<>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.