def validate(self): if not isinstance(self.resource_type, ResourceType): raise IllegalArgumentError( "resource_type must be a ResourceType object") if not isinstance(self.pattern_type, ACLResourcePatternType): raise IllegalArgumentError( "pattern_type must be an ACLResourcePatternType object")
def __init__( self, resource_type, operation, permission_type, pattern_type=None, name=None, principal=None, host=None, ): if not isinstance(resource_type, ACLResourceType): raise IllegalArgumentError("resource_param must be of type " "ACLResourceType") self.resource_type = resource_type if not isinstance(operation, ACLOperation): raise IllegalArgumentError("operation must be of type " "ACLOperation") self.operation = operation if not isinstance(permission_type, ACLPermissionType): raise IllegalArgumentError("permission_type must be of type " "ACLPermissionType") self.permission_type = permission_type if pattern_type is not None and not isinstance(pattern_type, ACLPatternType): raise IllegalArgumentError("pattern_type must be of type " "ACLPatternType") self.pattern_type = pattern_type self.name = name self.principal = principal self.host = host
def validate(self): if self.operation == ACLOperation.ANY: raise IllegalArgumentError("operation cannot be ANY") if self.permission_type == ACLPermissionType.ANY: raise IllegalArgumentError("permission_type cannot be ANY") if not isinstance(self.resource_pattern, ResourcePattern): raise IllegalArgumentError( "resource_pattern must be a ResourcePattern object")
def _convert_create_acls_resource_request_v0(acl_resource): if acl_resource.operation == ACLOperation.ANY: raise IllegalArgumentError("operation must not be ANY") if acl_resource.permission_type == ACLPermissionType.ANY: raise IllegalArgumentError("permission_type must not be ANY") return (acl_resource.resource_type, acl_resource.name, acl_resource.principal, acl_resource.host, acl_resource.operation, acl_resource.permission_type)
def validate(self): if self.resource_type == ResourceType.ANY: raise IllegalArgumentError("resource_type cannot be ANY") if self.pattern_type in [ ACLResourcePatternType.ANY, ACLResourcePatternType.MATCH ]: raise IllegalArgumentError( "pattern_type cannot be {} on a concrete ResourcePattern". format(self.pattern_type.name))
def validate(self): if not isinstance(self.operation, ACLOperation): raise IllegalArgumentError( "operation must be an ACLOperation object, and cannot be ANY") if not isinstance(self.permission_type, ACLPermissionType): raise IllegalArgumentError( "permission_type must be an ACLPermissionType object, and cannot be ANY" ) if not isinstance(self.resource_pattern, ResourcePatternFilter): raise IllegalArgumentError( "resource_pattern must be a ResourcePatternFilter object")
def __init__( self, name, num_partitions, replication_factor, replica_assignments=None, topic_configs=None, ): if not (num_partitions == -1 or replication_factor == -1) ^ (replica_assignments is None): raise IllegalArgumentError( "either num_partitions/replication_factor or replica_assignment must be specified" ) self.name = name self.num_partitions = num_partitions self.replication_factor = replication_factor self.replica_assignments = replica_assignments or {} self.topic_configs = topic_configs or {}