Merge pull request #6292 from thaJeztah/28.x_backport_deprecate_opts

[28.x backport] opts: deprecate NewNamedListOptsRef, NewNamedMapOpts
This commit is contained in:
Sebastiaan van Stijn 2025-08-19 12:50:57 +02:00 committed by GitHub
commit 20c34ef13b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -134,6 +134,8 @@ func (opts *ListOpts) WithValidator(validator ValidatorFctType) *ListOpts {
// NamedOption is an interface that list and map options // NamedOption is an interface that list and map options
// with names implement. // with names implement.
//
// Deprecated: NamedOption is no longer used and will be removed in the next release.
type NamedOption interface { type NamedOption interface {
Name() string Name() string
} }
@ -141,6 +143,8 @@ type NamedOption interface {
// NamedListOpts is a ListOpts with a configuration name. // NamedListOpts is a ListOpts with a configuration name.
// This struct is useful to keep reference to the assigned // This struct is useful to keep reference to the assigned
// field name in the internal configuration struct. // field name in the internal configuration struct.
//
// Deprecated: NamedListOpts is no longer used and will be removed in the next release.
type NamedListOpts struct { type NamedListOpts struct {
name string name string
ListOpts ListOpts
@ -149,6 +153,8 @@ type NamedListOpts struct {
var _ NamedOption = &NamedListOpts{} var _ NamedOption = &NamedListOpts{}
// NewNamedListOptsRef creates a reference to a new NamedListOpts struct. // NewNamedListOptsRef creates a reference to a new NamedListOpts struct.
//
// Deprecated: NewNamedListOptsRef is no longer used and will be removed in the next release.
func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctType) *NamedListOpts { func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctType) *NamedListOpts {
return &NamedListOpts{ return &NamedListOpts{
name: name, name: name,
@ -157,6 +163,8 @@ func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctTy
} }
// Name returns the name of the NamedListOpts in the configuration. // Name returns the name of the NamedListOpts in the configuration.
//
// Deprecated: NamedListOpts is no longer used and will be removed in the next release.
func (o *NamedListOpts) Name() string { func (o *NamedListOpts) Name() string {
return o.name return o.name
} }
@ -210,6 +218,8 @@ func NewMapOpts(values map[string]string, validator ValidatorFctType) *MapOpts {
// NamedMapOpts is a MapOpts struct with a configuration name. // NamedMapOpts is a MapOpts struct with a configuration name.
// This struct is useful to keep reference to the assigned // This struct is useful to keep reference to the assigned
// field name in the internal configuration struct. // field name in the internal configuration struct.
//
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
type NamedMapOpts struct { type NamedMapOpts struct {
name string name string
MapOpts MapOpts
@ -218,6 +228,8 @@ type NamedMapOpts struct {
var _ NamedOption = &NamedMapOpts{} var _ NamedOption = &NamedMapOpts{}
// NewNamedMapOpts creates a reference to a new NamedMapOpts struct. // NewNamedMapOpts creates a reference to a new NamedMapOpts struct.
//
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
func NewNamedMapOpts(name string, values map[string]string, validator ValidatorFctType) *NamedMapOpts { func NewNamedMapOpts(name string, values map[string]string, validator ValidatorFctType) *NamedMapOpts {
return &NamedMapOpts{ return &NamedMapOpts{
name: name, name: name,
@ -226,6 +238,8 @@ func NewNamedMapOpts(name string, values map[string]string, validator ValidatorF
} }
// Name returns the name of the NamedMapOpts in the configuration. // Name returns the name of the NamedMapOpts in the configuration.
//
// Deprecated: NamedMapOpts is no longer used and will be removed in the next release.
func (o *NamedMapOpts) Name() string { func (o *NamedMapOpts) Name() string {
return o.name return o.name
} }