-
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.
ARC-1807: Bump authzed client to 0.8.0 (#6)
* ARC-1807: Bump authzed client to 0.8.0 * ARC-1807: Cleanup * ARC-1807: Better Test Coverage
- Loading branch information
1 parent
bf85e5e
commit 6b57e7b
Showing
26 changed files
with
389 additions
and
211 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
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
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
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
16 changes: 0 additions & 16 deletions
16
generator-maven-plugin/src/main/java/com/oviva/spicegen/maven/SpicegenMojo.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
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
32 changes: 32 additions & 0 deletions
32
...nding/src/main/java/com/oviva/spicegen/spicedbbinding/internal/CheckPermissionMapper.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 com.oviva.spicegen.spicedbbinding.internal; | ||
|
||
import com.authzed.api.v1.CheckPermissionRequest; | ||
import com.oviva.spicegen.api.CheckPermission; | ||
|
||
public class CheckPermissionMapper { | ||
|
||
private final ConsistencyMapper consistencyMapper; | ||
private final ObjectReferenceMapper objectReferenceMapper; | ||
private final SubjectReferenceMapper subjectReferenceMapper; | ||
|
||
public CheckPermissionMapper( | ||
ConsistencyMapper consistencyMapper, | ||
ObjectReferenceMapper objectReferenceMapper, | ||
SubjectReferenceMapper subjectReferenceMapper) { | ||
this.consistencyMapper = consistencyMapper; | ||
this.objectReferenceMapper = objectReferenceMapper; | ||
this.subjectReferenceMapper = subjectReferenceMapper; | ||
} | ||
|
||
public CheckPermissionRequest map(CheckPermission checkPermission) { | ||
|
||
var consistency = consistencyMapper.map(checkPermission.consistency()); | ||
|
||
return CheckPermissionRequest.newBuilder() | ||
.setConsistency(consistency) | ||
.setResource(objectReferenceMapper.map(checkPermission.resource())) | ||
.setSubject(subjectReferenceMapper.map(checkPermission.subject())) | ||
.setPermission(checkPermission.permission()) | ||
.build(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...b-binding/src/main/java/com/oviva/spicegen/spicedbbinding/internal/ConsistencyMapper.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,19 @@ | ||
package com.oviva.spicegen.spicedbbinding.internal; | ||
|
||
import com.authzed.api.v1.ZedToken; | ||
import com.oviva.spicegen.api.Consistency; | ||
|
||
public class ConsistencyMapper { | ||
|
||
public com.authzed.api.v1.Consistency map(Consistency consistency) { | ||
return switch (consistency.requirement()) { | ||
case FULLY_CONSISTENT -> | ||
com.authzed.api.v1.Consistency.newBuilder().setFullyConsistent(true).build(); | ||
case AT_LEAST_AS_FRESH -> | ||
com.authzed.api.v1.Consistency.newBuilder() | ||
.setAtLeastAsFresh( | ||
ZedToken.newBuilder().setToken(consistency.consistencyToken()).build()) | ||
.build(); | ||
}; | ||
} | ||
} |
9 changes: 3 additions & 6 deletions
9
...nding/src/main/java/com/oviva/spicegen/spicedbbinding/internal/ObjectReferenceMapper.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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
package com.oviva.spicegen.spicedbbinding.internal; | ||
|
||
import com.authzed.api.v1.Core; | ||
import com.authzed.api.v1.ObjectReference; | ||
import com.oviva.spicegen.api.ObjectRef; | ||
|
||
public class ObjectReferenceMapper { | ||
|
||
public Core.ObjectReference map(ObjectRef ref) { | ||
return Core.ObjectReference.newBuilder() | ||
.setObjectType(ref.kind()) | ||
.setObjectId(ref.id()) | ||
.build(); | ||
public ObjectReference map(ObjectRef ref) { | ||
return ObjectReference.newBuilder().setObjectType(ref.kind()).setObjectId(ref.id()).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
Oops, something went wrong.