kafka_rest_proxy_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +129 -0
- data/Rakefile +8 -0
- data/bin/console +9 -0
- data/docs/Body.md +12 -0
- data/docs/InlineResponse200.md +10 -0
- data/docs/InlineResponse200Offsets.md +11 -0
- data/docs/Offset.md +11 -0
- data/docs/ProducerApi.md +58 -0
- data/docs/ProducerRequest.md +12 -0
- data/docs/ProducerResponse.md +10 -0
- data/docs/Record.md +10 -0
- data/docs/TopicstopicNameRecords.md +10 -0
- data/git_push.sh +55 -0
- data/kafka_rest_proxy_client.gemspec +33 -0
- data/lib/kafka_rest_proxy_client.rb +48 -0
- data/lib/kafka_rest_proxy_client/api/producer_api.rb +69 -0
- data/lib/kafka_rest_proxy_client/api_client.rb +364 -0
- data/lib/kafka_rest_proxy_client/api_error.rb +26 -0
- data/lib/kafka_rest_proxy_client/configuration.rb +184 -0
- data/lib/kafka_rest_proxy_client/models/body.rb +214 -0
- data/lib/kafka_rest_proxy_client/models/inline_response_200.rb +196 -0
- data/lib/kafka_rest_proxy_client/models/inline_response_200_offsets.rb +203 -0
- data/lib/kafka_rest_proxy_client/models/offset.rb +203 -0
- data/lib/kafka_rest_proxy_client/models/producer_request.rb +214 -0
- data/lib/kafka_rest_proxy_client/models/producer_response.rb +196 -0
- data/lib/kafka_rest_proxy_client/models/record.rb +194 -0
- data/lib/kafka_rest_proxy_client/models/topicstopic_name_records.rb +194 -0
- data/lib/kafka_rest_proxy_client/version.rb +3 -0
- data/spec/api/producer_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/body_spec.rb +65 -0
- data/spec/models/inline_response_200_offsets_spec.rb +59 -0
- data/spec/models/inline_response_200_spec.rb +53 -0
- data/spec/models/offset_spec.rb +59 -0
- data/spec/models/producer_request_spec.rb +65 -0
- data/spec/models/producer_response_spec.rb +53 -0
- data/spec/models/record_spec.rb +53 -0
- data/spec/models/topicstopic_name_records_spec.rb +53 -0
- data/spec/spec_helper.rb +110 -0
- data/swagger.yml +170 -0
- metadata +279 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2eb4861879df241dd8ac4ec8437380950ff70691
|
4
|
+
data.tar.gz: ccf9adcdb6ce4128d4b86615ce2e19da58569651
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 710401f834fedd0d284fc57ee7978467370953f85fe9ec558ba71678ea4b2a17d94b580c9e4d3a1af439437aadb11f7a7963667d637c0c887783fc801b2948c8
|
7
|
+
data.tar.gz: 87273069d4007d169fa4d8f3575d7e576b4996e58310fcc28012f41ec70c4c6626038a4a155491c1845512f0bfa64904816f2f848dcd4dd0c8ba3a574e30eebf
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kafka_rest_proxy_client (0.1.0)
|
5
|
+
json (~> 1.8, >= 1.8.3)
|
6
|
+
typhoeus (~> 1.0, >= 1.0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ZenTest (4.11.1)
|
12
|
+
addressable (2.5.0)
|
13
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
14
|
+
autotest (4.4.6)
|
15
|
+
ZenTest (>= 4.4.1)
|
16
|
+
autotest-fsevent (0.2.12)
|
17
|
+
sys-uname
|
18
|
+
autotest-growl (0.2.16)
|
19
|
+
autotest-rails-pure (4.1.2)
|
20
|
+
crack (0.4.3)
|
21
|
+
safe_yaml (~> 1.0.0)
|
22
|
+
diff-lcs (1.3)
|
23
|
+
ethon (0.10.1)
|
24
|
+
ffi (>= 1.3.0)
|
25
|
+
ffi (1.9.17)
|
26
|
+
hashdiff (0.3.2)
|
27
|
+
json (1.8.6)
|
28
|
+
public_suffix (2.0.5)
|
29
|
+
rake (12.0.0)
|
30
|
+
rspec (3.5.0)
|
31
|
+
rspec-core (~> 3.5.0)
|
32
|
+
rspec-expectations (~> 3.5.0)
|
33
|
+
rspec-mocks (~> 3.5.0)
|
34
|
+
rspec-core (3.5.4)
|
35
|
+
rspec-support (~> 3.5.0)
|
36
|
+
rspec-expectations (3.5.0)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.5.0)
|
39
|
+
rspec-mocks (3.5.0)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.5.0)
|
42
|
+
rspec-support (3.5.0)
|
43
|
+
safe_yaml (1.0.4)
|
44
|
+
sys-uname (1.0.3)
|
45
|
+
ffi (>= 1.0.0)
|
46
|
+
typhoeus (1.1.2)
|
47
|
+
ethon (>= 0.9.0)
|
48
|
+
vcr (3.0.3)
|
49
|
+
webmock (1.24.6)
|
50
|
+
addressable (>= 2.3.6)
|
51
|
+
crack (>= 0.3.2)
|
52
|
+
hashdiff
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
autotest (~> 4.4, >= 4.4.6)
|
59
|
+
autotest-fsevent (~> 0.2, >= 0.2.11)
|
60
|
+
autotest-growl (~> 0.2, >= 0.2.16)
|
61
|
+
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
62
|
+
kafka_rest_proxy_client!
|
63
|
+
rake (~> 12.0.0)
|
64
|
+
rspec (~> 3.4, >= 3.4.0)
|
65
|
+
vcr (~> 3.0, >= 3.0.1)
|
66
|
+
webmock (~> 1.24, >= 1.24.3)
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
1.13.6
|
data/README.md
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
# kafka_rest_proxy_client
|
2
|
+
|
3
|
+
KafkaProxyRestClient - a Ruby gem for the Kafka REST Proxy API
|
4
|
+
|
5
|
+
An initial draft of the [Kafka REST Proxy API](https://github.com/confluentinc/kafka-rest).
|
6
|
+
|
7
|
+
## Example JSON request
|
8
|
+
|
9
|
+
```
|
10
|
+
POST /topics/test HTTP/1.1
|
11
|
+
Host: kafkaproxy.example.com
|
12
|
+
Content-Type: application/vnd.kafka.json.v2+json
|
13
|
+
Accept: application/vnd.kafka.v2+json, application/vnd.kafka+json, application/json
|
14
|
+
{
|
15
|
+
"records": [
|
16
|
+
{
|
17
|
+
"key": "somekey",
|
18
|
+
"value": {"foo": "bar"}
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"value": [ "foo", "bar" ],
|
22
|
+
"partition": 1
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"value": 53.5
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
```
|
30
|
+
|
31
|
+
## Example JSON response
|
32
|
+
|
33
|
+
```
|
34
|
+
HTTP/1.1 200 OK
|
35
|
+
Content-Type: application/vnd.kafka.v2+json
|
36
|
+
{
|
37
|
+
"key_schema_id": null,
|
38
|
+
"value_schema_id": null,
|
39
|
+
"offsets": [
|
40
|
+
{
|
41
|
+
"partition": 2,
|
42
|
+
"offset": 100
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"partition": 1,
|
46
|
+
"offset": 101
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"partition": 2,
|
50
|
+
"offset": 102
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
57
|
+
|
58
|
+
- API version: 0.1.0
|
59
|
+
- Package version: 1.0.0
|
60
|
+
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
61
|
+
|
62
|
+
## Installation
|
63
|
+
|
64
|
+
### Build a gem
|
65
|
+
|
66
|
+
To build the Ruby code into a gem:
|
67
|
+
|
68
|
+
```shell
|
69
|
+
gem build kafka_rest_proxy_client.gemspec
|
70
|
+
```
|
71
|
+
|
72
|
+
Then either install the gem locally:
|
73
|
+
|
74
|
+
```shell
|
75
|
+
gem install ./kafka_rest_proxy_client-1.0.0.gem
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
### Install from Git
|
80
|
+
|
81
|
+
gem 'kafka_rest_proxy_client', git: 'https://github.com/mzaccari/kafka-rest-proxy-ruby-client.git'
|
82
|
+
|
83
|
+
|
84
|
+
## Getting Started
|
85
|
+
|
86
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
87
|
+
```ruby
|
88
|
+
# Load the gem
|
89
|
+
require 'kafka_rest_proxy_client'
|
90
|
+
|
91
|
+
KafkaProxyRestClient.configure do |config|
|
92
|
+
config.host = "127.0.0.1:8082"
|
93
|
+
config.scheme = "http"
|
94
|
+
config.base_path = "/"
|
95
|
+
end
|
96
|
+
|
97
|
+
topic_name = "topic_name_example"
|
98
|
+
|
99
|
+
api_client = KafkaProxyRestClient::ProducerApi.new
|
100
|
+
record = KafkaProxyRestClient::Record.new(value: { hello: 'world' })
|
101
|
+
request = KafkaProxyRestClient::ProducerRequest.new(records: [record])
|
102
|
+
|
103
|
+
begin
|
104
|
+
result = api_client.publish(topic_name, request)
|
105
|
+
p result
|
106
|
+
rescue KafkaProxyRestClient::ApiError => e
|
107
|
+
puts "Exception when calling ProducerApi->topics_topic_name_post: #{e}"
|
108
|
+
end
|
109
|
+
|
110
|
+
```
|
111
|
+
|
112
|
+
## Documentation for API Endpoints
|
113
|
+
|
114
|
+
All URIs are relative to *https://localhost*
|
115
|
+
|
116
|
+
Class | Method | HTTP request | Description
|
117
|
+
------------ | ------------- | ------------- | -------------
|
118
|
+
*KafkaProxyRestClient::ProducerApi* | [**publish**](docs/ProducerApi.md#topics_topic_name_post) | **POST** /topics/{topic_name} |
|
119
|
+
|
120
|
+
|
121
|
+
## Documentation for Models
|
122
|
+
|
123
|
+
- [KafkaProxyRestClient::ProducerRequest](docs/ProducerRequest.md)
|
124
|
+
- [KafkaProxyRestClient::ProducerResponse](docs/ProducerResponse.md)
|
125
|
+
- [KafkaProxyRestClient::Record](docs/Record.md)
|
126
|
+
|
127
|
+
## Documentation for Authorization
|
128
|
+
|
129
|
+
All endpoints do not require authorization.
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/docs/Body.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# KafkaProxyRestClient::Body
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**records** | [**Array<TopicstopicNameRecords>**](TopicstopicNameRecords.md) | | [optional]
|
7
|
+
**key_schema** | **String** | | [optional]
|
8
|
+
**key_schema_id** | **Integer** | | [optional]
|
9
|
+
**value_schema** | **String** | | [optional]
|
10
|
+
**value_schema_id** | **Integer** | | [optional]
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# KafkaProxyRestClient::InlineResponse200
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**offsets** | [**Array<InlineResponse200Offsets>**](InlineResponse200Offsets.md) | | [optional]
|
7
|
+
**key_schema_id** | **Integer** | | [optional]
|
8
|
+
**value_schema_id** | **Integer** | | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# KafkaProxyRestClient::InlineResponse200Offsets
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**partition** | **Integer** | | [optional]
|
7
|
+
**offset** | **Integer** | | [optional]
|
8
|
+
**error_code** | **Integer** | | [optional]
|
9
|
+
**error** | **String** | | [optional]
|
10
|
+
|
11
|
+
|
data/docs/Offset.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# KafkaProxyRestClient::Offset
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**partition** | **Integer** | | [optional]
|
7
|
+
**offset** | **Integer** | | [optional]
|
8
|
+
**error_code** | **Integer** | | [optional]
|
9
|
+
**error** | **String** | | [optional]
|
10
|
+
|
11
|
+
|
data/docs/ProducerApi.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# KafkaProxyRestClient::ProducerApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://localhost*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**topics_topic_name_post**](ProducerApi.md#topics_topic_name_post) | **POST** /topics/{topic_name} |
|
8
|
+
|
9
|
+
|
10
|
+
# **topics_topic_name_post**
|
11
|
+
> InlineResponse200 topics_topic_name_post(topic_name, body)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
Produce messages to a topic, optionally specifying keys or partitions for the messages. If no partition is provided, one will be chosen based on the hash of the key. If no key is provided, the partition will be chosen for each message in a round-robin fashion. # For the ``avro`` embedded format, you must provide information about schemas and the REST proxy must be configured with the URL to access the schema registry (``schema.registry.connect``). Schemas may be provided as the full schema encoded as a string, or, after the initial request may be provided as the schema ID returned with the first response.
|
16
|
+
|
17
|
+
### Example
|
18
|
+
```ruby
|
19
|
+
# load the gem
|
20
|
+
require 'kafka_rest_proxy_client'
|
21
|
+
|
22
|
+
api_instance = KafkaProxyRestClient::ProducerApi.new
|
23
|
+
|
24
|
+
topic_name = "topic_name_example" # String | Name of the topic to produce the messages to
|
25
|
+
|
26
|
+
body = KafkaProxyRestClient::Body.new # Body | Data to send to the kafka topic.
|
27
|
+
|
28
|
+
|
29
|
+
begin
|
30
|
+
result = api_instance.topics_topic_name_post(topic_name, body)
|
31
|
+
p result
|
32
|
+
rescue KafkaProxyRestClient::ApiError => e
|
33
|
+
puts "Exception when calling ProducerApi->topics_topic_name_post: #{e}"
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### Parameters
|
38
|
+
|
39
|
+
Name | Type | Description | Notes
|
40
|
+
------------- | ------------- | ------------- | -------------
|
41
|
+
**topic_name** | **String**| Name of the topic to produce the messages to |
|
42
|
+
**body** | [**Body**](Body.md)| Data to send to the kafka topic. |
|
43
|
+
|
44
|
+
### Return type
|
45
|
+
|
46
|
+
[**InlineResponse200**](InlineResponse200.md)
|
47
|
+
|
48
|
+
### Authorization
|
49
|
+
|
50
|
+
No authorization required
|
51
|
+
|
52
|
+
### HTTP request headers
|
53
|
+
|
54
|
+
- **Content-Type**: application/vnd.kafka.v2+json, application/vnd.kafka+json, application/json
|
55
|
+
- **Accept**: application/vnd.kafka.v2+json, application/vnd.kafka+json, application/json
|
56
|
+
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# KafkaProxyRestClient::ProducerRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**records** | [**Array<TopicstopicNameRecords>**](TopicstopicNameRecords.md) | | [optional]
|
7
|
+
**key_schema** | **String** | | [optional]
|
8
|
+
**key_schema_id** | **Integer** | | [optional]
|
9
|
+
**value_schema** | **String** | | [optional]
|
10
|
+
**value_schema_id** | **Integer** | | [optional]
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# KafkaProxyRestClient::ProducerResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**offsets** | [**Array<InlineResponse200Offsets>**](InlineResponse200Offsets.md) | | [optional]
|
7
|
+
**key_schema_id** | **Integer** | | [optional]
|
8
|
+
**value_schema_id** | **Integer** | | [optional]
|
9
|
+
|
10
|
+
|
data/docs/Record.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# KafkaProxyRestClient::Record
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**key** | **Object** | | [optional]
|
7
|
+
**value** | **Object** | | [optional]
|
8
|
+
**partition** | **Integer** | | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# KafkaProxyRestClient::TopicstopicNameRecords
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**key** | **Object** | | [optional]
|
7
|
+
**value** | **Object** | | [optional]
|
8
|
+
**partition** | **Integer** | | [optional]
|
9
|
+
|
10
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id=""
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id=""
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note=""
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|