@@ -27,7 +27,7 @@ import code.api.v5_0_0.{ViewJsonV500, ViewsJsonV500}
2727import code .api .v5_1_0 .{JSONFactory510 , PostCustomerLegalNameJsonV510 }
2828import code .api .dynamic .entity .helper .{DynamicEntityHelper , DynamicEntityInfo }
2929import code .api .v6_0_0 .JSONFactory600 .{AddUserToGroupResponseJsonV600 , DynamicEntityDiagnosticsJsonV600 , DynamicEntityIssueJsonV600 , GroupEntitlementJsonV600 , GroupEntitlementsJsonV600 , GroupJsonV600 , GroupsJsonV600 , PostGroupJsonV600 , PostGroupMembershipJsonV600 , PostResetPasswordUrlJsonV600 , PutGroupJsonV600 , ReferenceTypeJsonV600 , ReferenceTypesJsonV600 , ResetPasswordUrlJsonV600 , RoleWithEntitlementCountJsonV600 , RolesWithEntitlementCountsJsonV600 , ScannedApiVersionJsonV600 , UpdateViewJsonV600 , UserGroupMembershipJsonV600 , UserGroupMembershipsJsonV600 , ValidateUserEmailJsonV600 , ValidateUserEmailResponseJsonV600 , ViewJsonV600 , ViewPermissionJsonV600 , ViewPermissionsJsonV600 , ViewsJsonV600 , createAbacRuleJsonV600 , createAbacRulesJsonV600 , createActiveRateLimitsJsonV600 , createCallLimitJsonV600 , createRedisCallCountersJson }
30- import code .api .v6_0_0 .{AbacRuleJsonV600 , AbacRuleResultJsonV600 , AbacRulesJsonV600 , CreateAbacRuleJsonV600 , CurrentConsumerJsonV600 , ExecuteAbacRuleJsonV600 , UpdateAbacRuleJsonV600 }
30+ import code .api .v6_0_0 .{AbacRuleJsonV600 , AbacRuleResultJsonV600 , AbacRulesJsonV600 , CacheConfigJsonV600 , CacheInfoJsonV600 , CacheNamespaceInfoJsonV600 , CacheProviderConfigJsonV600 , CreateAbacRuleJsonV600 , CurrentConsumerJsonV600 , ExecuteAbacRuleJsonV600 , UpdateAbacRuleJsonV600 }
3131import code .api .v6_0_0 .OBPAPI6_0_0
3232import code .abacrule .{AbacRuleEngine , MappedAbacRuleProvider }
3333import code .metrics .APIMetrics
@@ -658,6 +658,133 @@ trait APIMethods600 {
658658 }
659659 }
660660
661+ staticResourceDocs += ResourceDoc (
662+ getCacheConfig,
663+ implementedInApiVersion,
664+ nameOf(getCacheConfig),
665+ " GET" ,
666+ " /system/cache/config" ,
667+ " Get Cache Configuration" ,
668+ """ Returns cache configuration information including:
669+ |
670+ |- Available cache providers (Redis, In-Memory)
671+ |- Redis connection details (URL, port, SSL)
672+ |- Instance ID and environment
673+ |- Global cache namespace prefix
674+ |
675+ |This helps understand what cache backend is being used and how it's configured.
676+ |
677+ |Authentication is Required
678+ |""" ,
679+ EmptyBody ,
680+ CacheConfigJsonV600 (
681+ providers = List (
682+ CacheProviderConfigJsonV600 (
683+ provider = " redis" ,
684+ enabled = true ,
685+ url = Some (" 127.0.0.1" ),
686+ port = Some (6379 ),
687+ use_ssl = Some (false )
688+ ),
689+ CacheProviderConfigJsonV600 (
690+ provider = " in_memory" ,
691+ enabled = true ,
692+ url = None ,
693+ port = None ,
694+ use_ssl = None
695+ )
696+ ),
697+ instance_id = " obp" ,
698+ environment = " dev" ,
699+ global_prefix = " obp_dev_"
700+ ),
701+ List (
702+ UserNotLoggedIn ,
703+ UserHasMissingRoles ,
704+ UnknownError
705+ ),
706+ List (apiTagCache, apiTagSystem, apiTagApi),
707+ Some (List (canGetCacheConfig))
708+ )
709+
710+ lazy val getCacheConfig : OBPEndpoint = {
711+ case " system" :: " cache" :: " config" :: Nil JsonGet _ => {
712+ cc => implicit val ec = EndpointContext (Some (cc))
713+ for {
714+ (Full (u), callContext) <- authenticatedAccess(cc)
715+ _ <- NewStyle .function.hasEntitlement(" " , u.userId, canGetCacheConfig, callContext)
716+ } yield {
717+ val result = JSONFactory600 .createCacheConfigJsonV600()
718+ (result, HttpCode .`200`(callContext))
719+ }
720+ }
721+ }
722+
723+ staticResourceDocs += ResourceDoc (
724+ getCacheInfo,
725+ implementedInApiVersion,
726+ nameOf(getCacheInfo),
727+ " GET" ,
728+ " /system/cache/info" ,
729+ " Get Cache Information" ,
730+ """ Returns detailed cache information for all namespaces:
731+ |
732+ |- Namespace ID and versioned prefix
733+ |- Current version counter
734+ |- Number of keys in each namespace
735+ |- Description and category
736+ |- Total key count across all namespaces
737+ |- Redis availability status
738+ |
739+ |This endpoint helps monitor cache usage and identify which namespaces contain the most data.
740+ |
741+ |Authentication is Required
742+ |""" ,
743+ EmptyBody ,
744+ CacheInfoJsonV600 (
745+ namespaces = List (
746+ CacheNamespaceInfoJsonV600 (
747+ namespace_id = " call_counter" ,
748+ prefix = " obp_dev_call_counter_1_" ,
749+ current_version = 1 ,
750+ key_count = 42 ,
751+ description = " Rate limit call counters" ,
752+ category = " Rate Limiting"
753+ ),
754+ CacheNamespaceInfoJsonV600 (
755+ namespace_id = " rd_localised" ,
756+ prefix = " obp_dev_rd_localised_1_" ,
757+ current_version = 1 ,
758+ key_count = 128 ,
759+ description = " Localized resource docs" ,
760+ category = " API Documentation"
761+ )
762+ ),
763+ total_keys = 170 ,
764+ redis_available = true
765+ ),
766+ List (
767+ UserNotLoggedIn ,
768+ UserHasMissingRoles ,
769+ UnknownError
770+ ),
771+ List (apiTagCache, apiTagSystem, apiTagApi),
772+ Some (List (canGetCacheInfo))
773+ )
774+
775+ lazy val getCacheInfo : OBPEndpoint = {
776+ case " system" :: " cache" :: " info" :: Nil JsonGet _ => {
777+ cc => implicit val ec = EndpointContext (Some (cc))
778+ for {
779+ (Full (u), callContext) <- authenticatedAccess(cc)
780+ _ <- NewStyle .function.hasEntitlement(" " , u.userId, canGetCacheInfo, callContext)
781+ } yield {
782+ val result = JSONFactory600 .createCacheInfoJsonV600()
783+ (result, HttpCode .`200`(callContext))
784+ }
785+ }
786+ }
787+
661788 lazy val getCurrentConsumer : OBPEndpoint = {
662789 case " consumers" :: " current" :: Nil JsonGet _ => {
663790 cc => {
0 commit comments