-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* YAML parser implementations * Fix dependency based on suggestion * Remove metals plugin * Fix code to work with the latest version * Fix tests and add yaml extraction support * Implement dynamic parser handling in sources * Add Yaml example * Minor tweaks * Fix tests * Update changelog and readme * Handle default case * Fix typo README.md Co-authored-by: Matthieu Baechler <matthieu.baechler@gmail.com> * Refactor refresh return type to be more clear * Make the monoid implementation leaner Co-authored-by: Matthieu Baechler <matthieu.baechler@gmail.com>
- Loading branch information
Showing
34 changed files
with
814 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
users: | ||
alice: | ||
topics: | ||
foo: | ||
- Read | ||
baz*: | ||
- Read | ||
my-kafka-streams-app*: | ||
- Create | ||
bob: | ||
groups: | ||
bar: | ||
- Write,Deny,12.34.56.78 | ||
transactional_ids: | ||
bar-*: | ||
- All | ||
peter: | ||
clusters: | ||
kafka-cluster: | ||
- Create | ||
schemareg: | ||
topics: | ||
_schemas: | ||
- All | ||
'*': | ||
- All | ||
groups: | ||
schema-registry: | ||
- All |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/scala/com/github/conduktor/ksm/parser/AclParserRegistry.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.github.conduktor.ksm.parser | ||
|
||
import com.github.conduktor.ksm.AppConfig | ||
import com.github.conduktor.ksm.parser.csv.CsvAclParser | ||
import com.github.conduktor.ksm.parser.yaml.YamlAclParser | ||
|
||
class AclParserRegistry(val appConfig: AppConfig) { | ||
|
||
val csvParser = new CsvAclParser(Option(appConfig).map(_.Parser).map(_.csvDelimiter).getOrElse(',')) | ||
val yamlParser = new YamlAclParser() | ||
|
||
val parserMap: Map[String, AclParser] = Map( | ||
csvParser.name -> csvParser, | ||
yamlParser.name -> yamlParser | ||
) | ||
|
||
def getParser(parserName: String): AclParser = { | ||
parserMap.getOrElse( | ||
parserName, | ||
throw new RuntimeException(s"Parse not found for $parserName") | ||
) | ||
} | ||
|
||
def getParserByFilename(fileName: String): AclParser = { | ||
val ext = fileName.split("\\.").last | ||
parserMap.values | ||
.find(_.matchesExtension(ext)) | ||
.getOrElse( | ||
csvParser | ||
) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/scala/com/github/conduktor/ksm/parser/ParserException.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.github.conduktor.ksm.parser | ||
|
||
/** | ||
* Wrapper to exceptions in order to keep data of the row that failed | ||
* | ||
* @param t exception that has been thrown | ||
*/ | ||
class ParserException(t: Throwable) extends RuntimeException(t) {} |
Oops, something went wrong.