Skip to content

Commit 0b6a363

Browse files
committed
Introduce enum for auth type
1 parent 46de53f commit 0b6a363

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/main/java/io/getstream/chat/java/models/App.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,17 @@ public enum HookType {
369369
UNKNOWN
370370
}
371371

372+
public enum AuthType {
373+
@JsonProperty("keys")
374+
KEYS, // Using AWS access key and secret key
375+
@JsonProperty("role")
376+
ROLE, // Using IAM role
377+
@JsonProperty("resource")
378+
RESOURCE, // Using resource-based policy
379+
@JsonEnumDefaultValue
380+
UNKNOWN
381+
}
382+
372383
@Data
373384
@NoArgsConstructor
374385
public static class EventHook {
@@ -402,7 +413,7 @@ public static class EventHook {
402413

403414
@Nullable
404415
@JsonProperty("sqs_auth_type")
405-
private String sqsAuthType;
416+
private AuthType sqsAuthType;
406417

407418
@Nullable
408419
@JsonProperty("sqs_key")
@@ -426,7 +437,7 @@ public static class EventHook {
426437

427438
@Nullable
428439
@JsonProperty("sns_auth_type")
429-
private String snsAuthType;
440+
private AuthType snsAuthType;
430441

431442
@Nullable
432443
@JsonProperty("sns_key")

src/test/java/io/getstream/chat/java/AppTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void whenUpdatingAppSettingsWithSQSEventHook_thenNoException() throws StreamExce
215215
sqsHook.setEventTypes(Arrays.asList("user.presence.changed", "user.updated"));
216216
sqsHook.setSqsQueueURL("https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue");
217217
sqsHook.setSqsRegion("us-east-1");
218-
sqsHook.setSqsAuthType("resource");
218+
sqsHook.setSqsAuthType(App.AuthType.RESOURCE);
219219
sqsHook.setCreatedAt(new Date());
220220
sqsHook.setUpdatedAt(new Date());
221221

@@ -241,7 +241,7 @@ void whenUpdatingAppSettingsWithSNSEventHook_thenNoException() throws StreamExce
241241
snsHook.setEventTypes(Arrays.asList("channel.created", "channel.updated"));
242242
snsHook.setSnsTopicARN("arn:aws:sns:us-east-1:123456789012:MyTopic");
243243
snsHook.setSnsRegion("us-east-1");
244-
snsHook.setSnsAuthType("resource");
244+
snsHook.setSnsAuthType(App.AuthType.RESOURCE);
245245
snsHook.setCreatedAt(new Date());
246246
snsHook.setUpdatedAt(new Date());
247247

0 commit comments

Comments
 (0)