Class ResourceSpec

java.lang.Object
io.strimzi.kafka.oauth.server.authorizer.ResourceSpec

public class ResourceSpec extends Object
ResourceSpec is used to parse a resource matching pattern and to perform matching to a specific resource.
  • Constructor Details

    • ResourceSpec

      public ResourceSpec()
  • Method Details

    • getClusterName

      public String getClusterName()
      Get a 'kafka-cluster' value (not the same as Kafka Cluster resource type). For example: kafka-cluster:my-cluster,Cluster:kafka-cluster
      Returns:
      Cluster name
    • isClusterStartsWith

      public boolean isClusterStartsWith()
      See if 'kafka-cluster' specification uses an asterisk as in kafka-cluster:*,Topic:orders
      Returns:
      True if value ends with an asterisk
    • getResourceType

      public ResourceSpec.ResourceType getResourceType()
      Get a resource type
      Returns:
      ResourceType enum value
    • getResourceName

      public String getResourceName()
      Get resource name
      Returns:
      A resource name
    • isResourceStartsWith

      public boolean isResourceStartsWith()
      See if a resource specification uses an asterisk as in Topic:orders_*
      Returns:
      True if value ends with an asterisk
    • match

      public boolean match(String cluster, String type, String name)
      Match specific resource's cluster, type and name to this ResourceSpec If clusterName is set then cluster must match, otherwise cluster match is ignored. Type and name are always matched.
      Parameters:
      cluster - Kafka cluster name such as: my-kafka
      type - Resource type such as: Topic, Group
      name - Resource name such as: my-topic
      Returns:
      true if cluster, type and name match this resource spec
    • of

      public static ResourceSpec of(String name)
      A factory method to parse a ResourceSpec from a string
      Parameters:
      name - Resource spec as a string
      Returns:
      A ResourceSpec instance
    • toString

      public String toString()
      Overrides:
      toString in class Object