diff --git a/pkg/kadm/acls.go b/pkg/kadm/acls.go index 7a9d6722..162e9d8c 100644 --- a/pkg/kadm/acls.go +++ b/pkg/kadm/acls.go @@ -71,6 +71,11 @@ type ACLBuilder struct { pattern ACLPattern } +// PrefixUser prefixes all allowed and denied principals with "User:". +func (b *ACLBuilder) PrefixUser() { + b.PrefixUserExcept() +} + // PrefixUserExcept prefixes all allowed and denied principals with "User:", // unless they have any of the given except prefixes. func (b *ACLBuilder) PrefixUserExcept(except ...string) { diff --git a/pkg/kadm/groups.go b/pkg/kadm/groups.go index 433840e1..92903aac 100644 --- a/pkg/kadm/groups.go +++ b/pkg/kadm/groups.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/twmb/franz-go/pkg/kerr" + "github.com/twmb/franz-go/pkg/kgo" "github.com/twmb/franz-go/pkg/kmsg" ) @@ -454,9 +455,6 @@ func (os OffsetResponses) Keep(o Offsets) { }) } -// Deprecated: Use Offsets; this will be removed in v1.0. -func (os OffsetResponses) Into() Offsets { return os.Offsets() } - // Offsets returns these offset responses as offsets. func (os OffsetResponses) Offsets() Offsets { i := make(Offsets) @@ -466,6 +464,11 @@ func (os OffsetResponses) Offsets() Offsets { return i } +// KOffsets returns these offset responses as a kgo offset map. +func (os OffsetResponses) KOffsets() map[string]map[int32]kgo.Offset { + return os.Offsets().KOffsets() +} + // DeleteFunc keeps only the offsets for which fn returns true. func (os OffsetResponses) KeepFunc(fn func(OffsetResponse) bool) { for t, ps := range os { diff --git a/pkg/kadm/kadm.go b/pkg/kadm/kadm.go index b4427c1d..230343f5 100644 --- a/pkg/kadm/kadm.go +++ b/pkg/kadm/kadm.go @@ -165,9 +165,6 @@ func (ps Partitions) TopicsList() TopicsList { // OffsetsList wraps many offsets and is a helper for building Offsets. type OffsetsList []Offset -// Deprecated: Use Offsets; this will be removed in v1.0. -func (l OffsetsList) Into() Offsets { return l.Offsets() } - // Offsets returns this list as the non-list Offsets. All fields in each // Offset must be set properly. func (l OffsetsList) Offsets() Offsets { @@ -178,6 +175,11 @@ func (l OffsetsList) Offsets() Offsets { return os } +// KOffsets returns this list as a kgo offset map. +func (l OffsetsList) KOffsets() map[string]map[int32]kgo.Offset { + return l.Offsets().KOffsets() +} + // Offsets wraps many offsets and is the type used for offset functions. type Offsets map[string]map[int32]Offset @@ -284,11 +286,8 @@ func (os Offsets) Each(fn func(Offset)) { } } -// Deprecated: Use AsKgo; this will be removed in v1.0. -func (os Offsets) Into() map[string]map[int32]kgo.Offset { return os.AsKgo() } - -// AsKgo returns these offsets as a kgo offset map. -func (os Offsets) AsKgo() map[string]map[int32]kgo.Offset { +// KOffsets returns these offsets as a kgo offset map. +func (os Offsets) KOffsets() map[string]map[int32]kgo.Offset { tskgo := make(map[string]map[int32]kgo.Offset) for t, ps := range os { pskgo := make(map[int32]kgo.Offset) diff --git a/pkg/kadm/metadata.go b/pkg/kadm/metadata.go index 2b97d778..f44f077c 100644 --- a/pkg/kadm/metadata.go +++ b/pkg/kadm/metadata.go @@ -161,12 +161,11 @@ func (cl *Client) ListBrokers(ctx context.Context) (BrokerDetails, error) { return m.Brokers, nil } -// MetadataWithoutTopics issues a metadata request and returns it, and does not -// ask for any topics. This request is the counterpart to requesting all topics -// by default with the Metadata method. +// BrokerMetadata issues a metadata request and returns it, and does not ask +// for any topics. // // This returns an error if the request fails to be issued, or an *AuthErr. -func (cl *Client) MetadataWithoutTopics(ctx context.Context) (Metadata, error) { +func (cl *Client) BrokerMetadata(ctx context.Context) (Metadata, error) { return cl.metadata(ctx, true, nil) } @@ -307,9 +306,6 @@ func (l ListedOffsets) Error() error { return nil } -// Deprecated: Use Offsets; this will be removed in v1.0. -func (l ListedOffsets) Into() Offsets { return l.Offsets() } - // Offsets returns these listed offsets as offsets. func (l ListedOffsets) Offsets() Offsets { o := make(Offsets) @@ -324,6 +320,11 @@ func (l ListedOffsets) Offsets() Offsets { return o } +// KOffsets returns these listed offsets as a kgo offset map. +func (l ListedOffsets) KOffsets() map[string]map[int32]kgo.Offset { + return l.Offsets().KOffsets() +} + // ListStartOffsets returns the start (oldest) offsets for each partition in // each requested topic. In Kafka terms, this returns the log start offset. If // no topics are specified, all topics are listed. diff --git a/pkg/kadm/topics.go b/pkg/kadm/topics.go index 78c4929c..c93b46e8 100644 --- a/pkg/kadm/topics.go +++ b/pkg/kadm/topics.go @@ -12,14 +12,14 @@ import ( // topics to describe can be passed as additional arguments. If no topics are // specified, all topics are requested. Internal topics are not returned unless // specifically requested. To see all topics including internal topics, use -// ListInternalTopics. +// ListTopicsWithInternal. // // This returns an error if the request fails to be issued, or an *AuthError. func (cl *Client) ListTopics( ctx context.Context, topics ...string, ) (TopicDetails, error) { - t, err := cl.ListInternalTopics(ctx, topics...) + t, err := cl.ListTopicsWithInternal(ctx, topics...) if err != nil { return nil, err } @@ -27,9 +27,9 @@ func (cl *Client) ListTopics( return t, nil } -// ListInternalTopics is the same as ListTopics, but does not filter internal -// topics before returning. -func (cl *Client) ListInternalTopics( +// ListTopicsWithInternal is the same as ListTopics, but does not filter +// internal topics before returning. +func (cl *Client) ListTopicsWithInternal( ctx context.Context, topics ...string, ) (TopicDetails, error) {