in sources/src/main/java/com/google/solutions/jitaccess/web/rest/GroupsResource.java [248:283]
public record GroupInfo(
@NotNull Link self,
@NotNull String id,
@NotNull String name,
@NotNull String displayName,
@NotNull String description,
@NotNull String cloudIdentityGroup,
@NotNull List<PrivilegeInfo> privileges,
@NotNull EnvironmentsResource.EnvironmentInfo environment,
@NotNull SystemsResource.SystemInfo system,
@Nullable JoinInfo join
) implements MediaInfo {
static GroupInfo create(
@NotNull JitGroupContext g,
@NotNull JoinInfo joinInfo) {
return new GroupInfo(
new Link(
"environments/%s/systems/%s/groups/%s",
g.policy().id().environment(),
g.policy().id().system(),
g.policy().id().name()),
g.policy().id().toString(),
g.policy().name(),
g.policy().displayName(),
g.policy().description(),
g.cloudIdentityGroupId().email,
g.policy()
.privileges()
.stream()
.map(PrivilegeInfo::fromPrivilege)
.toList(),
EnvironmentsResource.EnvironmentInfo.createSummary(g.policy().system().environment()),
SystemsResource.SystemInfo.createSummary(g.policy().system()), // Don't list nested groups.
joinInfo);
}
}