Class CerbosBlockingAdminClient


  • public class CerbosBlockingAdminClient
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AddOrUpdatePolicyRequestBuilder addOrUpdatePolicy()
      Add or update policies to the Cerbos policy repository.
      AddOrUpdateSchemaRequestBuilder addOrUpdateSchema()
      Add or update schemas
      long deleteSchema​(java.lang.String... ids)
      Delete schemas by ID
      long disablePolicy​(java.lang.String... ids)
      Disable a policy by ID
      long enablePolicy​(java.lang.String... ids)
      Enable a policy by ID
      java.util.List<PolicyOuterClass.Policy> getPolicy​(java.lang.String... ids)
      Get the policy definitions for the given IDs
      java.util.List<SchemaOuterClass.Schema> getSchema​(java.lang.String... ids)
      Get a schema definition by ID
      java.util.List<java.lang.String> listActivePolicies​(java.util.Optional<java.lang.String> nameRegex, java.util.Optional<java.lang.String> versionRegex, java.util.Optional<java.lang.String> scopeRegex)
      List the enabled policies in the policy repository.
      java.util.List<java.lang.String> listAllPolicies​(java.util.Optional<java.lang.String> nameRegex, java.util.Optional<java.lang.String> versionRegex, java.util.Optional<java.lang.String> scopeRegex)
      List all policies including disabled policies
      java.util.List<java.lang.String> listSchemas()
      List the schemas in the policy repository
      void storeReload​(boolean wait)
      Force Cerbos to refresh the policy store
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • listActivePolicies

        public java.util.List<java.lang.String> listActivePolicies​(java.util.Optional<java.lang.String> nameRegex,
                                                                   java.util.Optional<java.lang.String> versionRegex,
                                                                   java.util.Optional<java.lang.String> scopeRegex)
        List the enabled policies in the policy repository.
        Parameters:
        nameRegex - Optional regex to filter to policy name by
        versionRegex - Optional regex to filter the policy version by
        scopeRegex - Optional regex to filter the policy scope by
        Returns:
        List of policy IDs
        Throws:
        CerbosException - if an RPC error occurrs
      • listAllPolicies

        public java.util.List<java.lang.String> listAllPolicies​(java.util.Optional<java.lang.String> nameRegex,
                                                                java.util.Optional<java.lang.String> versionRegex,
                                                                java.util.Optional<java.lang.String> scopeRegex)
        List all policies including disabled policies
        Parameters:
        nameRegex - Optional regex to filter the policy name by
        versionRegex - Optional regex to filter the policy version by
        scopeRegex - Optional regex to filter the policy scope by
        Returns:
        List of policy IDs
        Throws:
        CerbosException - if an RPC error occurrs
      • getPolicy

        public java.util.List<PolicyOuterClass.Policy> getPolicy​(java.lang.String... ids)
        Get the policy definitions for the given IDs
        Parameters:
        ids - IDs to retrieve
        Returns:
        List of policy definitions
        Throws:
        CerbosException - if an RPC error occurrs
      • enablePolicy

        public long enablePolicy​(java.lang.String... ids)
        Enable a policy by ID
        Parameters:
        ids - IDs of policies to enable
        Returns:
        Number of enabled policies
        Throws:
        CerbosException - if an RPC error occurrs
      • disablePolicy

        public long disablePolicy​(java.lang.String... ids)
        Disable a policy by ID
        Parameters:
        ids - IDs of policies to disable
        Returns:
        Number of disabled policies
        Throws:
        CerbosException - if an RPC error occurrs
      • listSchemas

        public java.util.List<java.lang.String> listSchemas()
        List the schemas in the policy repository
        Returns:
        List of schema IDs
        Throws:
        CerbosException - if an RPC error occurrs
      • getSchema

        public java.util.List<SchemaOuterClass.Schema> getSchema​(java.lang.String... ids)
        Get a schema definition by ID
        Parameters:
        ids - IDs of schemas to retrieve
        Returns:
        List of schemas
        Throws:
        CerbosException - if an RPC error occurrs
      • deleteSchema

        public long deleteSchema​(java.lang.String... ids)
        Delete schemas by ID
        Parameters:
        ids - IDs of schemas to delete
        Returns:
        Number of schemas deleted
        Throws:
        CerbosException - if an RPC error occurrs
      • storeReload

        public void storeReload​(boolean wait)
        Force Cerbos to refresh the policy store
        Parameters:
        wait - Block while the refresh is happening
        Throws:
        CerbosException - if an RPC error occurrs