Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update AWS SDK version to latest version (#121)
* Update AWS SDK version to latest version * Improve the region display values in the UI Before, then looked like this "EU_WEST_2", now they are more readable with the actual location in them: "EU (London): eu-west-2". Also added a test to cover both the formatting and and value. * Use improved region formatting for CloudTrail and Logs inputs * Bump amazon-kinesis-client from 1.9.0 to 1.10.0 (#122) Bumps [amazon-kinesis-client](https://github.com/awslabs/amazon-kinesis-client) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/awslabs/amazon-kinesis-client/releases) - [Changelog](https://github.com/awslabs/amazon-kinesis-client/blob/v1.10.0/CHANGELOG.md) - [Commits](awslabs/amazon-kinesis-client@v1.9.0...v1.10.0) Signed-off-by: dependabot[bot] <support@dependabot.com>
- Loading branch information
Showing
5 changed files
with
66 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
package org.graylog.aws; | ||
|
||
import com.amazonaws.regions.Regions; | ||
import com.google.common.collect.Maps; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* A common utils class for the AWS plugin. | ||
*/ | ||
public class AWS { | ||
|
||
public static final String SOURCE_GROUP_IDENTIFIER = "aws_source"; | ||
|
||
public static final String FIELD_LOG_GROUP = "aws_log_group"; | ||
public static final String FIELD_LOG_STREAM = "aws_log_stream"; | ||
|
||
// This is a non-instantiable utils class. | ||
private AWS() { | ||
} | ||
|
||
/** | ||
* Build a list of region choices with both a value (persisted in configuration) and display value (shown to the user). | ||
* | ||
* The display value is formatted nicely: "EU (London): eu-west-2" | ||
* The value is eventually passed to Regions.fromName() to get the actual region object: eu-west-2 | ||
* @return a choices map with configuration value map keys and display value map values. | ||
*/ | ||
public static Map<String, String> buildRegionChoices() { | ||
Map<String, String> regions = Maps.newHashMap(); | ||
for (Regions region : Regions.values()) { | ||
|
||
String displayValue = String.format("%s: %s", region.getDescription(), region.getName()); | ||
regions.put(region.getName(), displayValue); | ||
} | ||
return regions; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.graylog.aws; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.Map; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
|
||
public class AWSTest { | ||
|
||
// Verify that region choices are correctly built and formatted. | ||
@Test | ||
public void testRegionChoices() { | ||
|
||
Map<String, String> regionChoices = AWS.buildRegionChoices(); | ||
|
||
// Check format of random region. | ||
assertTrue(regionChoices.containsValue("EU (London): eu-west-2")); | ||
assertTrue(regionChoices.containsKey("eu-west-2")); | ||
|
||
// Verify that the Gov regions are present. | ||
//"us-gov-west-1" -> "AWS GovCloud (US): us-gov-west-1" | ||
assertTrue(regionChoices.containsValue("AWS GovCloud (US): us-gov-west-1")); | ||
assertTrue(regionChoices.containsKey("us-gov-west-1")); | ||
assertTrue(regionChoices.containsValue("AWS GovCloud (US-East): us-gov-east-1")); | ||
assertTrue(regionChoices.containsKey("us-gov-east-1")); | ||
} | ||
} |