-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Put Record - Create Stream - Delete Stream
- Loading branch information
Showing
7 changed files
with
131 additions
and
5 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
24 changes: 24 additions & 0 deletions
24
src/main/java/io/timson/firehose/response/CreateDeliveryStreamResponse.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,24 @@ | ||
package io.timson.firehose.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class CreateDeliveryStreamResponse { | ||
|
||
private static final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
private static final String ARN_TEMPLATE = "arn:aws:firehose:us-east-1:123456789012:deliverystream/%s"; | ||
|
||
@JsonProperty("DeliveryStreamARN") | ||
private final String deliveryStreamArn; | ||
|
||
public CreateDeliveryStreamResponse(String deliveryStreamName) { | ||
this.deliveryStreamArn = String.format(ARN_TEMPLATE, deliveryStreamName); | ||
} | ||
|
||
public String body() throws JsonProcessingException { | ||
return mapper.writeValueAsString(this); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/io/timson/firehose/response/DeleteDeliveryStreamResponse.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,22 @@ | ||
package io.timson.firehose.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class DeleteDeliveryStreamResponse { | ||
|
||
private static final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@JsonProperty("DeliveryStreamName") | ||
private final String deliveryStreamName; | ||
|
||
public DeleteDeliveryStreamResponse(String deliveryStreamName) { | ||
this.deliveryStreamName = deliveryStreamName; | ||
} | ||
|
||
public String body() throws JsonProcessingException { | ||
return mapper.writeValueAsString(this); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/io/timson/firehose/response/PutResponse.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,30 @@ | ||
package io.timson.firehose.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.timson.firehose.util.FirehoseUtil; | ||
|
||
public class PutResponse { | ||
|
||
private static final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
private static final String recordIdChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/+"; | ||
private static final int recordIdLength = 224; | ||
|
||
@JsonProperty("RecordId") | ||
private final String recordId; | ||
|
||
public PutResponse() { | ||
recordId = FirehoseUtil.randomString(recordIdChars, recordIdLength); | ||
} | ||
|
||
public String body() throws JsonProcessingException { | ||
return mapper.writeValueAsString(this); | ||
} | ||
|
||
public String getRecordId() { | ||
return recordId; | ||
} | ||
|
||
} |
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