File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2025 The Kubernetes Authors.
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ package plugins
18+
19+ // TypedName is a utility struct providing a type and a name
20+ // to plugins.
21+ // It implements the Plugin interface and can be embedded in
22+ // plugins across the code to reduce boilerplate.
23+ type TypedName struct {
24+ objType string
25+ objName string
26+ }
27+
28+ // NewTypedName returns a new TypedName struct configured with
29+ // the given type and name.
30+ func NewTypedName (objtype , objname string ) TypedName {
31+ return TypedName {
32+ objType : objtype ,
33+ objName : objname ,
34+ }
35+ }
36+
37+ // Type returns the type of the plugin.
38+ func (tn * TypedName ) Type () string {
39+ return tn .objType
40+ }
41+
42+ // Name returns the name of this plugin instance.
43+ func (tn * TypedName ) Name () string {
44+ return tn .objName
45+ }
46+
47+ // SetName sets the instance name.
48+ func (tn * TypedName ) SetName (name string ) {
49+ tn .objName = name
50+ }
You can’t perform that action at this time.
0 commit comments