forked from lensesio/schema-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_deprecated.go
46 lines (38 loc) · 1.23 KB
/
client_deprecated.go
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
package schemaregistry
import (
"crypto/tls"
"errors"
"net/http"
"net/url"
)
// DefaultUrl is the address where a local schema registry listens by default.
//
// DEPRECATED: Use `schemaregistry.DefaultURL` instead.
const DefaultUrl = DefaultURL
// GetSchemaById returns the schema for some id.
// The schema registry only provides the schema itself, not the id, subject or version.
//
// DEPRECATED: Use `Client#GetSchemaByID` instead.
func (c *Client) GetSchemaById(id int) (string, error) {
return c.GetSchemaByID(id)
}
// NewTlsClient returns a new Client that securely connects to baseurl.
//
// DEPRECATED: Use `schemaregistry.NewClient(baseURL, schemaregistry.UsingClient(customHTTPSClient))` instead.
func NewTlsClient(baseurl string, tlsConfig *tls.Config) (*Client, error) {
u, err := url.Parse(baseurl)
if err != nil {
return nil, err
}
if u.Scheme != "https" {
return nil, errors.New("func NewTlsClient: This method only accepts HTTPS URLs")
}
// TODO: Consider using golang.org/x/net/http2 to enable HTTP/2 with HTTPS connections
httpsClientTransport := &http.Transport{
TLSClientConfig: tlsConfig,
}
httpsClient := &http.Client{
Transport: httpsClientTransport,
}
return NewClient(baseurl, UsingClient(httpsClient))
}