mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 04:36:00 +00:00
Merge pull request #125162 from sttts/sttts-code-generator-core-group
code-generator/client-gen: decouple core group from package name 'api'
This commit is contained in:
@@ -7,6 +7,3 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause
|
|||||||
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
|
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
|
||||||
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
|
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
|
||||||
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
|
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
|
||||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example/v1,TestTypeStatus,Blah
|
|
||||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example2/v1,TestTypeStatus,Blah
|
|
||||||
API rule violation: names_match,k8s.io/code-generator/examples/apiserver/apis/example3.io/v1,TestTypeStatus,Blah
|
|
||||||
|
@@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package
|
// +k8s:deepcopy-gen=package
|
||||||
|
// +groupName=
|
||||||
|
|
||||||
// Package core contains the latest (or "internal") version of the
|
// Package core contains the latest (or "internal") version of the
|
||||||
// Kubernetes API objects. This is the API objects as represented in memory.
|
// Kubernetes API objects. This is the API objects as represented in memory.
|
||||||
|
@@ -18,6 +18,7 @@ limitations under the License.
|
|||||||
// +k8s:deepcopy-gen=package
|
// +k8s:deepcopy-gen=package
|
||||||
// +k8s:protobuf-gen=package
|
// +k8s:protobuf-gen=package
|
||||||
// +k8s:prerelease-lifecycle-gen=true
|
// +k8s:prerelease-lifecycle-gen=true
|
||||||
|
// +groupName=
|
||||||
|
|
||||||
// Package v1 is the v1 version of the core API.
|
// Package v1 is the v1 version of the core API.
|
||||||
package v1 // import "k8s.io/api/core/v1"
|
package v1 // import "k8s.io/api/core/v1"
|
||||||
|
@@ -71,9 +71,9 @@ func TestGVPackageFlag(t *testing.T) {
|
|||||||
{
|
{
|
||||||
args: []string{"api/v1", "api"},
|
args: []string{"api/v1", "api"},
|
||||||
expectedGroups: []types.GroupVersions{
|
expectedGroups: []types.GroupVersions{
|
||||||
{PackageName: "core", Group: types.Group("api"), Versions: []types.PackageVersion{
|
{PackageName: "api", Group: types.Group("api"), Versions: []types.PackageVersion{
|
||||||
{Version: "v1", Package: "core/v1"},
|
{Version: "v1", Package: "api/v1"},
|
||||||
{Version: "", Package: "core"},
|
{Version: "", Package: "api"},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -71,31 +71,25 @@ func (g *genGroup) Imports(c *generator.Context) (imports []string) {
|
|||||||
func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||||
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
||||||
|
|
||||||
apiPath := func(group string) string {
|
|
||||||
if group == "core" {
|
|
||||||
return `"/api"`
|
|
||||||
}
|
|
||||||
return `"` + g.apiPath + `"`
|
|
||||||
}
|
|
||||||
|
|
||||||
groupName := g.group
|
|
||||||
if g.group == "core" {
|
|
||||||
groupName = ""
|
|
||||||
}
|
|
||||||
// allow user to define a group name that's different from the one parsed from the directory.
|
// allow user to define a group name that's different from the one parsed from the directory.
|
||||||
p := c.Universe.Package(g.inputPackage)
|
p := c.Universe.Package(g.inputPackage)
|
||||||
|
groupName := g.group
|
||||||
if override := gengo.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
if override := gengo.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||||
groupName = override[0]
|
groupName = override[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiPath := `"` + g.apiPath + `"`
|
||||||
|
if groupName == "" {
|
||||||
|
apiPath = `"/api"`
|
||||||
|
}
|
||||||
|
|
||||||
m := map[string]interface{}{
|
m := map[string]interface{}{
|
||||||
"group": g.group,
|
|
||||||
"version": g.version,
|
"version": g.version,
|
||||||
"groupName": groupName,
|
"groupName": groupName,
|
||||||
"GroupGoName": g.groupGoName,
|
"GroupGoName": g.groupGoName,
|
||||||
"Version": namer.IC(g.version),
|
"Version": namer.IC(g.version),
|
||||||
"types": g.types,
|
"types": g.types,
|
||||||
"apiPath": apiPath(g.group),
|
"apiPath": apiPath,
|
||||||
"schemaGroupVersion": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersion"}),
|
"schemaGroupVersion": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersion"}),
|
||||||
"runtimeAPIVersionInternal": c.Universe.Variable(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "APIVersionInternal"}),
|
"runtimeAPIVersionInternal": c.Universe.Variable(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "APIVersionInternal"}),
|
||||||
"restConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}),
|
"restConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}),
|
||||||
|
@@ -42,7 +42,7 @@ func (g Group) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g Group) NonEmpty() string {
|
func (g Group) NonEmpty() string {
|
||||||
if g == "api" {
|
if g == "" {
|
||||||
return "core"
|
return "core"
|
||||||
}
|
}
|
||||||
return string(g)
|
return string(g)
|
||||||
@@ -76,7 +76,7 @@ type GroupVersionKind struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gv GroupVersion) ToAPIVersion() string {
|
func (gv GroupVersion) ToAPIVersion() string {
|
||||||
if len(gv.Group) > 0 && gv.Group.NonEmpty() != "core" {
|
if len(gv.Group) > 0 && gv.Group != "" {
|
||||||
return gv.Group.String() + "/" + gv.Version.String()
|
return gv.Group.String() + "/" + gv.Version.String()
|
||||||
} else {
|
} else {
|
||||||
return gv.Version.String()
|
return gv.Version.String()
|
||||||
|
@@ -43,16 +43,16 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient:nonNamespaced
|
// +genclient:nonNamespaced
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
type ClusterTestTypeList struct {
|
type ClusterTestTypeList struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
Items []ClusterTestType
|
Items []ClusterTestType `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
@@ -70,5 +70,5 @@ type ClusterTestType struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClusterTestTypeStatus struct {
|
type ClusterTestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/HyphenGroup/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type ClusterTestTypeApplyConfiguration struct {
|
type ClusterTestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||||
@@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/HyphenGroup/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type TestTypeApplyConfiguration struct {
|
type TestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestType constructs a declarative configuration of the TestType type for use with
|
// TestType constructs a declarative configuration of the TestType type for use with
|
||||||
@@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||||
|
return &TestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -34,8 +34,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
// Group=example-group.hyphens.code-generator.k8s.io, Version=v1
|
// Group=example-group.hyphens.code-generator.k8s.io, Version=v1
|
||||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||||
|
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||||
return &examplev1.TestTypeApplyConfiguration{}
|
return &examplev1.TestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||||
|
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@@ -43,16 +43,17 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient:nonNamespaced
|
// +genclient:nonNamespaced
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
type ClusterTestTypeList struct {
|
type ClusterTestTypeList struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta
|
// +optional
|
||||||
Items []ClusterTestType
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
Items []ClusterTestType `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
@@ -71,5 +72,5 @@ type ClusterTestType struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClusterTestTypeStatus struct {
|
type ClusterTestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/MixedCase/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type ClusterTestTypeApplyConfiguration struct {
|
type ClusterTestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||||
@@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/MixedCase/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type TestTypeApplyConfiguration struct {
|
type TestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestType constructs a declarative configuration of the TestType type for use with
|
// TestType constructs a declarative configuration of the TestType type for use with
|
||||||
@@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||||
|
return &TestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -34,8 +34,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||||
|
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||||
return &examplev1.TestTypeApplyConfiguration{}
|
return &examplev1.TestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||||
|
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package
|
||||||
|
// +groupName=
|
||||||
|
|
||||||
|
package core // import "k8s.io/code-generator/examples/apiserver/apis/core"
|
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package install installs the experimental API group, making it available as
|
||||||
|
// an option to all of the API encoding/decoding machinery.
|
||||||
|
package install
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
"k8s.io/code-generator/examples/apiserver/apis/core"
|
||||||
|
"k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Install registers the API group and adds types to a scheme
|
||||||
|
func Install(scheme *runtime.Scheme) {
|
||||||
|
utilruntime.Must(core.AddToScheme(scheme))
|
||||||
|
utilruntime.Must(v1.AddToScheme(scheme))
|
||||||
|
utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion))
|
||||||
|
}
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Version: runtime.APIVersionInternal}
|
||||||
|
|
||||||
|
var (
|
||||||
|
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||||
|
AddToScheme = SchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to the given scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&TestType{},
|
||||||
|
&TestTypeList{},
|
||||||
|
)
|
||||||
|
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package core
|
||||||
|
|
||||||
|
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestType is a top-level type. A client is created for it.
|
||||||
|
type TestType struct {
|
||||||
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta
|
||||||
|
// +optional
|
||||||
|
Status TestTypeStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestTypeList is a top-level list type. The client methods for lists are automatically created.
|
||||||
|
// You are not supposed to create a separated client for this one.
|
||||||
|
type TestTypeList struct {
|
||||||
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta
|
||||||
|
|
||||||
|
Items []TestType
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestTypeStatus struct {
|
||||||
|
Blah string
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:openapi-gen=true
|
||||||
|
// +k8s:deepcopy-gen=package
|
||||||
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
// +k8s:conversion-gen=k8s.io/code-generator/examples/apiserver/apis/core
|
||||||
|
// +groupName=
|
||||||
|
|
||||||
|
package v1 // import "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: "example.apiserver.code-generator.k8s.io", Version: "v1"}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to the given scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&TestType{},
|
||||||
|
&TestTypeList{},
|
||||||
|
)
|
||||||
|
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&metav1.Status{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestType is a top-level type. A client is created for it.
|
||||||
|
type TestType struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
// +optional
|
||||||
|
Status TestTypeStatus `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestTypeList is a top-level list type. The client methods for lists are automatically created.
|
||||||
|
// You are not supposed to create a separated client for this one.
|
||||||
|
type TestTypeList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Items []TestType `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestTypeStatus struct {
|
||||||
|
Blah string `json:"blah"`
|
||||||
|
}
|
138
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.conversion.go
generated
Normal file
138
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.conversion.go
generated
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by conversion-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
unsafe "unsafe"
|
||||||
|
|
||||||
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
core "k8s.io/code-generator/examples/apiserver/apis/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
localSchemeBuilder.Register(RegisterConversions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterConversions adds conversion functions to the given scheme.
|
||||||
|
// Public to allow building arbitrary schemes.
|
||||||
|
func RegisterConversions(s *runtime.Scheme) error {
|
||||||
|
if err := s.AddGeneratedConversionFunc((*TestType)(nil), (*core.TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_TestType_To_core_TestType(a.(*TestType), b.(*core.TestType), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*core.TestType)(nil), (*TestType)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_core_TestType_To_v1_TestType(a.(*core.TestType), b.(*TestType), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*TestTypeList)(nil), (*core.TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_TestTypeList_To_core_TestTypeList(a.(*TestTypeList), b.(*core.TestTypeList), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*core.TestTypeList)(nil), (*TestTypeList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_core_TestTypeList_To_v1_TestTypeList(a.(*core.TestTypeList), b.(*TestTypeList), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*TestTypeStatus)(nil), (*core.TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1_TestTypeStatus_To_core_TestTypeStatus(a.(*TestTypeStatus), b.(*core.TestTypeStatus), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*core.TestTypeStatus)(nil), (*TestTypeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_core_TestTypeStatus_To_v1_TestTypeStatus(a.(*core.TestTypeStatus), b.(*TestTypeStatus), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_TestType_To_core_TestType(in *TestType, out *core.TestType, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_v1_TestTypeStatus_To_core_TestTypeStatus(&in.Status, &out.Status, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_TestType_To_core_TestType is an autogenerated conversion function.
|
||||||
|
func Convert_v1_TestType_To_core_TestType(in *TestType, out *core.TestType, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_TestType_To_core_TestType(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_core_TestType_To_v1_TestType(in *core.TestType, out *TestType, s conversion.Scope) error {
|
||||||
|
out.ObjectMeta = in.ObjectMeta
|
||||||
|
if err := Convert_core_TestTypeStatus_To_v1_TestTypeStatus(&in.Status, &out.Status, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_core_TestType_To_v1_TestType is an autogenerated conversion function.
|
||||||
|
func Convert_core_TestType_To_v1_TestType(in *core.TestType, out *TestType, s conversion.Scope) error {
|
||||||
|
return autoConvert_core_TestType_To_v1_TestType(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_TestTypeList_To_core_TestTypeList(in *TestTypeList, out *core.TestTypeList, s conversion.Scope) error {
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
out.Items = *(*[]core.TestType)(unsafe.Pointer(&in.Items))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_TestTypeList_To_core_TestTypeList is an autogenerated conversion function.
|
||||||
|
func Convert_v1_TestTypeList_To_core_TestTypeList(in *TestTypeList, out *core.TestTypeList, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_TestTypeList_To_core_TestTypeList(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_core_TestTypeList_To_v1_TestTypeList(in *core.TestTypeList, out *TestTypeList, s conversion.Scope) error {
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
out.Items = *(*[]TestType)(unsafe.Pointer(&in.Items))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_core_TestTypeList_To_v1_TestTypeList is an autogenerated conversion function.
|
||||||
|
func Convert_core_TestTypeList_To_v1_TestTypeList(in *core.TestTypeList, out *TestTypeList, s conversion.Scope) error {
|
||||||
|
return autoConvert_core_TestTypeList_To_v1_TestTypeList(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1_TestTypeStatus_To_core_TestTypeStatus(in *TestTypeStatus, out *core.TestTypeStatus, s conversion.Scope) error {
|
||||||
|
out.Blah = in.Blah
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1_TestTypeStatus_To_core_TestTypeStatus is an autogenerated conversion function.
|
||||||
|
func Convert_v1_TestTypeStatus_To_core_TestTypeStatus(in *TestTypeStatus, out *core.TestTypeStatus, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1_TestTypeStatus_To_core_TestTypeStatus(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_core_TestTypeStatus_To_v1_TestTypeStatus(in *core.TestTypeStatus, out *TestTypeStatus, s conversion.Scope) error {
|
||||||
|
out.Blah = in.Blah
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_core_TestTypeStatus_To_v1_TestTypeStatus is an autogenerated conversion function.
|
||||||
|
func Convert_core_TestTypeStatus_To_v1_TestTypeStatus(in *core.TestTypeStatus, out *TestTypeStatus, s conversion.Scope) error {
|
||||||
|
return autoConvert_core_TestTypeStatus_To_v1_TestTypeStatus(in, out, s)
|
||||||
|
}
|
102
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.deepcopy.go
generated
Normal file
102
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.deepcopy.go
generated
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestType) DeepCopyInto(out *TestType) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Status = in.Status
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType.
|
||||||
|
func (in *TestType) DeepCopy() *TestType {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestType)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestType) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]TestType, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeList.
|
||||||
|
func (in *TestTypeList) DeepCopy() *TestTypeList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestTypeList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeStatus) DeepCopyInto(out *TestTypeStatus) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeStatus.
|
||||||
|
func (in *TestTypeStatus) DeepCopy() *TestTypeStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
33
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.defaults.go
generated
Normal file
33
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/v1/zz_generated.defaults.go
generated
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by defaulter-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||||
|
// Public to allow building arbitrary schemes.
|
||||||
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
return nil
|
||||||
|
}
|
102
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/zz_generated.deepcopy.go
generated
Normal file
102
staging/src/k8s.io/code-generator/examples/apiserver/apis/core/zz_generated.deepcopy.go
generated
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestType) DeepCopyInto(out *TestType) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Status = in.Status
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType.
|
||||||
|
func (in *TestType) DeepCopy() *TestType {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestType)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestType) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]TestType, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeList.
|
||||||
|
func (in *TestTypeList) DeepCopy() *TestTypeList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestTypeList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeStatus) DeepCopyInto(out *TestTypeStatus) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeStatus.
|
||||||
|
func (in *TestTypeStatus) DeepCopy() *TestTypeStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
@@ -24,7 +24,9 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|||||||
// TestType is a top-level type. A client is created for it.
|
// TestType is a top-level type. A client is created for it.
|
||||||
type TestType struct {
|
type TestType struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
metav1.ObjectMeta
|
metav1.ObjectMeta
|
||||||
|
// +optional
|
||||||
Status TestTypeStatus
|
Status TestTypeStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ type TestType struct {
|
|||||||
// You are not supposed to create a separated client for this one.
|
// You are not supposed to create a separated client for this one.
|
||||||
type TestTypeList struct {
|
type TestTypeList struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
metav1.ListMeta
|
metav1.ListMeta
|
||||||
|
|
||||||
Items []TestType
|
Items []TestType
|
||||||
|
@@ -43,5 +43,5 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|||||||
// +genclient
|
// +genclient
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +genclient:nonNamespaced
|
// +genclient:nonNamespaced
|
||||||
|
//
|
||||||
// TestType is a top-level type. A client is created for it.
|
// TestType is a top-level type. A client is created for it.
|
||||||
type TestType struct {
|
type TestType struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
|
@@ -43,5 +43,5 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,9 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|||||||
// TestType is a top-level type. A client is created for it.
|
// TestType is a top-level type. A client is created for it.
|
||||||
type TestType struct {
|
type TestType struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
metav1.ObjectMeta
|
metav1.ObjectMeta
|
||||||
|
// +optional
|
||||||
Status TestTypeStatus
|
Status TestTypeStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ type TestType struct {
|
|||||||
// You are not supposed to create a separated client for this one.
|
// You are not supposed to create a separated client for this one.
|
||||||
type TestTypeList struct {
|
type TestTypeList struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
|
// +optional
|
||||||
metav1.ListMeta
|
metav1.ListMeta
|
||||||
|
|
||||||
Items []TestType
|
Items []TestType
|
||||||
|
@@ -43,5 +43,5 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ import (
|
|||||||
discovery "k8s.io/client-go/discovery"
|
discovery "k8s.io/client-go/discovery"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||||
|
corev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/core/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1"
|
examplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1"
|
||||||
secondexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example2/v1"
|
secondexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example2/v1"
|
||||||
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example3.io/v1"
|
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example3.io/v1"
|
||||||
@@ -32,6 +33,7 @@ import (
|
|||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
Discovery() discovery.DiscoveryInterface
|
Discovery() discovery.DiscoveryInterface
|
||||||
|
CoreV1() corev1.CoreV1Interface
|
||||||
ExampleV1() examplev1.ExampleV1Interface
|
ExampleV1() examplev1.ExampleV1Interface
|
||||||
SecondExampleV1() secondexamplev1.SecondExampleV1Interface
|
SecondExampleV1() secondexamplev1.SecondExampleV1Interface
|
||||||
ThirdExampleV1() thirdexamplev1.ThirdExampleV1Interface
|
ThirdExampleV1() thirdexamplev1.ThirdExampleV1Interface
|
||||||
@@ -40,11 +42,17 @@ type Interface interface {
|
|||||||
// Clientset contains the clients for groups.
|
// Clientset contains the clients for groups.
|
||||||
type Clientset struct {
|
type Clientset struct {
|
||||||
*discovery.DiscoveryClient
|
*discovery.DiscoveryClient
|
||||||
|
coreV1 *corev1.CoreV1Client
|
||||||
exampleV1 *examplev1.ExampleV1Client
|
exampleV1 *examplev1.ExampleV1Client
|
||||||
secondExampleV1 *secondexamplev1.SecondExampleV1Client
|
secondExampleV1 *secondexamplev1.SecondExampleV1Client
|
||||||
thirdExampleV1 *thirdexamplev1.ThirdExampleV1Client
|
thirdExampleV1 *thirdexamplev1.ThirdExampleV1Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CoreV1 retrieves the CoreV1Client
|
||||||
|
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
|
||||||
|
return c.coreV1
|
||||||
|
}
|
||||||
|
|
||||||
// ExampleV1 retrieves the ExampleV1Client
|
// ExampleV1 retrieves the ExampleV1Client
|
||||||
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
||||||
return c.exampleV1
|
return c.exampleV1
|
||||||
@@ -104,6 +112,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
|||||||
|
|
||||||
var cs Clientset
|
var cs Clientset
|
||||||
var err error
|
var err error
|
||||||
|
cs.coreV1, err = corev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
cs.exampleV1, err = examplev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
cs.exampleV1, err = examplev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -137,6 +149,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|||||||
// New creates a new Clientset for the given RESTClient.
|
// New creates a new Clientset for the given RESTClient.
|
||||||
func New(c rest.Interface) *Clientset {
|
func New(c rest.Interface) *Clientset {
|
||||||
var cs Clientset
|
var cs Clientset
|
||||||
|
cs.coreV1 = corev1.New(c)
|
||||||
cs.exampleV1 = examplev1.New(c)
|
cs.exampleV1 = examplev1.New(c)
|
||||||
cs.secondExampleV1 = secondexamplev1.New(c)
|
cs.secondExampleV1 = secondexamplev1.New(c)
|
||||||
cs.thirdExampleV1 = thirdexamplev1.New(c)
|
cs.thirdExampleV1 = thirdexamplev1.New(c)
|
||||||
|
@@ -25,6 +25,8 @@ import (
|
|||||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||||
"k8s.io/client-go/testing"
|
"k8s.io/client-go/testing"
|
||||||
clientset "k8s.io/code-generator/examples/apiserver/clientset/versioned"
|
clientset "k8s.io/code-generator/examples/apiserver/clientset/versioned"
|
||||||
|
corev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/core/v1"
|
||||||
|
fakecorev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/core/v1/fake"
|
||||||
examplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1"
|
examplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1"
|
||||||
fakeexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1/fake"
|
fakeexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example/v1/fake"
|
||||||
secondexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example2/v1"
|
secondexamplev1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/example2/v1"
|
||||||
@@ -87,6 +89,11 @@ var (
|
|||||||
_ testing.FakeClient = &Clientset{}
|
_ testing.FakeClient = &Clientset{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CoreV1 retrieves the CoreV1Client
|
||||||
|
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
|
||||||
|
return &fakecorev1.FakeCoreV1{Fake: &c.Fake}
|
||||||
|
}
|
||||||
|
|
||||||
// ExampleV1 retrieves the ExampleV1Client
|
// ExampleV1 retrieves the ExampleV1Client
|
||||||
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
||||||
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
|
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
|
||||||
|
@@ -24,6 +24,7 @@ import (
|
|||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
corev1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
examplev1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
||||||
secondexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
secondexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
||||||
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
||||||
@@ -33,6 +34,7 @@ var scheme = runtime.NewScheme()
|
|||||||
var codecs = serializer.NewCodecFactory(scheme)
|
var codecs = serializer.NewCodecFactory(scheme)
|
||||||
|
|
||||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
|
corev1.AddToScheme,
|
||||||
examplev1.AddToScheme,
|
examplev1.AddToScheme,
|
||||||
secondexamplev1.AddToScheme,
|
secondexamplev1.AddToScheme,
|
||||||
thirdexamplev1.AddToScheme,
|
thirdexamplev1.AddToScheme,
|
||||||
|
@@ -24,6 +24,7 @@ import (
|
|||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
corev1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
examplev1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
||||||
secondexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
secondexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
||||||
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
thirdexamplev1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
||||||
@@ -33,6 +34,7 @@ var Scheme = runtime.NewScheme()
|
|||||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
|
corev1.AddToScheme,
|
||||||
examplev1.AddToScheme,
|
examplev1.AddToScheme,
|
||||||
secondexamplev1.AddToScheme,
|
secondexamplev1.AddToScheme,
|
||||||
thirdexamplev1.AddToScheme,
|
thirdexamplev1.AddToScheme,
|
||||||
|
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
"k8s.io/code-generator/examples/apiserver/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CoreV1Interface interface {
|
||||||
|
RESTClient() rest.Interface
|
||||||
|
TestTypesGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// CoreV1Client is used to interact with features provided by the group.
|
||||||
|
type CoreV1Client struct {
|
||||||
|
restClient rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CoreV1Client) TestTypes(namespace string) TestTypeInterface {
|
||||||
|
return newTestTypes(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new CoreV1Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
|
func NewForConfig(c *rest.Config) (*CoreV1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new CoreV1Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CoreV1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &CoreV1Client{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new CoreV1Client for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *rest.Config) *CoreV1Client {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new CoreV1Client for the given RESTClient.
|
||||||
|
func New(c rest.Interface) *CoreV1Client {
|
||||||
|
return &CoreV1Client{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *rest.Config) error {
|
||||||
|
gv := v1.SchemeGroupVersion
|
||||||
|
config.GroupVersion = &gv
|
||||||
|
config.APIPath = "/api"
|
||||||
|
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||||
|
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *CoreV1Client) RESTClient() rest.Interface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.restClient
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package v1
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/clientset/versioned/typed/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeCoreV1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeCoreV1) TestTypes(namespace string) v1.TestTypeInterface {
|
||||||
|
return &FakeTestTypes{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeCoreV1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
@@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeTestTypes implements TestTypeInterface
|
||||||
|
type FakeTestTypes struct {
|
||||||
|
Fake *FakeCoreV1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var testtypesResource = v1.SchemeGroupVersion.WithResource("testtypes")
|
||||||
|
|
||||||
|
var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType")
|
||||||
|
|
||||||
|
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||||
|
func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||||
|
func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||||
|
emptyResult := &v1.TestTypeList{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1.TestTypeList{ListMeta: obj.(*v1.TestTypeList).ListMeta}
|
||||||
|
for _, item := range obj.(*v1.TestTypeList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||||
|
func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||||
|
func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||||
|
func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "status", c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteActionWithOptions(testtypesResource, c.ns, name, opts), &v1.TestType{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1.TestTypeList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched testType.
|
||||||
|
func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
type TestTypeExpansion interface{}
|
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
gentype "k8s.io/client-go/gentype"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
scheme "k8s.io/code-generator/examples/apiserver/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypesGetter has a method to return a TestTypeInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type TestTypesGetter interface {
|
||||||
|
TestTypes(namespace string) TestTypeInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeInterface has methods to work with TestType resources.
|
||||||
|
type TestTypeInterface interface {
|
||||||
|
Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (*v1.TestType, error)
|
||||||
|
Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||||
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.TestType, error)
|
||||||
|
List(ctx context.Context, opts metav1.ListOptions) (*v1.TestTypeList, error)
|
||||||
|
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
|
||||||
|
TestTypeExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// testTypes implements TestTypeInterface
|
||||||
|
type testTypes struct {
|
||||||
|
*gentype.ClientWithList[*v1.TestType, *v1.TestTypeList]
|
||||||
|
}
|
||||||
|
|
||||||
|
// newTestTypes returns a TestTypes
|
||||||
|
func newTestTypes(c *CoreV1Client, namespace string) *testTypes {
|
||||||
|
return &testTypes{
|
||||||
|
gentype.NewClientWithList[*v1.TestType, *v1.TestTypeList](
|
||||||
|
"testtypes",
|
||||||
|
c.RESTClient(),
|
||||||
|
scheme.ParameterCodec,
|
||||||
|
namespace,
|
||||||
|
func() *v1.TestType { return &v1.TestType{} },
|
||||||
|
func() *v1.TestTypeList { return &v1.TestTypeList{} }),
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/informers/externalversions/core/v1"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to each of this group's versions.
|
||||||
|
type Interface interface {
|
||||||
|
// V1 provides access to shared informers for resources in V1.
|
||||||
|
V1() v1.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
type group struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// V1 returns a new v1.Interface.
|
||||||
|
func (g *group) V1() v1.Interface {
|
||||||
|
return v1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
|
}
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to all the informers in this group version.
|
||||||
|
type Interface interface {
|
||||||
|
// TestTypes returns a TestTypeInformer.
|
||||||
|
TestTypes() TestTypeInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
type version struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypes returns a TestTypeInformer.
|
||||||
|
func (v *version) TestTypes() TestTypeInformer {
|
||||||
|
return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
corev1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
versioned "k8s.io/code-generator/examples/apiserver/clientset/versioned"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/apiserver/informers/externalversions/internalinterfaces"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/listers/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypeInformer provides access to a shared informer and lister for
|
||||||
|
// TestTypes.
|
||||||
|
type TestTypeInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.TestTypeLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type testTypeInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTestTypeInformer constructs a new informer for TestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredTestTypeInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredTestTypeInformer constructs a new informer for TestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.CoreV1().TestTypes(namespace).List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.CoreV1().TestTypes(namespace).Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&corev1.TestType{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&corev1.TestType{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) Lister() v1.TestTypeLister {
|
||||||
|
return v1.NewTestTypeLister(f.Informer().GetIndexer())
|
||||||
|
}
|
@@ -28,6 +28,7 @@ import (
|
|||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
cache "k8s.io/client-go/tools/cache"
|
cache "k8s.io/client-go/tools/cache"
|
||||||
versioned "k8s.io/code-generator/examples/apiserver/clientset/versioned"
|
versioned "k8s.io/code-generator/examples/apiserver/clientset/versioned"
|
||||||
|
core "k8s.io/code-generator/examples/apiserver/informers/externalversions/core"
|
||||||
example "k8s.io/code-generator/examples/apiserver/informers/externalversions/example"
|
example "k8s.io/code-generator/examples/apiserver/informers/externalversions/example"
|
||||||
example2 "k8s.io/code-generator/examples/apiserver/informers/externalversions/example2"
|
example2 "k8s.io/code-generator/examples/apiserver/informers/externalversions/example2"
|
||||||
example3io "k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io"
|
example3io "k8s.io/code-generator/examples/apiserver/informers/externalversions/example3.io"
|
||||||
@@ -255,11 +256,16 @@ type SharedInformerFactory interface {
|
|||||||
// client.
|
// client.
|
||||||
InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer
|
InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer
|
||||||
|
|
||||||
|
Core() core.Interface
|
||||||
Example() example.Interface
|
Example() example.Interface
|
||||||
SecondExample() example2.Interface
|
SecondExample() example2.Interface
|
||||||
ThirdExample() example3io.Interface
|
ThirdExample() example3io.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *sharedInformerFactory) Core() core.Interface {
|
||||||
|
return core.New(f, f.namespace, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
func (f *sharedInformerFactory) Example() example.Interface {
|
func (f *sharedInformerFactory) Example() example.Interface {
|
||||||
return example.New(f, f.namespace, f.tweakListOptions)
|
return example.New(f, f.namespace, f.tweakListOptions)
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,8 @@ import (
|
|||||||
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
cache "k8s.io/client-go/tools/cache"
|
cache "k8s.io/client-go/tools/cache"
|
||||||
v1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
examplev1 "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
||||||
example2v1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
example2v1 "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
||||||
example3iov1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
example3iov1 "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
||||||
)
|
)
|
||||||
@@ -54,8 +55,12 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
|||||||
// TODO extend this to unknown resources with a client pool
|
// TODO extend this to unknown resources with a client pool
|
||||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||||
switch resource {
|
switch resource {
|
||||||
// Group=example.apiserver.code-generator.k8s.io, Version=v1
|
// Group=core, Version=v1
|
||||||
case v1.SchemeGroupVersion.WithResource("testtypes"):
|
case v1.SchemeGroupVersion.WithResource("testtypes"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().TestTypes().Informer()}, nil
|
||||||
|
|
||||||
|
// Group=example.apiserver.code-generator.k8s.io, Version=v1
|
||||||
|
case examplev1.SchemeGroupVersion.WithResource("testtypes"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
|
||||||
|
|
||||||
// Group=example.dots.apiserver.code-generator.k8s.io, Version=v1
|
// Group=example.dots.apiserver.code-generator.k8s.io, Version=v1
|
||||||
|
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeListerExpansion allows custom methods to be added to
|
||||||
|
// TestTypeLister.
|
||||||
|
type TestTypeListerExpansion interface{}
|
||||||
|
|
||||||
|
// TestTypeNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// TestTypeNamespaceLister.
|
||||||
|
type TestTypeNamespaceListerExpansion interface{}
|
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/listers"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
v1 "k8s.io/code-generator/examples/apiserver/apis/core/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypeLister helps list TestTypes.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type TestTypeLister interface {
|
||||||
|
// List lists all TestTypes in the indexer.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v1.TestType, err error)
|
||||||
|
// TestTypes returns an object that can list and get TestTypes.
|
||||||
|
TestTypes(namespace string) TestTypeNamespaceLister
|
||||||
|
TestTypeListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// testTypeLister implements the TestTypeLister interface.
|
||||||
|
type testTypeLister struct {
|
||||||
|
listers.ResourceIndexer[*v1.TestType]
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTestTypeLister returns a new TestTypeLister.
|
||||||
|
func NewTestTypeLister(indexer cache.Indexer) TestTypeLister {
|
||||||
|
return &testTypeLister{listers.New[*v1.TestType](indexer, v1.Resource("testtype"))}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypes returns an object that can list and get TestTypes.
|
||||||
|
func (s *testTypeLister) TestTypes(namespace string) TestTypeNamespaceLister {
|
||||||
|
return testTypeNamespaceLister{listers.NewNamespaced[*v1.TestType](s.ResourceIndexer, namespace)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeNamespaceLister helps list and get TestTypes.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type TestTypeNamespaceLister interface {
|
||||||
|
// List lists all TestTypes in the indexer for a given namespace.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v1.TestType, err error)
|
||||||
|
// Get retrieves the TestType from the indexer for a given namespace and name.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
Get(name string) (*v1.TestType, error)
|
||||||
|
TestTypeNamespaceListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// testTypeNamespaceLister implements the TestTypeNamespaceLister
|
||||||
|
// interface.
|
||||||
|
type testTypeNamespaceLister struct {
|
||||||
|
listers.ResourceIndexer[*v1.TestType]
|
||||||
|
}
|
@@ -81,6 +81,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
|||||||
"k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref),
|
"k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref),
|
||||||
"k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref),
|
"k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref),
|
||||||
"k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref),
|
"k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref),
|
||||||
|
"k8s.io/code-generator/examples/apiserver/apis/core/v1.TestType": schema_apiserver_apis_core_v1_TestType(ref),
|
||||||
|
"k8s.io/code-generator/examples/apiserver/apis/core/v1.TestTypeList": schema_apiserver_apis_core_v1_TestTypeList(ref),
|
||||||
|
"k8s.io/code-generator/examples/apiserver/apis/core/v1.TestTypeStatus": schema_apiserver_apis_core_v1_TestTypeStatus(ref),
|
||||||
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestType": schema_apiserver_apis_example_v1_TestType(ref),
|
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestType": schema_apiserver_apis_example_v1_TestType(ref),
|
||||||
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestTypeList": schema_apiserver_apis_example_v1_TestTypeList(ref),
|
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestTypeList": schema_apiserver_apis_example_v1_TestTypeList(ref),
|
||||||
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestTypeStatus": schema_apiserver_apis_example_v1_TestTypeStatus(ref),
|
"k8s.io/code-generator/examples/apiserver/apis/example/v1.TestTypeStatus": schema_apiserver_apis_example_v1_TestTypeStatus(ref),
|
||||||
@@ -2632,6 +2635,116 @@ func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func schema_apiserver_apis_core_v1_TestType(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "TestType is a top-level type. A client is created for it.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"kind": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"apiVersion": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/code-generator/examples/apiserver/apis/core/v1.TestTypeStatus"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/code-generator/examples/apiserver/apis/core/v1.TestTypeStatus"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_apiserver_apis_core_v1_TestTypeList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "TestTypeList is a top-level list type. The client methods for lists are automatically created. You are not supposed to create a separated client for this one.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"kind": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"apiVersion": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Type: []string{"array"},
|
||||||
|
Items: &spec.SchemaOrArray{
|
||||||
|
Schema: &spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/code-generator/examples/apiserver/apis/core/v1.TestType"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"items"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/code-generator/examples/apiserver/apis/core/v1.TestType"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_apiserver_apis_core_v1_TestTypeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"blah": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"blah"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func schema_apiserver_apis_example_v1_TestType(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
func schema_apiserver_apis_example_v1_TestType(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
return common.OpenAPIDefinition{
|
return common.OpenAPIDefinition{
|
||||||
Schema: spec.Schema{
|
Schema: spec.Schema{
|
||||||
@@ -2728,7 +2841,7 @@ func schema_apiserver_apis_example_v1_TestTypeStatus(ref common.ReferenceCallbac
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"Blah": {
|
"blah": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
@@ -2736,7 +2849,7 @@ func schema_apiserver_apis_example_v1_TestTypeStatus(ref common.ReferenceCallbac
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"Blah"},
|
Required: []string{"blah"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -2838,7 +2951,7 @@ func schema_apiserver_apis_example2_v1_TestTypeStatus(ref common.ReferenceCallba
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"Blah": {
|
"blah": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
@@ -2846,7 +2959,7 @@ func schema_apiserver_apis_example2_v1_TestTypeStatus(ref common.ReferenceCallba
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"Blah"},
|
Required: []string{"blah"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -2948,7 +3061,7 @@ func schema_apiserver_apis_example3io_v1_TestTypeStatus(ref common.ReferenceCall
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
Properties: map[string]spec.Schema{
|
Properties: map[string]spec.Schema{
|
||||||
"Blah": {
|
"blah": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Default: "",
|
Default: "",
|
||||||
Type: []string{"string"},
|
Type: []string{"string"},
|
||||||
@@ -2956,7 +3069,7 @@ func schema_apiserver_apis_example3io_v1_TestTypeStatus(ref common.ReferenceCall
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"Blah"},
|
Required: []string{"blah"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -44,16 +44,18 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient:nonNamespaced
|
// +genclient:nonNamespaced
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
type ClusterTestTypeList struct {
|
type ClusterTestTypeList struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta
|
// +optional
|
||||||
Items []ClusterTestType
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Items []ClusterTestType `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
@@ -71,5 +73,5 @@ type ClusterTestType struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClusterTestTypeStatus struct {
|
type ClusterTestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -43,5 +43,5 @@ type TestTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestTypeStatus struct {
|
type TestTypeStatus struct {
|
||||||
Blah string
|
Blah string `json:"blah"`
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type ClusterTestTypeApplyConfiguration struct {
|
type ClusterTestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.ClusterTestTypeStatus `json:"status,omitempty"`
|
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||||
@@ -204,8 +203,8 @@ func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationEx
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value examplev1.ClusterTestTypeStatus) *ClusterTestTypeApplyConfiguration {
|
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
examplev1 "k8s.io/code-generator/examples/crd/apis/example/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type TestTypeApplyConfiguration struct {
|
type TestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *examplev1.TestTypeStatus `json:"status,omitempty"`
|
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestType constructs a declarative configuration of the TestType type for use with
|
// TestType constructs a declarative configuration of the TestType type for use with
|
||||||
@@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *TestTypeApplyConfiguration) WithStatus(value examplev1.TestTypeStatus) *TestTypeApplyConfiguration {
|
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||||
|
return &TestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -22,7 +22,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
example2v1 "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||||
@@ -30,7 +29,7 @@ import (
|
|||||||
type TestTypeApplyConfiguration struct {
|
type TestTypeApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
Status *example2v1.TestTypeStatus `json:"status,omitempty"`
|
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestType constructs a declarative configuration of the TestType type for use with
|
// TestType constructs a declarative configuration of the TestType type for use with
|
||||||
@@ -205,8 +204,8 @@ func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists()
|
|||||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the Status field is set to the value of the last call.
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
func (b *TestTypeApplyConfiguration) WithStatus(value example2v1.TestTypeStatus) *TestTypeApplyConfiguration {
|
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
b.Status = &value
|
b.Status = value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||||
|
return &TestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -36,12 +36,18 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
// Group=example.crd.code-generator.k8s.io, Version=v1
|
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||||
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||||
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
return &examplev1.ClusterTestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||||
|
return &examplev1.ClusterTestTypeStatusApplyConfiguration{}
|
||||||
case v1.SchemeGroupVersion.WithKind("TestType"):
|
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||||
return &examplev1.TestTypeApplyConfiguration{}
|
return &examplev1.TestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||||
|
return &examplev1.TestTypeStatusApplyConfiguration{}
|
||||||
|
|
||||||
// Group=example.test.crd.code-generator.k8s.io, Version=v1
|
// Group=example.test.crd.code-generator.k8s.io, Version=v1
|
||||||
case example2v1.SchemeGroupVersion.WithKind("TestType"):
|
case example2v1.SchemeGroupVersion.WithKind("TestType"):
|
||||||
return &applyconfigurationexample2v1.TestTypeApplyConfiguration{}
|
return &applyconfigurationexample2v1.TestTypeApplyConfiguration{}
|
||||||
|
case example2v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||||
|
return &applyconfigurationexample2v1.TestTypeStatusApplyConfiguration{}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@@ -60,6 +60,15 @@ kube::codegen::gen_client \
|
|||||||
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
"${SCRIPT_ROOT}/crd/apis"
|
"${SCRIPT_ROOT}/crd/apis"
|
||||||
|
|
||||||
|
kube::codegen::gen_client \
|
||||||
|
--with-watch \
|
||||||
|
--with-applyconfig \
|
||||||
|
--output-dir "${SCRIPT_ROOT}/single" \
|
||||||
|
--output-pkg "${THIS_PKG}/single" \
|
||||||
|
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
|
--one-input-api "api" \
|
||||||
|
"${SCRIPT_ROOT}/single"
|
||||||
|
|
||||||
kube::codegen::gen_client \
|
kube::codegen::gen_client \
|
||||||
--with-watch \
|
--with-watch \
|
||||||
--with-applyconfig \
|
--with-applyconfig \
|
||||||
|
@@ -47,6 +47,7 @@ fi
|
|||||||
echo "Smoke testing examples by compiling..."
|
echo "Smoke testing examples by compiling..."
|
||||||
pushd "${SCRIPT_ROOT}"
|
pushd "${SCRIPT_ROOT}"
|
||||||
go build "k8s.io/code-generator/examples/crd/..."
|
go build "k8s.io/code-generator/examples/crd/..."
|
||||||
|
go build "k8s.io/code-generator/examples/single/..."
|
||||||
go build "k8s.io/code-generator/examples/apiserver/..."
|
go build "k8s.io/code-generator/examples/apiserver/..."
|
||||||
go build "k8s.io/code-generator/examples/MixedCase/..."
|
go build "k8s.io/code-generator/examples/MixedCase/..."
|
||||||
go build "k8s.io/code-generator/examples/HyphenGroup/..."
|
go build "k8s.io/code-generator/examples/HyphenGroup/..."
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen=package
|
||||||
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
|
// +groupName=example.crd.code-generator.k8s.io
|
||||||
|
|
||||||
|
package v1 // import "k8s.io/code-generator/examples/crd/apis/example/v1"
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
var SchemeGroupVersion = schema.GroupVersion{Group: "example.crd.code-generator.k8s.io", Version: "v1"}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
|
SchemeBuilder runtime.SchemeBuilder
|
||||||
|
localSchemeBuilder = &SchemeBuilder
|
||||||
|
AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// We only register manually written functions here. The registration of the
|
||||||
|
// generated functions takes place in the generated files. The separation
|
||||||
|
// makes the code compile even when the generated files are missing.
|
||||||
|
localSchemeBuilder.Register(addKnownTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
|
func Resource(resource string) schema.GroupResource {
|
||||||
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds the list of known types to the given scheme.
|
||||||
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&TestType{},
|
||||||
|
&TestTypeList{},
|
||||||
|
)
|
||||||
|
|
||||||
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
|
&metav1.Status{},
|
||||||
|
)
|
||||||
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
return nil
|
||||||
|
}
|
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestType is a top-level type. A client is created for it.
|
||||||
|
type TestType struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
// +optional
|
||||||
|
Status TestTypeStatus `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TestTypeList is a top-level list type. The client methods for lists are automatically created.
|
||||||
|
// You are not supposed to create a separated client for this one.
|
||||||
|
type TestTypeList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
|
Items []TestType `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestTypeStatus struct {
|
||||||
|
Blah string `json:"blah"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +genclient:nonNamespaced
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
type ClusterTestTypeList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty"`
|
||||||
|
Items []ClusterTestType `json:"items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +genclient:nonNamespaced
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
|
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
|
|
||||||
|
type ClusterTestType struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
// +optional
|
||||||
|
Status ClusterTestTypeStatus `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClusterTestTypeStatus struct {
|
||||||
|
Blah string `json:"blah"`
|
||||||
|
}
|
178
staging/src/k8s.io/code-generator/examples/single/api/v1/zz_generated.deepcopy.go
generated
Normal file
178
staging/src/k8s.io/code-generator/examples/single/api/v1/zz_generated.deepcopy.go
generated
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ClusterTestType) DeepCopyInto(out *ClusterTestType) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Status = in.Status
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestType.
|
||||||
|
func (in *ClusterTestType) DeepCopy() *ClusterTestType {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ClusterTestType)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *ClusterTestType) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ClusterTestTypeList) DeepCopyInto(out *ClusterTestTypeList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]ClusterTestType, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestTypeList.
|
||||||
|
func (in *ClusterTestTypeList) DeepCopy() *ClusterTestTypeList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ClusterTestTypeList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *ClusterTestTypeList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ClusterTestTypeStatus) DeepCopyInto(out *ClusterTestTypeStatus) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTestTypeStatus.
|
||||||
|
func (in *ClusterTestTypeStatus) DeepCopy() *ClusterTestTypeStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ClusterTestTypeStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestType) DeepCopyInto(out *TestType) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
out.Status = in.Status
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType.
|
||||||
|
func (in *TestType) DeepCopy() *TestType {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestType)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestType) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeList) DeepCopyInto(out *TestTypeList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]TestType, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeList.
|
||||||
|
func (in *TestTypeList) DeepCopy() *TestTypeList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TestTypeList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TestTypeStatus) DeepCopyInto(out *TestTypeStatus) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestTypeStatus.
|
||||||
|
func (in *TestTypeStatus) DeepCopy() *TestTypeStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TestTypeStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
33
staging/src/k8s.io/code-generator/examples/single/api/v1/zz_generated.defaults.go
generated
Normal file
33
staging/src/k8s.io/code-generator/examples/single/api/v1/zz_generated.defaults.go
generated
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//go:build !ignore_autogenerated
|
||||||
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by defaulter-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||||
|
// Public to allow building arbitrary schemes.
|
||||||
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
return nil
|
||||||
|
}
|
@@ -0,0 +1,215 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterTestTypeApplyConfiguration represents a declarative configuration of the ClusterTestType type for use
|
||||||
|
// with apply.
|
||||||
|
type ClusterTestTypeApplyConfiguration struct {
|
||||||
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
|
Status *ClusterTestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestType constructs a declarative configuration of the ClusterTestType type for use with
|
||||||
|
// apply.
|
||||||
|
func ClusterTestType(name string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b := &ClusterTestTypeApplyConfiguration{}
|
||||||
|
b.WithName(name)
|
||||||
|
b.WithKind("ClusterTestType")
|
||||||
|
b.WithAPIVersion("example.crd.code-generator.k8s.io/v1")
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Kind field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithKind(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.Kind = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithAPIVersion(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.APIVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithName(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithGenerateName(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.GenerateName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithNamespace(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Namespace = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUID sets the UID field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the UID field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithUID(value types.UID) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.UID = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithResourceVersion(value string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ResourceVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Generation field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithGeneration(value int64) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Generation = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.CreationTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionGracePeriodSeconds = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||||
|
// overwriting an existing map entries in Labels field with the same key.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithLabels(entries map[string]string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Labels == nil && len(entries) > 0 {
|
||||||
|
b.Labels = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Labels[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||||
|
// overwriting an existing map entries in Annotations field with the same key.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Annotations == nil && len(entries) > 0 {
|
||||||
|
b.Annotations = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Annotations[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithOwnerReferences")
|
||||||
|
}
|
||||||
|
b.OwnerReferences = append(b.OwnerReferences, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithFinalizers(values ...string) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
b.Finalizers = append(b.Finalizers, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||||
|
if b.ObjectMetaApplyConfiguration == nil {
|
||||||
|
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) WithStatus(value *ClusterTestTypeStatusApplyConfiguration) *ClusterTestTypeApplyConfiguration {
|
||||||
|
b.Status = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||||
|
func (b *ClusterTestTypeApplyConfiguration) GetName() *string {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
return b.Name
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration represents a declarative configuration of the ClusterTestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type ClusterTestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypeStatusApplyConfiguration constructs a declarative configuration of the ClusterTestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func ClusterTestTypeStatus() *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
return &ClusterTestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *ClusterTestTypeStatusApplyConfiguration) WithBlah(value string) *ClusterTestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypeApplyConfiguration represents a declarative configuration of the TestType type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeApplyConfiguration struct {
|
||||||
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
|
Status *TestTypeStatusApplyConfiguration `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestType constructs a declarative configuration of the TestType type for use with
|
||||||
|
// apply.
|
||||||
|
func TestType(name, namespace string) *TestTypeApplyConfiguration {
|
||||||
|
b := &TestTypeApplyConfiguration{}
|
||||||
|
b.WithName(name)
|
||||||
|
b.WithNamespace(namespace)
|
||||||
|
b.WithKind("TestType")
|
||||||
|
b.WithAPIVersion("example.crd.code-generator.k8s.io/v1")
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Kind field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithKind(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.Kind = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithAPIVersion(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.APIVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithName(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithGenerateName(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.GenerateName = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithNamespace(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Namespace = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUID sets the UID field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the UID field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithUID(value types.UID) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.UID = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithResourceVersion(value string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.ResourceVersion = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Generation field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithGeneration(value int64) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.Generation = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.CreationTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionTimestamp = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
b.DeletionGracePeriodSeconds = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||||
|
// overwriting an existing map entries in Labels field with the same key.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithLabels(entries map[string]string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Labels == nil && len(entries) > 0 {
|
||||||
|
b.Labels = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Labels[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||||
|
// overwriting an existing map entries in Annotations field with the same key.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithAnnotations(entries map[string]string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
if b.Annotations == nil && len(entries) > 0 {
|
||||||
|
b.Annotations = make(map[string]string, len(entries))
|
||||||
|
}
|
||||||
|
for k, v := range entries {
|
||||||
|
b.Annotations[k] = v
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithOwnerReferences")
|
||||||
|
}
|
||||||
|
b.OwnerReferences = append(b.OwnerReferences, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithFinalizers(values ...string) *TestTypeApplyConfiguration {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
for i := range values {
|
||||||
|
b.Finalizers = append(b.Finalizers, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *TestTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||||
|
if b.ObjectMetaApplyConfiguration == nil {
|
||||||
|
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Status field is set to the value of the last call.
|
||||||
|
func (b *TestTypeApplyConfiguration) WithStatus(value *TestTypeStatusApplyConfiguration) *TestTypeApplyConfiguration {
|
||||||
|
b.Status = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||||
|
func (b *TestTypeApplyConfiguration) GetName() *string {
|
||||||
|
b.ensureObjectMetaApplyConfigurationExists()
|
||||||
|
return b.Name
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration represents a declarative configuration of the TestTypeStatus type for use
|
||||||
|
// with apply.
|
||||||
|
type TestTypeStatusApplyConfiguration struct {
|
||||||
|
Blah *string `json:"blah,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeStatusApplyConfiguration constructs a declarative configuration of the TestTypeStatus type for use with
|
||||||
|
// apply.
|
||||||
|
func TestTypeStatus() *TestTypeStatusApplyConfiguration {
|
||||||
|
return &TestTypeStatusApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBlah sets the Blah field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Blah field is set to the value of the last call.
|
||||||
|
func (b *TestTypeStatusApplyConfiguration) WithBlah(value string) *TestTypeStatusApplyConfiguration {
|
||||||
|
b.Blah = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package internal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
typed "sigs.k8s.io/structured-merge-diff/v4/typed"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Parser() *typed.Parser {
|
||||||
|
parserOnce.Do(func() {
|
||||||
|
var err error
|
||||||
|
parser, err = typed.NewParser(schemaYAML)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("Failed to parse schema: %v", err))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return parser
|
||||||
|
}
|
||||||
|
|
||||||
|
var parserOnce sync.Once
|
||||||
|
var parser *typed.Parser
|
||||||
|
var schemaYAML = typed.YAMLObject(`types:
|
||||||
|
- name: __untyped_atomic_
|
||||||
|
scalar: untyped
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
namedType: __untyped_atomic_
|
||||||
|
elementRelationship: atomic
|
||||||
|
map:
|
||||||
|
elementType:
|
||||||
|
namedType: __untyped_atomic_
|
||||||
|
elementRelationship: atomic
|
||||||
|
- name: __untyped_deduced_
|
||||||
|
scalar: untyped
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
namedType: __untyped_atomic_
|
||||||
|
elementRelationship: atomic
|
||||||
|
map:
|
||||||
|
elementType:
|
||||||
|
namedType: __untyped_deduced_
|
||||||
|
elementRelationship: separable
|
||||||
|
`)
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package applyconfiguration
|
||||||
|
|
||||||
|
import (
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||||
|
internal "k8s.io/code-generator/examples/single/applyconfiguration/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
|
||||||
|
// apply configuration type exists for the given GroupVersionKind.
|
||||||
|
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||||
|
switch kind {
|
||||||
|
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||||
|
case v1.SchemeGroupVersion.WithKind("ClusterTestType"):
|
||||||
|
return &apiv1.ClusterTestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("ClusterTestTypeStatus"):
|
||||||
|
return &apiv1.ClusterTestTypeStatusApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("TestType"):
|
||||||
|
return &apiv1.TestTypeApplyConfiguration{}
|
||||||
|
case v1.SchemeGroupVersion.WithKind("TestTypeStatus"):
|
||||||
|
return &apiv1.TestTypeStatusApplyConfiguration{}
|
||||||
|
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter {
|
||||||
|
return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()}
|
||||||
|
}
|
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package versioned
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
discovery "k8s.io/client-go/discovery"
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||||
|
examplev1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Interface interface {
|
||||||
|
Discovery() discovery.DiscoveryInterface
|
||||||
|
ExampleV1() examplev1.ExampleV1Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset contains the clients for groups.
|
||||||
|
type Clientset struct {
|
||||||
|
*discovery.DiscoveryClient
|
||||||
|
exampleV1 *examplev1.ExampleV1Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExampleV1 retrieves the ExampleV1Client
|
||||||
|
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
||||||
|
return c.exampleV1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discovery retrieves the DiscoveryClient
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.DiscoveryClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new Clientset for the given config.
|
||||||
|
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
||||||
|
// NewForConfig will generate a rate-limiter in configShallowCopy.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
|
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||||
|
configShallowCopy := *c
|
||||||
|
|
||||||
|
if configShallowCopy.UserAgent == "" {
|
||||||
|
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
// share the transport between all clients
|
||||||
|
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new Clientset for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
||||||
|
// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) {
|
||||||
|
configShallowCopy := *c
|
||||||
|
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||||
|
if configShallowCopy.Burst <= 0 {
|
||||||
|
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
|
||||||
|
}
|
||||||
|
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||||
|
}
|
||||||
|
|
||||||
|
var cs Clientset
|
||||||
|
var err error
|
||||||
|
cs.exampleV1, err = examplev1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &cs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||||
|
cs, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return cs
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new Clientset for the given RESTClient.
|
||||||
|
func New(c rest.Interface) *Clientset {
|
||||||
|
var cs Clientset
|
||||||
|
cs.exampleV1 = examplev1.New(c)
|
||||||
|
|
||||||
|
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||||
|
return &cs
|
||||||
|
}
|
@@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
|
"k8s.io/client-go/discovery"
|
||||||
|
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||||
|
"k8s.io/client-go/testing"
|
||||||
|
applyconfiguration "k8s.io/code-generator/examples/single/applyconfiguration"
|
||||||
|
clientset "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||||
|
examplev1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1"
|
||||||
|
fakeexamplev1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1/fake"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||||
|
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||||
|
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
|
||||||
|
// for a real clientset and is mostly useful in simple unit tests.
|
||||||
|
//
|
||||||
|
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||||
|
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
|
||||||
|
// via --with-applyconfig).
|
||||||
|
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||||
|
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||||
|
for _, obj := range objects {
|
||||||
|
if err := o.Add(obj); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cs := &Clientset{tracker: o}
|
||||||
|
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||||
|
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
|
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||||
|
gvr := action.GetResource()
|
||||||
|
ns := action.GetNamespace()
|
||||||
|
watch, err := o.Watch(gvr, ns)
|
||||||
|
if err != nil {
|
||||||
|
return false, nil, err
|
||||||
|
}
|
||||||
|
return true, watch, nil
|
||||||
|
})
|
||||||
|
|
||||||
|
return cs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||||
|
// struct to get a default implementation. This makes faking out just the method
|
||||||
|
// you want to test easier.
|
||||||
|
type Clientset struct {
|
||||||
|
testing.Fake
|
||||||
|
discovery *fakediscovery.FakeDiscovery
|
||||||
|
tracker testing.ObjectTracker
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
|
return c.discovery
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||||
|
return c.tracker
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClientset returns a clientset that will respond with the provided objects.
|
||||||
|
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||||
|
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||||
|
// for a real clientset and is mostly useful in simple unit tests.
|
||||||
|
func NewClientset(objects ...runtime.Object) *Clientset {
|
||||||
|
o := testing.NewFieldManagedObjectTracker(
|
||||||
|
scheme,
|
||||||
|
codecs.UniversalDecoder(),
|
||||||
|
applyconfiguration.NewTypeConverter(scheme),
|
||||||
|
)
|
||||||
|
for _, obj := range objects {
|
||||||
|
if err := o.Add(obj); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cs := &Clientset{tracker: o}
|
||||||
|
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||||
|
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
|
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||||
|
gvr := action.GetResource()
|
||||||
|
ns := action.GetNamespace()
|
||||||
|
watch, err := o.Watch(gvr, ns)
|
||||||
|
if err != nil {
|
||||||
|
return false, nil, err
|
||||||
|
}
|
||||||
|
return true, watch, nil
|
||||||
|
})
|
||||||
|
|
||||||
|
return cs
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ clientset.Interface = &Clientset{}
|
||||||
|
_ testing.FakeClient = &Clientset{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// ExampleV1 retrieves the ExampleV1Client
|
||||||
|
func (c *Clientset) ExampleV1() examplev1.ExampleV1Interface {
|
||||||
|
return &fakeexamplev1.FakeExampleV1{Fake: &c.Fake}
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package has the automatically generated fake clientset.
|
||||||
|
package fake
|
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
examplev1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var scheme = runtime.NewScheme()
|
||||||
|
var codecs = serializer.NewCodecFactory(scheme)
|
||||||
|
|
||||||
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
|
examplev1.AddToScheme,
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||||
|
// of clientsets, like in:
|
||||||
|
//
|
||||||
|
// import (
|
||||||
|
// "k8s.io/client-go/kubernetes"
|
||||||
|
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
|
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||||
|
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||||
|
//
|
||||||
|
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||||
|
// correctly.
|
||||||
|
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||||
|
utilruntime.Must(AddToScheme(scheme))
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package contains the scheme of the automatically generated clientset.
|
||||||
|
package scheme
|
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package scheme
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
examplev1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Scheme = runtime.NewScheme()
|
||||||
|
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||||
|
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||||
|
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
|
examplev1.AddToScheme,
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||||
|
// of clientsets, like in:
|
||||||
|
//
|
||||||
|
// import (
|
||||||
|
// "k8s.io/client-go/kubernetes"
|
||||||
|
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
|
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||||
|
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||||
|
//
|
||||||
|
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||||
|
// correctly.
|
||||||
|
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||||
|
utilruntime.Must(AddToScheme(Scheme))
|
||||||
|
}
|
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
"k8s.io/code-generator/examples/single/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ExampleV1Interface interface {
|
||||||
|
RESTClient() rest.Interface
|
||||||
|
ClusterTestTypesGetter
|
||||||
|
TestTypesGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExampleV1Client is used to interact with features provided by the example.crd.code-generator.k8s.io group.
|
||||||
|
type ExampleV1Client struct {
|
||||||
|
restClient rest.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ExampleV1Client) ClusterTestTypes() ClusterTestTypeInterface {
|
||||||
|
return newClusterTestTypes(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ExampleV1Client) TestTypes(namespace string) TestTypeInterface {
|
||||||
|
return newTestTypes(c, namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfig creates a new ExampleV1Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
|
func NewForConfig(c *rest.Config) (*ExampleV1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new ExampleV1Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ExampleV1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ExampleV1Client{client}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigOrDie creates a new ExampleV1Client for the given config and
|
||||||
|
// panics if there is an error in the config.
|
||||||
|
func NewForConfigOrDie(c *rest.Config) *ExampleV1Client {
|
||||||
|
client, err := NewForConfig(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new ExampleV1Client for the given RESTClient.
|
||||||
|
func New(c rest.Interface) *ExampleV1Client {
|
||||||
|
return &ExampleV1Client{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setConfigDefaults(config *rest.Config) error {
|
||||||
|
gv := v1.SchemeGroupVersion
|
||||||
|
config.GroupVersion = &gv
|
||||||
|
config.APIPath = "/apis"
|
||||||
|
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||||
|
|
||||||
|
if config.UserAgent == "" {
|
||||||
|
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *ExampleV1Client) RESTClient() rest.Interface {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.restClient
|
||||||
|
}
|
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
gentype "k8s.io/client-go/gentype"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||||
|
scheme "k8s.io/code-generator/examples/single/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterTestTypesGetter has a method to return a ClusterTestTypeInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type ClusterTestTypesGetter interface {
|
||||||
|
ClusterTestTypes() ClusterTestTypeInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypeInterface has methods to work with ClusterTestType resources.
|
||||||
|
type ClusterTestTypeInterface interface {
|
||||||
|
Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (*v1.ClusterTestType, error)
|
||||||
|
Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error)
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (*v1.ClusterTestType, error)
|
||||||
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterTestType, error)
|
||||||
|
List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterTestTypeList, error)
|
||||||
|
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error)
|
||||||
|
Apply(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error)
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||||
|
ApplyStatus(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error)
|
||||||
|
GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
|
||||||
|
UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
|
||||||
|
|
||||||
|
ClusterTestTypeExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusterTestTypes implements ClusterTestTypeInterface
|
||||||
|
type clusterTestTypes struct {
|
||||||
|
*gentype.ClientWithListAndApply[*v1.ClusterTestType, *v1.ClusterTestTypeList, *apiv1.ClusterTestTypeApplyConfiguration]
|
||||||
|
}
|
||||||
|
|
||||||
|
// newClusterTestTypes returns a ClusterTestTypes
|
||||||
|
func newClusterTestTypes(c *ExampleV1Client) *clusterTestTypes {
|
||||||
|
return &clusterTestTypes{
|
||||||
|
gentype.NewClientWithListAndApply[*v1.ClusterTestType, *v1.ClusterTestTypeList, *apiv1.ClusterTestTypeApplyConfiguration](
|
||||||
|
"clustertesttypes",
|
||||||
|
c.RESTClient(),
|
||||||
|
scheme.ParameterCodec,
|
||||||
|
"",
|
||||||
|
func() *v1.ClusterTestType { return &v1.ClusterTestType{} },
|
||||||
|
func() *v1.ClusterTestTypeList { return &v1.ClusterTestTypeList{} }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the clusterTestType, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
|
||||||
|
func (c *clusterTestTypes) GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.GetClient().Get().
|
||||||
|
Resource("clustertesttypes").
|
||||||
|
Name(clusterTestTypeName).
|
||||||
|
SubResource("scale").
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *clusterTestTypes) UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.GetClient().Put().
|
||||||
|
Resource("clustertesttypes").
|
||||||
|
Name(clusterTestTypeName).
|
||||||
|
SubResource("scale").
|
||||||
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Body(scale).
|
||||||
|
Do(ctx).
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// This package has the automatically generated typed clients.
|
||||||
|
package v1
|
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
// Package fake has the automatically generated clients.
|
||||||
|
package fake
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
rest "k8s.io/client-go/rest"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/clientset/versioned/typed/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FakeExampleV1 struct {
|
||||||
|
*testing.Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExampleV1) ClusterTestTypes() v1.ClusterTestTypeInterface {
|
||||||
|
return &FakeClusterTestTypes{c}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FakeExampleV1) TestTypes(namespace string) v1.TestTypeInterface {
|
||||||
|
return &FakeTestTypes{c, namespace}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
// with API server by this client implementation.
|
||||||
|
func (c *FakeExampleV1) RESTClient() rest.Interface {
|
||||||
|
var ret *rest.RESTClient
|
||||||
|
return ret
|
||||||
|
}
|
@@ -0,0 +1,209 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
json "encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeClusterTestTypes implements ClusterTestTypeInterface
|
||||||
|
type FakeClusterTestTypes struct {
|
||||||
|
Fake *FakeExampleV1
|
||||||
|
}
|
||||||
|
|
||||||
|
var clustertesttypesResource = v1.SchemeGroupVersion.WithResource("clustertesttypes")
|
||||||
|
|
||||||
|
var clustertesttypesKind = v1.SchemeGroupVersion.WithKind("ClusterTestType")
|
||||||
|
|
||||||
|
// Get takes name of the clusterTestType, and returns the corresponding clusterTestType object, and an error if there is any.
|
||||||
|
func (c *FakeClusterTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetActionWithOptions(clustertesttypesResource, name, options), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of ClusterTestTypes that match those selectors.
|
||||||
|
func (c *FakeClusterTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterTestTypeList, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestTypeList{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootListActionWithOptions(clustertesttypesResource, clustertesttypesKind, opts), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1.ClusterTestTypeList{ListMeta: obj.(*v1.ClusterTestTypeList).ListMeta}
|
||||||
|
for _, item := range obj.(*v1.ClusterTestTypeList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested clusterTestTypes.
|
||||||
|
func (c *FakeClusterTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewRootWatchActionWithOptions(clustertesttypesResource, opts))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a clusterTestType and creates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||||
|
func (c *FakeClusterTestTypes) Create(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.CreateOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootCreateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a clusterTestType and updates it. Returns the server's representation of the clusterTestType, and an error, if there is any.
|
||||||
|
func (c *FakeClusterTestTypes) Update(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateActionWithOptions(clustertesttypesResource, clusterTestType, opts), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeClusterTestTypes) UpdateStatus(ctx context.Context, clusterTestType *v1.ClusterTestType, opts metav1.UpdateOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "status", clusterTestType, opts), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the clusterTestType and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeClusterTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootDeleteActionWithOptions(clustertesttypesResource, name, opts), &v1.ClusterTestType{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeClusterTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||||
|
action := testing.NewRootDeleteCollectionActionWithOptions(clustertesttypesResource, opts, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1.ClusterTestTypeList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched clusterTestType.
|
||||||
|
func (c *FakeClusterTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterTestType, err error) {
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, name, pt, data, opts, subresources...), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply takes the given apply declarative configuration, applies it and returns the applied clusterTestType.
|
||||||
|
func (c *FakeClusterTestTypes) Apply(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
if clusterTestType == nil {
|
||||||
|
return nil, fmt.Errorf("clusterTestType provided to Apply must not be nil")
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(clusterTestType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
name := clusterTestType.Name
|
||||||
|
if name == nil {
|
||||||
|
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||||
|
}
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ApplyStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||||
|
func (c *FakeClusterTestTypes) ApplyStatus(ctx context.Context, clusterTestType *apiv1.ClusterTestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterTestType, err error) {
|
||||||
|
if clusterTestType == nil {
|
||||||
|
return nil, fmt.Errorf("clusterTestType provided to Apply must not be nil")
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(clusterTestType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
name := clusterTestType.Name
|
||||||
|
if name == nil {
|
||||||
|
return nil, fmt.Errorf("clusterTestType.Name must be provided to Apply")
|
||||||
|
}
|
||||||
|
emptyResult := &v1.ClusterTestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clustertesttypesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.ClusterTestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the clusterTestType, and returns the corresponding scale object, and an error if there is any.
|
||||||
|
func (c *FakeClusterTestTypes) GetScale(ctx context.Context, clusterTestTypeName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
emptyResult := &autoscalingv1.Scale{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootGetSubresourceActionWithOptions(clustertesttypesResource, "scale", clusterTestTypeName, options), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *FakeClusterTestTypes) UpdateScale(ctx context.Context, clusterTestTypeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
emptyResult := &autoscalingv1.Scale{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clustertesttypesResource, "scale", scale, opts), emptyResult)
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package fake
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
json "encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
testing "k8s.io/client-go/testing"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FakeTestTypes implements TestTypeInterface
|
||||||
|
type FakeTestTypes struct {
|
||||||
|
Fake *FakeExampleV1
|
||||||
|
ns string
|
||||||
|
}
|
||||||
|
|
||||||
|
var testtypesResource = v1.SchemeGroupVersion.WithResource("testtypes")
|
||||||
|
|
||||||
|
var testtypesKind = v1.SchemeGroupVersion.WithKind("TestType")
|
||||||
|
|
||||||
|
// Get takes name of the testType, and returns the corresponding testType object, and an error if there is any.
|
||||||
|
func (c *FakeTestTypes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetActionWithOptions(testtypesResource, c.ns, name, options), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// List takes label and field selectors, and returns the list of TestTypes that match those selectors.
|
||||||
|
func (c *FakeTestTypes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TestTypeList, err error) {
|
||||||
|
emptyResult := &v1.TestTypeList{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewListActionWithOptions(testtypesResource, testtypesKind, c.ns, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||||
|
if label == nil {
|
||||||
|
label = labels.Everything()
|
||||||
|
}
|
||||||
|
list := &v1.TestTypeList{ListMeta: obj.(*v1.TestTypeList).ListMeta}
|
||||||
|
for _, item := range obj.(*v1.TestTypeList).Items {
|
||||||
|
if label.Matches(labels.Set(item.Labels)) {
|
||||||
|
list.Items = append(list.Items, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch returns a watch.Interface that watches the requested testTypes.
|
||||||
|
func (c *FakeTestTypes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
return c.Fake.
|
||||||
|
InvokesWatch(testing.NewWatchActionWithOptions(testtypesResource, c.ns, opts))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create takes the representation of a testType and creates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||||
|
func (c *FakeTestTypes) Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewCreateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update takes the representation of a testType and updates it. Returns the server's representation of the testType, and an error, if there is any.
|
||||||
|
func (c *FakeTestTypes) Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateActionWithOptions(testtypesResource, c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
func (c *FakeTestTypes) UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceActionWithOptions(testtypesResource, "status", c.ns, testType, opts), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete takes name of the testType and deletes it. Returns an error if one occurs.
|
||||||
|
func (c *FakeTestTypes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||||
|
_, err := c.Fake.
|
||||||
|
Invokes(testing.NewDeleteActionWithOptions(testtypesResource, c.ns, name, opts), &v1.TestType{})
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCollection deletes a collection of objects.
|
||||||
|
func (c *FakeTestTypes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||||
|
action := testing.NewDeleteCollectionActionWithOptions(testtypesResource, c.ns, opts, listOpts)
|
||||||
|
|
||||||
|
_, err := c.Fake.Invokes(action, &v1.TestTypeList{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch applies the patch and returns the patched testType.
|
||||||
|
func (c *FakeTestTypes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error) {
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply takes the given apply declarative configuration, applies it and returns the applied testType.
|
||||||
|
func (c *FakeTestTypes) Apply(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||||
|
if testType == nil {
|
||||||
|
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(testType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
name := testType.Name
|
||||||
|
if name == nil {
|
||||||
|
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||||
|
}
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ApplyStatus was generated because the type contains a Status member.
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||||
|
func (c *FakeTestTypes) ApplyStatus(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error) {
|
||||||
|
if testType == nil {
|
||||||
|
return nil, fmt.Errorf("testType provided to Apply must not be nil")
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(testType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
name := testType.Name
|
||||||
|
if name == nil {
|
||||||
|
return nil, fmt.Errorf("testType.Name must be provided to Apply")
|
||||||
|
}
|
||||||
|
emptyResult := &v1.TestType{}
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewPatchSubresourceActionWithOptions(testtypesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return emptyResult, err
|
||||||
|
}
|
||||||
|
return obj.(*v1.TestType), err
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
type ClusterTestTypeExpansion interface{}
|
||||||
|
|
||||||
|
type TestTypeExpansion interface{}
|
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by client-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
gentype "k8s.io/client-go/gentype"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/applyconfiguration/api/v1"
|
||||||
|
scheme "k8s.io/code-generator/examples/single/clientset/versioned/scheme"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypesGetter has a method to return a TestTypeInterface.
|
||||||
|
// A group's client should implement this interface.
|
||||||
|
type TestTypesGetter interface {
|
||||||
|
TestTypes(namespace string) TestTypeInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypeInterface has methods to work with TestType resources.
|
||||||
|
type TestTypeInterface interface {
|
||||||
|
Create(ctx context.Context, testType *v1.TestType, opts metav1.CreateOptions) (*v1.TestType, error)
|
||||||
|
Update(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
UpdateStatus(ctx context.Context, testType *v1.TestType, opts metav1.UpdateOptions) (*v1.TestType, error)
|
||||||
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.TestType, error)
|
||||||
|
List(ctx context.Context, opts metav1.ListOptions) (*v1.TestTypeList, error)
|
||||||
|
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||||
|
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
|
||||||
|
Apply(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||||
|
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||||
|
ApplyStatus(ctx context.Context, testType *apiv1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
|
||||||
|
TestTypeExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// testTypes implements TestTypeInterface
|
||||||
|
type testTypes struct {
|
||||||
|
*gentype.ClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *apiv1.TestTypeApplyConfiguration]
|
||||||
|
}
|
||||||
|
|
||||||
|
// newTestTypes returns a TestTypes
|
||||||
|
func newTestTypes(c *ExampleV1Client, namespace string) *testTypes {
|
||||||
|
return &testTypes{
|
||||||
|
gentype.NewClientWithListAndApply[*v1.TestType, *v1.TestTypeList, *apiv1.TestTypeApplyConfiguration](
|
||||||
|
"testtypes",
|
||||||
|
c.RESTClient(),
|
||||||
|
scheme.ParameterCodec,
|
||||||
|
namespace,
|
||||||
|
func() *v1.TestType { return &v1.TestType{} },
|
||||||
|
func() *v1.TestTypeList { return &v1.TestTypeList{} }),
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "k8s.io/code-generator/examples/single/informers/externalversions/api/v1"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/single/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to each of this group's versions.
|
||||||
|
type Interface interface {
|
||||||
|
// V1 provides access to shared informers for resources in V1.
|
||||||
|
V1() v1.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
type group struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// V1 returns a new v1.Interface.
|
||||||
|
func (g *group) V1() v1.Interface {
|
||||||
|
return v1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||||
|
}
|
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
versioned "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/single/informers/externalversions/internalinterfaces"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/listers/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterTestTypeInformer provides access to a shared informer and lister for
|
||||||
|
// ClusterTestTypes.
|
||||||
|
type ClusterTestTypeInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.ClusterTestTypeLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type clusterTestTypeInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClusterTestTypeInformer constructs a new informer for ClusterTestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredClusterTestTypeInformer(client, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredClusterTestTypeInformer constructs a new informer for ClusterTestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredClusterTestTypeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.ExampleV1().ClusterTestTypes().List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.ExampleV1().ClusterTestTypes().Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&apiv1.ClusterTestType{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterTestTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredClusterTestTypeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterTestTypeInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&apiv1.ClusterTestType{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *clusterTestTypeInformer) Lister() v1.ClusterTestTypeLister {
|
||||||
|
return v1.NewClusterTestTypeLister(f.Informer().GetIndexer())
|
||||||
|
}
|
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/single/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Interface provides access to all the informers in this group version.
|
||||||
|
type Interface interface {
|
||||||
|
// ClusterTestTypes returns a ClusterTestTypeInformer.
|
||||||
|
ClusterTestTypes() ClusterTestTypeInformer
|
||||||
|
// TestTypes returns a TestTypeInformer.
|
||||||
|
TestTypes() TestTypeInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
type version struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a new Interface.
|
||||||
|
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||||
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterTestTypes returns a ClusterTestTypeInformer.
|
||||||
|
func (v *version) ClusterTestTypes() ClusterTestTypeInformer {
|
||||||
|
return &clusterTestTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestTypes returns a TestTypeInformer.
|
||||||
|
func (v *version) TestTypes() TestTypeInformer {
|
||||||
|
return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
apiv1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
versioned "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/single/informers/externalversions/internalinterfaces"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/listers/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestTypeInformer provides access to a shared informer and lister for
|
||||||
|
// TestTypes.
|
||||||
|
type TestTypeInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.TestTypeLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type testTypeInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
namespace string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewTestTypeInformer constructs a new informer for TestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredTestTypeInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredTestTypeInformer constructs a new informer for TestType type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredTestTypeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.ExampleV1().TestTypes(namespace).List(context.TODO(), options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.ExampleV1().TestTypes(namespace).Watch(context.TODO(), options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&apiv1.TestType{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredTestTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&apiv1.TestType{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *testTypeInformer) Lister() v1.TestTypeLister {
|
||||||
|
return v1.NewTestTypeLister(f.Informer().GetIndexer())
|
||||||
|
}
|
@@ -0,0 +1,261 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package externalversions
|
||||||
|
|
||||||
|
import (
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
versioned "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||||
|
api "k8s.io/code-generator/examples/single/informers/externalversions/api"
|
||||||
|
internalinterfaces "k8s.io/code-generator/examples/single/informers/externalversions/internalinterfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SharedInformerOption defines the functional option type for SharedInformerFactory.
|
||||||
|
type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory
|
||||||
|
|
||||||
|
type sharedInformerFactory struct {
|
||||||
|
client versioned.Interface
|
||||||
|
namespace string
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
lock sync.Mutex
|
||||||
|
defaultResync time.Duration
|
||||||
|
customResync map[reflect.Type]time.Duration
|
||||||
|
transform cache.TransformFunc
|
||||||
|
|
||||||
|
informers map[reflect.Type]cache.SharedIndexInformer
|
||||||
|
// startedInformers is used for tracking which informers have been started.
|
||||||
|
// This allows Start() to be called multiple times safely.
|
||||||
|
startedInformers map[reflect.Type]bool
|
||||||
|
// wg tracks how many goroutines were started.
|
||||||
|
wg sync.WaitGroup
|
||||||
|
// shuttingDown is true when Shutdown has been called. It may still be running
|
||||||
|
// because it needs to wait for goroutines.
|
||||||
|
shuttingDown bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
|
||||||
|
func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption {
|
||||||
|
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||||
|
for k, v := range resyncConfig {
|
||||||
|
factory.customResync[reflect.TypeOf(k)] = v
|
||||||
|
}
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
|
||||||
|
func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption {
|
||||||
|
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||||
|
factory.tweakListOptions = tweakListOptions
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamespace limits the SharedInformerFactory to the specified namespace.
|
||||||
|
func WithNamespace(namespace string) SharedInformerOption {
|
||||||
|
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||||
|
factory.namespace = namespace
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTransform sets a transform on all informers.
|
||||||
|
func WithTransform(transform cache.TransformFunc) SharedInformerOption {
|
||||||
|
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||||
|
factory.transform = transform
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
||||||
|
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||||
|
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
|
||||||
|
// Listers obtained via this SharedInformerFactory will be subject to the same filters
|
||||||
|
// as specified here.
|
||||||
|
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
|
||||||
|
func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
|
||||||
|
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
|
||||||
|
func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory {
|
||||||
|
factory := &sharedInformerFactory{
|
||||||
|
client: client,
|
||||||
|
namespace: v1.NamespaceAll,
|
||||||
|
defaultResync: defaultResync,
|
||||||
|
informers: make(map[reflect.Type]cache.SharedIndexInformer),
|
||||||
|
startedInformers: make(map[reflect.Type]bool),
|
||||||
|
customResync: make(map[reflect.Type]time.Duration),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply all options
|
||||||
|
for _, opt := range options {
|
||||||
|
factory = opt(factory)
|
||||||
|
}
|
||||||
|
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
|
||||||
|
f.lock.Lock()
|
||||||
|
defer f.lock.Unlock()
|
||||||
|
|
||||||
|
if f.shuttingDown {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for informerType, informer := range f.informers {
|
||||||
|
if !f.startedInformers[informerType] {
|
||||||
|
f.wg.Add(1)
|
||||||
|
// We need a new variable in each loop iteration,
|
||||||
|
// otherwise the goroutine would use the loop variable
|
||||||
|
// and that keeps changing.
|
||||||
|
informer := informer
|
||||||
|
go func() {
|
||||||
|
defer f.wg.Done()
|
||||||
|
informer.Run(stopCh)
|
||||||
|
}()
|
||||||
|
f.startedInformers[informerType] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *sharedInformerFactory) Shutdown() {
|
||||||
|
f.lock.Lock()
|
||||||
|
f.shuttingDown = true
|
||||||
|
f.lock.Unlock()
|
||||||
|
|
||||||
|
// Will return immediately if there is nothing to wait for.
|
||||||
|
f.wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
|
||||||
|
informers := func() map[reflect.Type]cache.SharedIndexInformer {
|
||||||
|
f.lock.Lock()
|
||||||
|
defer f.lock.Unlock()
|
||||||
|
|
||||||
|
informers := map[reflect.Type]cache.SharedIndexInformer{}
|
||||||
|
for informerType, informer := range f.informers {
|
||||||
|
if f.startedInformers[informerType] {
|
||||||
|
informers[informerType] = informer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return informers
|
||||||
|
}()
|
||||||
|
|
||||||
|
res := map[reflect.Type]bool{}
|
||||||
|
for informType, informer := range informers {
|
||||||
|
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
// InformerFor returns the SharedIndexInformer for obj using an internal
|
||||||
|
// client.
|
||||||
|
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
|
||||||
|
f.lock.Lock()
|
||||||
|
defer f.lock.Unlock()
|
||||||
|
|
||||||
|
informerType := reflect.TypeOf(obj)
|
||||||
|
informer, exists := f.informers[informerType]
|
||||||
|
if exists {
|
||||||
|
return informer
|
||||||
|
}
|
||||||
|
|
||||||
|
resyncPeriod, exists := f.customResync[informerType]
|
||||||
|
if !exists {
|
||||||
|
resyncPeriod = f.defaultResync
|
||||||
|
}
|
||||||
|
|
||||||
|
informer = newFunc(f.client, resyncPeriod)
|
||||||
|
informer.SetTransform(f.transform)
|
||||||
|
f.informers[informerType] = informer
|
||||||
|
|
||||||
|
return informer
|
||||||
|
}
|
||||||
|
|
||||||
|
// SharedInformerFactory provides shared informers for resources in all known
|
||||||
|
// API group versions.
|
||||||
|
//
|
||||||
|
// It is typically used like this:
|
||||||
|
//
|
||||||
|
// ctx, cancel := context.Background()
|
||||||
|
// defer cancel()
|
||||||
|
// factory := NewSharedInformerFactory(client, resyncPeriod)
|
||||||
|
// defer factory.WaitForStop() // Returns immediately if nothing was started.
|
||||||
|
// genericInformer := factory.ForResource(resource)
|
||||||
|
// typedInformer := factory.SomeAPIGroup().V1().SomeType()
|
||||||
|
// factory.Start(ctx.Done()) // Start processing these informers.
|
||||||
|
// synced := factory.WaitForCacheSync(ctx.Done())
|
||||||
|
// for v, ok := range synced {
|
||||||
|
// if !ok {
|
||||||
|
// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Creating informers can also be created after Start, but then
|
||||||
|
// // Start must be called again:
|
||||||
|
// anotherGenericInformer := factory.ForResource(resource)
|
||||||
|
// factory.Start(ctx.Done())
|
||||||
|
type SharedInformerFactory interface {
|
||||||
|
internalinterfaces.SharedInformerFactory
|
||||||
|
|
||||||
|
// Start initializes all requested informers. They are handled in goroutines
|
||||||
|
// which run until the stop channel gets closed.
|
||||||
|
Start(stopCh <-chan struct{})
|
||||||
|
|
||||||
|
// Shutdown marks a factory as shutting down. At that point no new
|
||||||
|
// informers can be started anymore and Start will return without
|
||||||
|
// doing anything.
|
||||||
|
//
|
||||||
|
// In addition, Shutdown blocks until all goroutines have terminated. For that
|
||||||
|
// to happen, the close channel(s) that they were started with must be closed,
|
||||||
|
// either before Shutdown gets called or while it is waiting.
|
||||||
|
//
|
||||||
|
// Shutdown may be called multiple times, even concurrently. All such calls will
|
||||||
|
// block until all goroutines have terminated.
|
||||||
|
Shutdown()
|
||||||
|
|
||||||
|
// WaitForCacheSync blocks until all started informers' caches were synced
|
||||||
|
// or the stop channel gets closed.
|
||||||
|
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||||
|
|
||||||
|
// ForResource gives generic access to a shared informer of the matching type.
|
||||||
|
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||||
|
|
||||||
|
// InformerFor returns the SharedIndexInformer for obj using an internal
|
||||||
|
// client.
|
||||||
|
InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer
|
||||||
|
|
||||||
|
Example() api.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *sharedInformerFactory) Example() api.Interface {
|
||||||
|
return api.New(f, f.namespace, f.tweakListOptions)
|
||||||
|
}
|
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package externalversions
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
||||||
|
// sharedInformers based on type
|
||||||
|
type GenericInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() cache.GenericLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type genericInformer struct {
|
||||||
|
informer cache.SharedIndexInformer
|
||||||
|
resource schema.GroupResource
|
||||||
|
}
|
||||||
|
|
||||||
|
// Informer returns the SharedIndexInformer.
|
||||||
|
func (f *genericInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.informer
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lister returns the GenericLister.
|
||||||
|
func (f *genericInformer) Lister() cache.GenericLister {
|
||||||
|
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForResource gives generic access to a shared informer of the matching type
|
||||||
|
// TODO extend this to unknown resources with a client pool
|
||||||
|
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||||
|
switch resource {
|
||||||
|
// Group=example.crd.code-generator.k8s.io, Version=v1
|
||||||
|
case v1.SchemeGroupVersion.WithResource("clustertesttypes"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().ClusterTestTypes().Informer()}, nil
|
||||||
|
case v1.SchemeGroupVersion.WithResource("testtypes"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package internalinterfaces
|
||||||
|
|
||||||
|
import (
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
versioned "k8s.io/code-generator/examples/single/clientset/versioned"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
|
||||||
|
type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
|
||||||
|
|
||||||
|
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
|
||||||
|
type SharedInformerFactory interface {
|
||||||
|
Start(stopCh <-chan struct{})
|
||||||
|
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
|
||||||
|
type TweakListOptionsFunc func(*v1.ListOptions)
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/listers"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
v1 "k8s.io/code-generator/examples/single/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterTestTypeLister helps list ClusterTestTypes.
|
||||||
|
// All objects returned here must be treated as read-only.
|
||||||
|
type ClusterTestTypeLister interface {
|
||||||
|
// List lists all ClusterTestTypes in the indexer.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
List(selector labels.Selector) (ret []*v1.ClusterTestType, err error)
|
||||||
|
// Get retrieves the ClusterTestType from the index for a given name.
|
||||||
|
// Objects returned here must be treated as read-only.
|
||||||
|
Get(name string) (*v1.ClusterTestType, error)
|
||||||
|
ClusterTestTypeListerExpansion
|
||||||
|
}
|
||||||
|
|
||||||
|
// clusterTestTypeLister implements the ClusterTestTypeLister interface.
|
||||||
|
type clusterTestTypeLister struct {
|
||||||
|
listers.ResourceIndexer[*v1.ClusterTestType]
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClusterTestTypeLister returns a new ClusterTestTypeLister.
|
||||||
|
func NewClusterTestTypeLister(indexer cache.Indexer) ClusterTestTypeLister {
|
||||||
|
return &clusterTestTypeLister{listers.New[*v1.ClusterTestType](indexer, v1.Resource("clustertesttype"))}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by lister-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
// ClusterTestTypeListerExpansion allows custom methods to be added to
|
||||||
|
// ClusterTestTypeLister.
|
||||||
|
type ClusterTestTypeListerExpansion interface{}
|
||||||
|
|
||||||
|
// TestTypeListerExpansion allows custom methods to be added to
|
||||||
|
// TestTypeLister.
|
||||||
|
type TestTypeListerExpansion interface{}
|
||||||
|
|
||||||
|
// TestTypeNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// TestTypeNamespaceLister.
|
||||||
|
type TestTypeNamespaceListerExpansion interface{}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user