forked from awslabs/amazon-kinesis-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internally construct and use stream ARNs for all streams in multi-str…
…eam mode (awslabs#1318)
- Loading branch information
Showing
4 changed files
with
228 additions
and
30 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
amazon-kinesis-client/src/main/java/software/amazon/kinesis/common/ArnUtil.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 software.amazon.kinesis.common; | ||
|
||
import lombok.NonNull; | ||
import software.amazon.awssdk.arns.Arn; | ||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.kinesis.annotations.KinesisClientInternalApi; | ||
|
||
import static software.amazon.awssdk.services.kinesis.KinesisAsyncClient.SERVICE_NAME; | ||
|
||
@KinesisClientInternalApi | ||
public final class ArnUtil { | ||
private static final String STREAM_RESOURCE_PREFIX = "stream/"; | ||
|
||
/** | ||
* Construct a Kinesis stream ARN. | ||
* | ||
* @param region The region the stream exists in. | ||
* @param accountId The account the stream belongs to. | ||
* @param streamName The name of the stream. | ||
* @return The {@link Arn} of the Kinesis stream. | ||
*/ | ||
public static Arn constructStreamArn( | ||
@NonNull final Region region, @NonNull final String accountId, @NonNull final String streamName) { | ||
return Arn.builder() | ||
.partition(region.metadata().partition().id()) | ||
.service(SERVICE_NAME) | ||
.region(region.id()) | ||
.accountId(accountId) | ||
.resource(STREAM_RESOURCE_PREFIX + streamName) | ||
.build(); | ||
} | ||
} |
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
Oops, something went wrong.