Documentation ¶
Overview ¶
Copyright 2020 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SHA256 scram.HashGeneratorFcn = func() hash.Hash { return sha256.New() }
SHA256 hash generator function for SCRAM conversation
var SHA512 scram.HashGeneratorFcn = func() hash.Hash { return sha512.New() }
SHA512 hash generator function for SCRAM conversation
Functions ¶
func ConfigEqual ¶
ConfigEqual is a convenience function to determine if two given sarama.Config structs are identical aside from unserializable fields (e.g. function pointers). To ignore parts of the sarama.Config struct, pass them in as the "ignore" parameter.
func HasSameBrokers ¶ added in v0.21.0
HasSameBrokers returns true if all of the brokers in the slice are present and in the same order as the ones in the consolidated str
Types ¶
type ConfigBuilder ¶
type ConfigBuilder interface { // WithExisting makes the builder use an existing Sarama // config as a base. WithExisting(existing *sarama.Config) ConfigBuilder // WithDefaults makes the builder apply // some defaults that we always use in eventing-kafka. WithDefaults() ConfigBuilder // FromYaml makes the builder apply the settings // in a YAML-string for Sarama. FromYaml(saramaYaml string) ConfigBuilder // WithAuth makes the builder apply the TLS/SASL settings // on the config for the given KafkaAuthConfig WithAuth(kafkaAuthConfig *KafkaAuthConfig) ConfigBuilder // WithVersion makes the builder set the version // explicitly, regardless what's set in the existing config // (if provided) or in the YAML-string WithVersion(version *sarama.KafkaVersion) ConfigBuilder // WithClientId makes the builder set the clientId // explicitly, regardless what's set in the existing config // (if provided) or in the YAML-string WithClientId(clientId string) ConfigBuilder // WithInitialOffset sets the initial offset to use // if no offset was previously committed WithInitialOffset(offset v1beta1.Offset) ConfigBuilder // Build builds the Sarama config with the given context. // Context is used for getting the config at the moment. Build(ctx context.Context) (*sarama.Config, error) }
ConfigBuilder builds the Sarama config using multiple options. Precedence for the options is following: - get existing config if provided, create a new one otherwise - apply defaults - apply settings from YAML string - apply settings from KafkaAuthConfig - apply individual settings like version, clientId
func NewConfigBuilder ¶
func NewConfigBuilder() ConfigBuilder
type KafkaAuthConfig ¶
type KafkaAuthConfig struct { TLS *KafkaTlsConfig SASL *KafkaSaslConfig }
type KafkaSaslConfig ¶
func (*KafkaSaslConfig) HasSameSettings ¶ added in v0.21.0
func (c *KafkaSaslConfig) HasSameSettings(saramaConfig *sarama.Config) bool
HasSameSettings returns true if all of the SASL settings in the provided config are the same as in this struct
type KafkaTlsConfig ¶
type XDGSCRAMClient ¶
type XDGSCRAMClient struct { *scram.Client *scram.ClientConversation scram.HashGeneratorFcn }
XDGSCRAMClient struct to perform SCRAM conversation
func (*XDGSCRAMClient) Begin ¶
func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)
Begin starts SCRAM conversation
func (*XDGSCRAMClient) Done ¶
func (x *XDGSCRAMClient) Done() bool
Done completes SCRAM conversation