-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass region and AWS credentials with AWS API requests (#92)
* Require POST object containing region and credentials for all requests Specifically adds a POST body requirement for the getKinesisSteams and getLogGroupNames methods. * Use snake_case for paths * Update region api call (#110) * Migrate Regions request from a list to a full response object with total * Update Region API call to include label and value * Reformat code
- Loading branch information
Showing
16 changed files
with
360 additions
and
200 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
32 changes: 32 additions & 0 deletions
32
src/main/java/org/graylog/integrations/aws/resources/requests/AWSRequestImpl.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,32 @@ | ||
package org.graylog.integrations.aws.resources.requests; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.auto.value.AutoValue; | ||
import org.graylog.autovalue.WithBeanGetter; | ||
|
||
/** | ||
* A common implementation on AWSRequest, which can be used for any AWS request that just needs region and credentials. | ||
*/ | ||
@JsonAutoDetect | ||
@AutoValue | ||
@WithBeanGetter | ||
public abstract class AWSRequestImpl implements AWSRequest { | ||
|
||
@JsonProperty(REGION) | ||
public abstract String region(); | ||
|
||
@JsonProperty(AWS_ACCESS_KEY_ID) | ||
public abstract String awsAccessKeyId(); | ||
|
||
@JsonProperty(AWS_SECRET_ACCESS_KEY) | ||
public abstract String awsSecretAccessKey(); | ||
|
||
@JsonCreator | ||
public static AWSRequestImpl create(@JsonProperty(REGION) String region, | ||
@JsonProperty(AWS_ACCESS_KEY_ID) String awsAccessKeyId, | ||
@JsonProperty(AWS_SECRET_ACCESS_KEY) String awsSecretAccessKey) { | ||
return new AutoValue_AWSRequestImpl(region, awsAccessKeyId, awsSecretAccessKey); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/graylog/integrations/aws/resources/responses/AWSRegion.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,29 @@ | ||
package org.graylog.integrations.aws.resources.responses; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.auto.value.AutoValue; | ||
import org.graylog.autovalue.WithBeanGetter; | ||
|
||
@JsonAutoDetect | ||
@AutoValue | ||
@WithBeanGetter | ||
public abstract class AWSRegion { | ||
|
||
private static final String VALUE = "value"; | ||
private static final String LABEL = "label"; | ||
|
||
// eu-west-2 | ||
@JsonProperty(VALUE) | ||
public abstract String regionId(); | ||
|
||
// The combination of both the name and description for display in the UI: | ||
// EU (London): eu-west-2 | ||
@JsonProperty(LABEL) | ||
public abstract String displayValue(); | ||
|
||
public static AWSRegion create(@JsonProperty(VALUE) String value, | ||
@JsonProperty(LABEL) String label) { | ||
return new AutoValue_AWSRegion(value, label); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/org/graylog/integrations/aws/resources/responses/LogGroupsResponse.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,28 @@ | ||
package org.graylog.integrations.aws.resources.responses; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.auto.value.AutoValue; | ||
import org.graylog.autovalue.WithBeanGetter; | ||
|
||
import java.util.List; | ||
|
||
@JsonAutoDetect | ||
@AutoValue | ||
@WithBeanGetter | ||
public abstract class LogGroupsResponse { | ||
|
||
private static final String LOG_GROUPS = "log_groups"; | ||
private static final String TOTAL = "total"; | ||
|
||
@JsonProperty(LOG_GROUPS) | ||
public abstract List<String> logGroups(); | ||
|
||
@JsonProperty(TOTAL) | ||
public abstract long total(); | ||
|
||
public static LogGroupsResponse create(@JsonProperty(LOG_GROUPS) List<String> logGroups, | ||
@JsonProperty(TOTAL) long total) { | ||
return new AutoValue_LogGroupsResponse(logGroups, total); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
src/main/java/org/graylog/integrations/aws/resources/responses/RegionResponse.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.