github.com/landoop/schema-registry@v0.0.0-20190327143759-50a5701c1891/client_deprecated.go (about) 1 package schemaregistry 2 3 import ( 4 "crypto/tls" 5 "errors" 6 "net/http" 7 "net/url" 8 ) 9 10 // DefaultUrl is the address where a local schema registry listens by default. 11 // 12 // DEPRECATED: Use `schemaregistry.DefaultURL` instead. 13 const DefaultUrl = DefaultURL 14 15 // GetSchemaById returns the schema for some id. 16 // The schema registry only provides the schema itself, not the id, subject or version. 17 // 18 // DEPRECATED: Use `Client#GetSchemaByID` instead. 19 func (c *Client) GetSchemaById(id int) (string, error) { 20 return c.GetSchemaByID(id) 21 } 22 23 // NewTlsClient returns a new Client that securely connects to baseurl. 24 // 25 // DEPRECATED: Use `schemaregistry.NewClient(baseURL, schemaregistry.UsingClient(customHTTPSClient))` instead. 26 func NewTlsClient(baseurl string, tlsConfig *tls.Config) (*Client, error) { 27 u, err := url.Parse(baseurl) 28 if err != nil { 29 return nil, err 30 } 31 32 if u.Scheme != "https" { 33 return nil, errors.New("func NewTlsClient: This method only accepts HTTPS URLs") 34 } 35 36 // TODO: Consider using golang.org/x/net/http2 to enable HTTP/2 with HTTPS connections 37 httpsClientTransport := &http.Transport{ 38 TLSClientConfig: tlsConfig, 39 } 40 41 httpsClient := &http.Client{ 42 Transport: httpsClientTransport, 43 } 44 45 return NewClient(baseurl, UsingClient(httpsClient)) 46 }