-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfluent.go
More file actions
49 lines (42 loc) · 1.5 KB
/
confluent.go
File metadata and controls
49 lines (42 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package confluent
const (
clientVersion = "0.1"
userAgent = "confluent-client-go-sdk-" + clientVersion
)
/*
Client will provide all Confluent clients
*/
type Client struct {
//httpClient provide http client to connect to confluent rest API
httpClient HttpClient
//saramaClient provider Kafka client to connect to Kafka brokers
// The reason why we need sarama client working along with http client is : Confluent provide all Kafka Feature without Kafka admin features
// So that we need to init new Kafka Client to use some functions of Kafka:
// - Update replications factors.
// - Update partitions
saramaClient SaramaClient
//saramaClient provider Kafka Admin client to connect to Kafka brokers, init and release from Sarama client.
saramaClusterAdmin SaramaClusterAdmin
}
type ErrorResponse struct {
StatusCode int `json:"status_code,omitempty"`
ErrorCode int `json:"error_code"`
Type string `json:"type,omitempty"`
Message string `json:"message"`
Errors []struct {
ErrorType string `json:"error_type,omitempty"`
Message string `json:"message,omitempty"`
} `json:"errors,omitempty"`
}
type Metadata struct {
Self string `json:"self"`
ResourceName string `json:"resource_name,omitempty"`
Next string `json:"next,omitempty"`
}
func NewClient(httpClient HttpClient, saramaClient SaramaClient, saramaClusterAdmin SaramaClusterAdmin) *Client {
return &Client{
httpClient: httpClient,
saramaClient: saramaClient,
saramaClusterAdmin: saramaClusterAdmin,
}
}