@@ -65,8 +65,12 @@ import (
6565)
6666
6767// {{.kind.String}}ClusterLister can list {{.kind.Plural}} across all workspaces, or scope down to a {{.kind.String}}Lister for one workspace.
68+ // All objects returned here must be treated as read-only.
6869type {{.kind.String}}ClusterLister interface {
70+ // List lists all {{.kind.Plural}} in the indexer.
71+ // Objects returned here must be treated as read-only.
6972 List(selector labels.Selector) (ret []*{{.group.PackageAlias}}.{{.kind.String}}, err error)
73+ // Cluster returns a lister that can list and get {{.kind.Plural}} in one workspace.
7074{{if not .useUpstreamInterfaces -}}
7175 Cluster(cluster logicalcluster.Name) {{.kind.String}}Lister
7276{{else -}}
@@ -101,11 +105,22 @@ func (s *{{.kind.String | lowerFirst}}ClusterLister) Cluster(cluster logicalclus
101105}
102106
103107{{if not .useUpstreamInterfaces -}}
108+ {{ if not .kind.IsNamespaced -}}
109+ // {{.kind.String}}Lister can list all {{.kind.Plural}}, or get one in particular.
110+ {{else -}}
111+ // {{.kind.String}}Lister can list {{.kind.Plural}} across all namespaces, or scope down to a {{.kind.String}}NamespaceLister for one namespace.
112+ {{end -}}
113+ // All objects returned here must be treated as read-only.
104114type {{.kind.String}}Lister interface {
115+ // List lists all {{.kind.Plural}} in the workspace.
116+ // Objects returned here must be treated as read-only.
105117 List(selector labels.Selector) (ret []*{{.group.PackageAlias}}.{{.kind.String}}, err error)
106118{{ if not .kind.IsNamespaced -}}
119+ // Get retrieves the {{.kind.String}} from the indexer for a given workspace and name.
120+ // Objects returned here must be treated as read-only.
107121 Get(name string) (*{{.group.PackageAlias}}.{{.kind.String}}, error)
108122{{else -}}
123+ // {{.kind.Plural}} returns a lister that can list and get {{.kind.Plural}} in one workspace and namespace.
109124 {{.kind.Plural}}(namespace string) {{.kind.String}}NamespaceLister
110125{{end -}}
111126}
@@ -153,8 +168,14 @@ func (s *{{.kind.String | lowerFirst}}Lister) {{.kind.Plural}}(namespace string)
153168}
154169
155170{{if not .useUpstreamInterfaces -}}
171+ // {{.kind.String | lowerFirst}}NamespaceLister helps list and get {{.kind.Plural}}.
172+ // All objects returned here must be treated as read-only.
156173type {{.kind.String}}NamespaceLister interface {
174+ // List lists all {{.kind.Plural}} in the workspace and namespace.
175+ // Objects returned here must be treated as read-only.
157176 List(selector labels.Selector) (ret []*{{.group.PackageAlias}}.{{.kind.String}}, err error)
177+ // Get retrieves the {{.kind.String}} from the indexer for a given workspace, namespace and name.
178+ // Objects returned here must be treated as read-only.
158179 Get(name string) (*{{.group.PackageAlias}}.{{.kind.String}}, error)
159180 }
160181{{end -}}
0 commit comments