Created
October 8, 2020 21:16
-
-
Save NickLarsenNZ/1729ddd9117561d01e3029345241b610 to your computer and use it in GitHub Desktop.
mockhttp responders for for Kafka Connect API
This file contains hidden or 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
| responders: | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get-- | |
| - when: | |
| http: | |
| method: GET | |
| path: / | |
| then: | |
| http: | |
| status: 200 | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "version":"5.5.0", | |
| "commit":"e5741b90cde98052", | |
| "kafka_cluster_id":"I4ZmrWqfT2e-upky_4fdPA" | |
| } | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors | |
| - when: | |
| http: | |
| method: GET | |
| path: /connectors | |
| then: | |
| http: | |
| status: 200 | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| ["jdbc-source-connector", "hdfs-sink-connector"] | |
| # https://docs.confluent.io/current/connect/references/restapi.html#post--connectors | |
| - when: | |
| http: | |
| method: POST | |
| path: /connectors | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "name": "hdfs-sink-connector", | |
| "config": { | |
| "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector", | |
| "tasks.max": "10", | |
| "topics": "test-topic", | |
| "hdfs.url": "hdfs://fakehost:9000", | |
| "hadoop.conf.dir": "/opt/hadoop/conf", | |
| "hadoop.home": "/opt/hadoop", | |
| "flush.size": "100", | |
| "rotate.interval.ms": "1000" | |
| } | |
| } | |
| then: | |
| http: | |
| status: 201 | |
| message: Created | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "name": "hdfs-sink-connector", | |
| "config": { | |
| "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector", | |
| "tasks.max": "10", | |
| "topics": "test-topic", | |
| "hdfs.url": "hdfs://fakehost:9000", | |
| "hadoop.conf.dir": "/opt/hadoop/conf", | |
| "hadoop.home": "/opt/hadoop", | |
| "flush.size": "100", | |
| "rotate.interval.ms": "1000" | |
| }, | |
| "tasks": [ | |
| { "connector": "hdfs-sink-connector", "task": 1 }, | |
| { "connector": "hdfs-sink-connector", "task": 2 }, | |
| { "connector": "hdfs-sink-connector", "task": 3 } | |
| ] | |
| } | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name) | |
| - when: | |
| http: | |
| method: GET | |
| path: /connectors/hdfs-sink-connector | |
| then: | |
| http: | |
| status: 200 | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "name": "hdfs-sink-connector", | |
| "config": { | |
| "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector", | |
| "tasks.max": "10", | |
| "topics": "test-topic", | |
| "hdfs.url": "hdfs://fakehost:9000", | |
| "hadoop.conf.dir": "/opt/hadoop/conf", | |
| "hadoop.home": "/opt/hadoop", | |
| "flush.size": "100", | |
| "rotate.interval.ms": "1000" | |
| }, | |
| "tasks": [ | |
| { "connector": "hdfs-sink-connector", "task": 1 }, | |
| { "connector": "hdfs-sink-connector", "task": 2 }, | |
| { "connector": "hdfs-sink-connector", "task": 3 } | |
| ] | |
| } | |
| - when: | |
| http: | |
| method: GET | |
| path: /connectors/non-existant | |
| then: | |
| http: | |
| status: 404 | |
| message: Not Found | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "error_code": 404, | |
| "message": "Connector non-existant not found" | |
| } | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name)-config | |
| - when: | |
| http: | |
| method: GET | |
| path: /connectors/hdfs-sink-connector/config | |
| then: | |
| http: | |
| status: 200 | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector", | |
| "tasks.max": "10", | |
| "topics": "test-topic", | |
| "hdfs.url": "hdfs://fakehost:9000", | |
| "hadoop.conf.dir": "/opt/hadoop/conf", | |
| "hadoop.home": "/opt/hadoop", | |
| "flush.size": "100", | |
| "rotate.interval.ms": "1000" | |
| } | |
| - when: | |
| http: | |
| method: GET | |
| path: /connectors/non-existant/config | |
| then: | |
| http: | |
| status: 404 | |
| message: Not Found | |
| headers: | |
| Content-Type: application/json | |
| body: | | |
| { | |
| "error_code": 404, | |
| "message": "Connector non-existant not found" | |
| } | |
| # Todo | |
| # https://docs.confluent.io/current/connect/references/restapi.html#put--connectors-(string-name)-config | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name)-status | |
| # https://docs.confluent.io/current/connect/references/restapi.html#post--connectors-(string-name)-restart | |
| # https://docs.confluent.io/current/connect/references/restapi.html#put--connectors-(string-name)-pause | |
| # https://docs.confluent.io/current/connect/references/restapi.html#put--connectors-(string-name)-resume | |
| # https://docs.confluent.io/current/connect/references/restapi.html#delete--connectors-(string-name)- | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name)-tasks | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name)-tasks-(int-taskid)-status | |
| # https://docs.confluent.io/current/connect/references/restapi.html#post--connectors-(string-name)-tasks-(int-taskid)-restart | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connectors-(string-name)-topics | |
| # https://docs.confluent.io/current/connect/references/restapi.html#put--connectors-(string-name)-topics-reset | |
| # https://docs.confluent.io/current/connect/references/restapi.html#get--connector-plugins- | |
| # https://docs.confluent.io/current/connect/references/restapi.html#put--connector-plugins-(string-name)-config-validate | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment