mirror of https://github.com/knative/pkg.git
WIP Define a package with which to support duck typed definitions. (#71)
This also sketches out the skeletons for Targettable, Subscribable, and Conditions.
This commit is contained in:
parent
f0ec8c5ac7
commit
9a13caa7a1
|
|
@ -96,14 +96,6 @@
|
|||
pruneopts = "NUT"
|
||||
revision = "9cad4c3443a7200dd6400aef47183728de563a38"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:36968d4eb1d52090841ae868d7125d8ff10afabdea0d6b622c1f4a662f94be58"
|
||||
name = "github.com/knative/test-infra"
|
||||
packages = ["."]
|
||||
pruneopts = "T"
|
||||
revision = "51872094d69a5b0266fd92a38978819e20ee70c8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:475b179287e8afdcd352014b2c2500e67decdf63e66125e2129286873453e1cd"
|
||||
name = "github.com/hashicorp/golang-lru"
|
||||
|
|
@ -129,6 +121,14 @@
|
|||
pruneopts = "NUT"
|
||||
revision = "f2b4162afba35581b6d4a50d3b8f34e33c144682"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:849fc53918b4658b896a43881305d60afc0d6a51d87c0d5b065afd631415f1d4"
|
||||
name = "github.com/knative/test-infra"
|
||||
packages = ["."]
|
||||
pruneopts = "T"
|
||||
revision = "51872094d69a5b0266fd92a38978819e20ee70c8"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:0e9bfc47ab9941ecc3344e580baca5deb4091177e84dd9773b48b38ec26b93d5"
|
||||
|
|
@ -638,6 +638,7 @@
|
|||
"github.com/golang/glog",
|
||||
"github.com/google/go-cmp/cmp",
|
||||
"github.com/google/go-cmp/cmp/cmpopts",
|
||||
"github.com/knative/test-infra",
|
||||
"github.com/mattbaird/jsonpatch",
|
||||
"go.opencensus.io/stats/view",
|
||||
"go.opencensus.io/trace",
|
||||
|
|
@ -656,6 +657,7 @@
|
|||
"k8s.io/apimachinery/pkg/runtime",
|
||||
"k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"k8s.io/apimachinery/pkg/selection",
|
||||
"k8s.io/apimachinery/pkg/types",
|
||||
"k8s.io/apimachinery/pkg/util/runtime",
|
||||
"k8s.io/apimachinery/pkg/util/sets/types",
|
||||
|
|
@ -669,7 +671,6 @@
|
|||
"k8s.io/client-go/kubernetes/fake",
|
||||
"k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1",
|
||||
"k8s.io/client-go/kubernetes/typed/core/v1",
|
||||
"k8s.io/client-go/kubernetes/typed/extensions/v1beta1",
|
||||
"k8s.io/client-go/rest",
|
||||
"k8s.io/client-go/testing",
|
||||
"k8s.io/client-go/tools/cache",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
# The OWNERS file is used by prow to automatically merge approved PRs.
|
||||
|
||||
approvers:
|
||||
- mattmoor
|
||||
- vaikas-google
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 duck defines logic for defining and consuming "duck typed"
|
||||
// Kubernetes resources. Producers define partial resource definitions
|
||||
// that resource authors may choose to implement to interoperate with
|
||||
// consumers of these "duck typed" interfaces.
|
||||
// For more information see:
|
||||
// TODO(mattmoor): Add link to doc.
|
||||
package duck
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 duck
|
||||
|
||||
const (
|
||||
GroupName = "duck.knative.dev"
|
||||
)
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/knative/pkg/apis/duck"
|
||||
)
|
||||
|
||||
// Conditions is the schema for the conditions portion of the payload
|
||||
type Conditions []Condition
|
||||
|
||||
type Condition struct {
|
||||
// TODO(n3wscott): Give me a schema!
|
||||
Field string `json:"field,omitempty"`
|
||||
}
|
||||
|
||||
// Implementations can verify that they implement Conditions via:
|
||||
var _ = duck.VerifyType(&KResource{}, &Conditions{})
|
||||
|
||||
// Conditions is an Implementable "duck type".
|
||||
var _ duck.Implementable = (*Conditions)(nil)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// KResource is a skeleton type wrapping Conditions in the manner we expect
|
||||
// resource writers defining compatible resources to embed it. We will
|
||||
// typically use this type to deserialize Conditions ObjectReferences and
|
||||
// access the Conditions data. This is not a real resource.
|
||||
type KResource struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Status KResourceStatus `json:"status"`
|
||||
}
|
||||
|
||||
// KResourceStatus shows how we expect folks to embed Conditions in
|
||||
// their Status field.
|
||||
type KResourceStatus struct {
|
||||
Conditions Conditions `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// In order for Conditions to be Implementable, KResource must be Populatable.
|
||||
var _ duck.Populatable = (*KResource)(nil)
|
||||
|
||||
// GetFullType implements duck.Implementable
|
||||
func (_ *Conditions) GetFullType() duck.Populatable {
|
||||
return &KResource{}
|
||||
}
|
||||
|
||||
// Populate implements duck.Populatable
|
||||
func (t *KResource) Populate() {
|
||||
t.Status.Conditions = Conditions{{
|
||||
// Populate ALL fields
|
||||
Field: "this is not empty",
|
||||
}}
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// KResourceList is a list of KResource resources
|
||||
type KResourceList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []KResource `json:"items"`
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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.
|
||||
*/
|
||||
|
||||
// Api versions allow the api contract for a resource to be changed while keeping
|
||||
// backward compatibility by support multiple concurrent versions
|
||||
// of the same resource
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName=duck.knative.dev
|
||||
package v1alpha1
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Copyright 2017 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNothing(t *testing.T) {
|
||||
// Just by running this ensures that the type assertions
|
||||
// in this package are evaluated.
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
"github.com/knative/pkg/apis/duck"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: duck.GroupName, Version: "v1alpha1"}
|
||||
|
||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(
|
||||
SchemeGroupVersion,
|
||||
// &VirtualService{},
|
||||
// &VirtualServiceList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/knative/pkg/apis/duck"
|
||||
)
|
||||
|
||||
// Subscribable is the schema for the subscribable portion of the payload
|
||||
type Subscribable struct {
|
||||
// TODO(vaikas): Give me a schema!
|
||||
Field string `json:"field,omitempty"`
|
||||
}
|
||||
|
||||
// Implementations can verify that they implement Subscribable via:
|
||||
var _ = duck.VerifyType(&Topic{}, &Subscribable{})
|
||||
|
||||
// Subscribable is an Implementable "duck type".
|
||||
var _ duck.Implementable = (*Subscribable)(nil)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Topic is a skeleton type wrapping Subscribable in the manner we expect
|
||||
// resource writers defining compatible resources to embed it. We will
|
||||
// typically use this type to deserialize Subscribable ObjectReferences and
|
||||
// access the Subscribable data. This is not a real resource.
|
||||
type Topic struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Status TopicStatus `json:"status"`
|
||||
}
|
||||
|
||||
// TopicStatus shows how we expect folks to embed Subscribable in
|
||||
// their Status field.
|
||||
type TopicStatus struct {
|
||||
Subscribable *Subscribable `json:"subscribable,omitempty"`
|
||||
}
|
||||
|
||||
// In order for Subscribable to be Implementable, Topic must be Populatable.
|
||||
var _ duck.Populatable = (*Topic)(nil)
|
||||
|
||||
// GetFullType implements duck.Implementable
|
||||
func (_ *Subscribable) GetFullType() duck.Populatable {
|
||||
return &Topic{}
|
||||
}
|
||||
|
||||
// Populate implements duck.Populatable
|
||||
func (t *Topic) Populate() {
|
||||
t.Status.Subscribable = &Subscribable{
|
||||
// Populate ALL fields
|
||||
Field: "this is not empty",
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// TopicList is a list of Topic resources
|
||||
type TopicList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Topic `json:"items"`
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/knative/pkg/apis/duck"
|
||||
)
|
||||
|
||||
// Targettable is the schema for the targettable portion of the payload
|
||||
type Targettable struct {
|
||||
// TODO(vaikas): Give me a schema!
|
||||
Field string `json:"field,omitempty"`
|
||||
}
|
||||
|
||||
// Implementations can verify that they implement Targettable via:
|
||||
var _ = duck.VerifyType(&Target{}, &Targettable{})
|
||||
|
||||
// Targettable is an Implementable "duck type".
|
||||
var _ duck.Implementable = (*Targettable)(nil)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Target is a skeleton type wrapping Targettable in the manner we expect
|
||||
// resource writers defining compatible resources to embed it. We will
|
||||
// typically use this type to deserialize Targettable ObjectReferences and
|
||||
// access the Targettable data. This is not a real resource.
|
||||
type Target struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Status TargetStatus `json:"status"`
|
||||
}
|
||||
|
||||
// TargetStatus shows how we expect folks to embed Targettable in
|
||||
// their Status field.
|
||||
type TargetStatus struct {
|
||||
Targettable *Targettable `json:"targettable,omitempty"`
|
||||
}
|
||||
|
||||
// In order for Targettable to be Implementable, Target must be Populatable.
|
||||
var _ duck.Populatable = (*Target)(nil)
|
||||
|
||||
// GetFullType implements duck.Implementable
|
||||
func (_ *Targettable) GetFullType() duck.Populatable {
|
||||
return &Target{}
|
||||
}
|
||||
|
||||
// Populate implements duck.Populatable
|
||||
func (t *Target) Populate() {
|
||||
t.Status.Targettable = &Targettable{
|
||||
// Populate ALL fields
|
||||
Field: "this is not empty",
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// TargetList is a list of Target resources
|
||||
type TargetList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Target `json:"items"`
|
||||
}
|
||||
|
|
@ -0,0 +1,336 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
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 *Condition) DeepCopyInto(out *Condition) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
|
||||
func (in *Condition) DeepCopy() *Condition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Condition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in Conditions) DeepCopyInto(out *Conditions) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(Conditions, len(*in))
|
||||
copy(*out, *in)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditions.
|
||||
func (in Conditions) DeepCopy() Conditions {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Conditions)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KResource) DeepCopyInto(out *KResource) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResource.
|
||||
func (in *KResource) DeepCopy() *KResource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KResource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *KResource) 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 *KResourceList) DeepCopyInto(out *KResourceList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]KResource, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResourceList.
|
||||
func (in *KResourceList) DeepCopy() *KResourceList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KResourceList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *KResourceList) 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 *KResourceStatus) DeepCopyInto(out *KResourceStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make(Conditions, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResourceStatus.
|
||||
func (in *KResourceStatus) DeepCopy() *KResourceStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KResourceStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Subscribable) DeepCopyInto(out *Subscribable) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscribable.
|
||||
func (in *Subscribable) DeepCopy() *Subscribable {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Subscribable)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Target) DeepCopyInto(out *Target) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Target.
|
||||
func (in *Target) DeepCopy() *Target {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Target)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Target) 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 *TargetList) DeepCopyInto(out *TargetList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Target, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetList.
|
||||
func (in *TargetList) DeepCopy() *TargetList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TargetList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TargetList) 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 *TargetStatus) DeepCopyInto(out *TargetStatus) {
|
||||
*out = *in
|
||||
if in.Targettable != nil {
|
||||
in, out := &in.Targettable, &out.Targettable
|
||||
*out = new(Targettable)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetStatus.
|
||||
func (in *TargetStatus) DeepCopy() *TargetStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TargetStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Targettable) DeepCopyInto(out *Targettable) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Targettable.
|
||||
func (in *Targettable) DeepCopy() *Targettable {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Targettable)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Topic) DeepCopyInto(out *Topic) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topic.
|
||||
func (in *Topic) DeepCopy() *Topic {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Topic)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Topic) 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 *TopicList) DeepCopyInto(out *TopicList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Topic, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopicList.
|
||||
func (in *TopicList) DeepCopy() *TopicList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TopicList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TopicList) 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 *TopicStatus) DeepCopyInto(out *TopicStatus) {
|
||||
*out = *in
|
||||
if in.Subscribable != nil {
|
||||
in, out := &in.Subscribable, &out.Subscribable
|
||||
*out = new(Subscribable)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopicStatus.
|
||||
func (in *TopicStatus) DeepCopy() *TopicStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TopicStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 duck
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
// Implementable in implemented by the Fooable duck type that consumers
|
||||
// are expected to embed as a `.status.fooable` field.
|
||||
type Implementable interface {
|
||||
// GetFullType returns an instance of a full resource wrapping
|
||||
// an instance of this Implementable that can populate its fields
|
||||
// to verify json roundtripping.
|
||||
GetFullType() Populatable
|
||||
}
|
||||
|
||||
// Populatable is implemented by a skeleton resource wrapping an Implementable
|
||||
// duck type. It will generally have TypeMeta, ObjectMeta, and a Status field
|
||||
// wrapping a Fooable field.
|
||||
type Populatable interface {
|
||||
// Populate fills in all possible fields, so that we can verify that
|
||||
// they roundtrip properly through JSON.
|
||||
Populate()
|
||||
}
|
||||
|
||||
// VerifyType verifies that a particular concrete resource properly implements
|
||||
// the provided Implementable duck type. It is expected that under the resource
|
||||
// definition implementing a particular "Fooable" that one would write:
|
||||
//
|
||||
// type ConcreteResource struct { ... }
|
||||
//
|
||||
// // Check that ConcreteResource properly implement Fooable.
|
||||
// var _ = duck.VerifyType(&ConcreteResource{}, &something.Fooable{})
|
||||
//
|
||||
// This will panic on startup if the duck typing is not satisfied. The return
|
||||
// value is purely cosmetic to enable the `var _ = ...` shorthand.
|
||||
func VerifyType(instance interface{}, iface Implementable) (nothing interface{}) {
|
||||
// Create instances of the full resource for our input and ultimate result
|
||||
// that we will compare at the end.
|
||||
input, output := iface.GetFullType(), iface.GetFullType()
|
||||
|
||||
// Populate our input resource with values we will roundtrip.
|
||||
input.Populate()
|
||||
|
||||
// Serialize the input to JSON and deserialize that into the provided instance
|
||||
// of the type that we are checking.
|
||||
if before, err := json.Marshal(input); err != nil {
|
||||
panic(fmt.Sprintf("Error serializing duck type %T", input))
|
||||
} else if err := json.Unmarshal(before, instance); err != nil {
|
||||
panic(fmt.Sprintf("Error deserializing duck type %T into %T", input, instance))
|
||||
}
|
||||
|
||||
// Serialize the instance we are checking to JSON and deserialize that into the
|
||||
// output resource.
|
||||
if after, err := json.Marshal(instance); err != nil {
|
||||
panic(fmt.Sprintf("Error serializing %T", instance))
|
||||
} else if err := json.Unmarshal(after, output); err != nil {
|
||||
panic(fmt.Sprintf("Error deserializing %T into dock type %T", instance, output))
|
||||
}
|
||||
|
||||
// Now verify that we were able to roundtrip all of our fields through the type
|
||||
// we are checking.
|
||||
if diff := cmp.Diff(input, output); diff != "" {
|
||||
panic(fmt.Sprintf("%T does not implement the duck type %T, the following fields were lost: %s",
|
||||
instance, iface, diff))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
/*
|
||||
Copyright 2017 The Knative 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 duck
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMatches(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
instance interface{}
|
||||
iface Implementable
|
||||
}{{
|
||||
name: "foo matches fooable",
|
||||
instance: &Foo{},
|
||||
iface: &Fooable{},
|
||||
}, {
|
||||
name: "bar matches barable",
|
||||
instance: &Bar{},
|
||||
iface: &Barable{},
|
||||
}, {
|
||||
name: "slice matches sliceable",
|
||||
instance: &Slice{},
|
||||
iface: &Sliceable{},
|
||||
}, {
|
||||
name: "string matches stringable",
|
||||
instance: &String{},
|
||||
iface: &emptyStringable,
|
||||
}, {
|
||||
name: "other matches foo",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Fooable{},
|
||||
}, {
|
||||
name: "other (all) matches fooable",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
Barable *Barable `json:"barable,omitempty"`
|
||||
Sliceable Sliceable `json:"sliceable,omitempty"`
|
||||
Stringable *Stringable `json:"stringable,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Fooable{},
|
||||
}, {
|
||||
name: "other (all) matches barable",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
Barable *Barable `json:"barable,omitempty"`
|
||||
Sliceable Sliceable `json:"sliceable,omitempty"`
|
||||
Stringable *Stringable `json:"stringable,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Barable{},
|
||||
}, {
|
||||
name: "other (all) matches sliceable",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
Barable *Barable `json:"barable,omitempty"`
|
||||
Sliceable Sliceable `json:"sliceable,omitempty"`
|
||||
Stringable *Stringable `json:"stringable,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Sliceable{},
|
||||
}, {
|
||||
name: "other (all) matches stringable",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
Barable *Barable `json:"barable,omitempty"`
|
||||
Sliceable Sliceable `json:"sliceable,omitempty"`
|
||||
Stringable *Stringable `json:"stringable,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &emptyStringable,
|
||||
}}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
// If we panic, turn it into a test failure
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("panic: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
VerifyType(test.instance, test.iface)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMismatches(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
instance interface{}
|
||||
iface Implementable
|
||||
}{{
|
||||
name: "foo doesn't match barable",
|
||||
instance: &Foo{},
|
||||
iface: &Barable{},
|
||||
}, {
|
||||
name: "bar doesn't match fooable",
|
||||
instance: &Bar{},
|
||||
iface: &Fooable{},
|
||||
}, {
|
||||
name: "foo doesn't match sliceable",
|
||||
instance: &Foo{},
|
||||
iface: &Sliceable{},
|
||||
}, {
|
||||
name: "other matches neither (foo)",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Done bool `json:"done,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Fooable{},
|
||||
}, {
|
||||
name: "other matches neither (slice)",
|
||||
instance: &struct {
|
||||
Status struct {
|
||||
Done bool `json:"done,omitempty"`
|
||||
} `json:"status,omitempty"`
|
||||
}{},
|
||||
iface: &Sliceable{},
|
||||
}}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
// Catch panics, they are the failure mode we expect.
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
return
|
||||
}
|
||||
t.Errorf("Unexpected success %T implements %T", test.instance, test.iface)
|
||||
}()
|
||||
|
||||
VerifyType(test.instance, test.iface)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Define a "Fooable" duck type.
|
||||
type Fooable struct {
|
||||
Field1 string `json:"field1,omitempty"`
|
||||
Field2 string `json:"field2,omitempty"`
|
||||
}
|
||||
type Foo struct {
|
||||
Status FooStatus `json:"status"`
|
||||
}
|
||||
type FooStatus struct {
|
||||
Fooable *Fooable `json:"fooable,omitempty"`
|
||||
}
|
||||
|
||||
var _ Implementable = (*Fooable)(nil)
|
||||
var _ Populatable = (*Foo)(nil)
|
||||
|
||||
func (_ *Fooable) GetFullType() Populatable {
|
||||
return &Foo{}
|
||||
}
|
||||
|
||||
func (f *Foo) Populate() {
|
||||
f.Status.Fooable = &Fooable{
|
||||
// Populate ALL fields
|
||||
Field1: "foo",
|
||||
Field2: "bar",
|
||||
}
|
||||
}
|
||||
|
||||
// Define a "Barable" duck type.
|
||||
type Barable struct {
|
||||
Field1 int `json:"field1,omitempty"`
|
||||
Field2 bool `json:"field2,omitempty"`
|
||||
}
|
||||
type Bar struct {
|
||||
Status BarStatus `json:"status"`
|
||||
}
|
||||
type BarStatus struct {
|
||||
Barable *Barable `json:"barable,omitempty"`
|
||||
}
|
||||
|
||||
var _ Implementable = (*Barable)(nil)
|
||||
var _ Populatable = (*Bar)(nil)
|
||||
|
||||
func (_ *Barable) GetFullType() Populatable {
|
||||
return &Bar{}
|
||||
}
|
||||
|
||||
func (f *Bar) Populate() {
|
||||
f.Status.Barable = &Barable{
|
||||
// Populate ALL fields
|
||||
Field1: 42,
|
||||
Field2: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Define a "Sliceable" duck type.
|
||||
type AStruct struct {
|
||||
Field string `json:"field,omitempty"`
|
||||
}
|
||||
type Sliceable []AStruct
|
||||
type Slice struct {
|
||||
Status SliceStatus `json:"status"`
|
||||
}
|
||||
type SliceStatus struct {
|
||||
Sliceable *Sliceable `json:"sliceable,omitempty"`
|
||||
}
|
||||
|
||||
var _ Implementable = (*Sliceable)(nil)
|
||||
var _ Populatable = (*Slice)(nil)
|
||||
|
||||
func (_ *Sliceable) GetFullType() Populatable {
|
||||
return &Slice{}
|
||||
}
|
||||
|
||||
func (f *Slice) Populate() {
|
||||
f.Status.Sliceable = &Sliceable{{"foo"}, {"bar"}}
|
||||
}
|
||||
|
||||
// Define a "Stringable" duck type.
|
||||
type Stringable string
|
||||
type String struct {
|
||||
Status StringStatus `json:"status"`
|
||||
}
|
||||
type StringStatus struct {
|
||||
Stringable Stringable `json:"stringable,omitempty"`
|
||||
}
|
||||
|
||||
var _ Implementable = (*Stringable)(nil)
|
||||
var _ Populatable = (*String)(nil)
|
||||
|
||||
func (_ *Stringable) GetFullType() Populatable {
|
||||
return &String{}
|
||||
}
|
||||
|
||||
func (f *String) Populate() {
|
||||
f.Status.Stringable = Stringable("hello duck")
|
||||
}
|
||||
|
||||
// We have to do this for Stringable because we're aliasing a value type.
|
||||
var emptyStringable Stringable
|
||||
|
|
@ -20,6 +20,7 @@ package versioned
|
|||
|
||||
import (
|
||||
authenticationv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/authentication/v1alpha1"
|
||||
duckv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/duck/v1alpha1"
|
||||
networkingv1alpha3 "github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
|
|
@ -31,6 +32,9 @@ type Interface interface {
|
|||
AuthenticationV1alpha1() authenticationv1alpha1.AuthenticationV1alpha1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Authentication() authenticationv1alpha1.AuthenticationV1alpha1Interface
|
||||
DuckV1alpha1() duckv1alpha1.DuckV1alpha1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Duck() duckv1alpha1.DuckV1alpha1Interface
|
||||
NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Networking() networkingv1alpha3.NetworkingV1alpha3Interface
|
||||
|
|
@ -41,6 +45,7 @@ type Interface interface {
|
|||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
authenticationV1alpha1 *authenticationv1alpha1.AuthenticationV1alpha1Client
|
||||
duckV1alpha1 *duckv1alpha1.DuckV1alpha1Client
|
||||
networkingV1alpha3 *networkingv1alpha3.NetworkingV1alpha3Client
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +60,17 @@ func (c *Clientset) Authentication() authenticationv1alpha1.AuthenticationV1alph
|
|||
return c.authenticationV1alpha1
|
||||
}
|
||||
|
||||
// DuckV1alpha1 retrieves the DuckV1alpha1Client
|
||||
func (c *Clientset) DuckV1alpha1() duckv1alpha1.DuckV1alpha1Interface {
|
||||
return c.duckV1alpha1
|
||||
}
|
||||
|
||||
// Deprecated: Duck retrieves the default version of DuckClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Duck() duckv1alpha1.DuckV1alpha1Interface {
|
||||
return c.duckV1alpha1
|
||||
}
|
||||
|
||||
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
|
||||
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
|
||||
return c.networkingV1alpha3
|
||||
|
|
@ -86,6 +102,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.duckV1alpha1, err = duckv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.networkingV1alpha3, err = networkingv1alpha3.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -103,6 +123,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.authenticationV1alpha1 = authenticationv1alpha1.NewForConfigOrDie(c)
|
||||
cs.duckV1alpha1 = duckv1alpha1.NewForConfigOrDie(c)
|
||||
cs.networkingV1alpha3 = networkingv1alpha3.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
|
|
@ -113,6 +134,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.authenticationV1alpha1 = authenticationv1alpha1.New(c)
|
||||
cs.duckV1alpha1 = duckv1alpha1.New(c)
|
||||
cs.networkingV1alpha3 = networkingv1alpha3.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import (
|
|||
clientset "github.com/knative/pkg/client/clientset/versioned"
|
||||
authenticationv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/authentication/v1alpha1"
|
||||
fakeauthenticationv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/authentication/v1alpha1/fake"
|
||||
duckv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/duck/v1alpha1"
|
||||
fakeduckv1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/duck/v1alpha1/fake"
|
||||
networkingv1alpha3 "github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3"
|
||||
fakenetworkingv1alpha3 "github.com/knative/pkg/client/clientset/versioned/typed/istio/v1alpha3/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
|
@ -83,6 +85,16 @@ func (c *Clientset) Authentication() authenticationv1alpha1.AuthenticationV1alph
|
|||
return &fakeauthenticationv1alpha1.FakeAuthenticationV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// DuckV1alpha1 retrieves the DuckV1alpha1Client
|
||||
func (c *Clientset) DuckV1alpha1() duckv1alpha1.DuckV1alpha1Interface {
|
||||
return &fakeduckv1alpha1.FakeDuckV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Duck retrieves the DuckV1alpha1Client
|
||||
func (c *Clientset) Duck() duckv1alpha1.DuckV1alpha1Interface {
|
||||
return &fakeduckv1alpha1.FakeDuckV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// NetworkingV1alpha3 retrieves the NetworkingV1alpha3Client
|
||||
func (c *Clientset) NetworkingV1alpha3() networkingv1alpha3.NetworkingV1alpha3Interface {
|
||||
return &fakenetworkingv1alpha3.FakeNetworkingV1alpha3{Fake: &c.Fake}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ limitations under the License.
|
|||
package fake
|
||||
|
||||
import (
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
authenticationv1alpha1 "github.com/knative/pkg/apis/istio/authentication/v1alpha1"
|
||||
networkingv1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -52,5 +53,6 @@ func init() {
|
|||
// correctly.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
authenticationv1alpha1.AddToScheme(scheme)
|
||||
duckv1alpha1.AddToScheme(scheme)
|
||||
networkingv1alpha3.AddToScheme(scheme)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ limitations under the License.
|
|||
package scheme
|
||||
|
||||
import (
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
authenticationv1alpha1 "github.com/knative/pkg/apis/istio/authentication/v1alpha1"
|
||||
networkingv1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -52,5 +53,6 @@ func init() {
|
|||
// correctly.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
authenticationv1alpha1.AddToScheme(scheme)
|
||||
duckv1alpha1.AddToScheme(scheme)
|
||||
networkingv1alpha3.AddToScheme(scheme)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
"github.com/knative/pkg/client/clientset/versioned/scheme"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type DuckV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
KResourcesGetter
|
||||
TargetsGetter
|
||||
TopicsGetter
|
||||
}
|
||||
|
||||
// DuckV1alpha1Client is used to interact with features provided by the duck.knative.dev group.
|
||||
type DuckV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *DuckV1alpha1Client) KResources(namespace string) KResourceInterface {
|
||||
return newKResources(c, namespace)
|
||||
}
|
||||
|
||||
func (c *DuckV1alpha1Client) Targets(namespace string) TargetInterface {
|
||||
return newTargets(c, namespace)
|
||||
}
|
||||
|
||||
func (c *DuckV1alpha1Client) Topics(namespace string) TopicInterface {
|
||||
return newTopics(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new DuckV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*DuckV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &DuckV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new DuckV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *DuckV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new DuckV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *DuckV1alpha1Client {
|
||||
return &DuckV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
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 *DuckV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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,48 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 (
|
||||
v1alpha1 "github.com/knative/pkg/client/clientset/versioned/typed/duck/v1alpha1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeDuckV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeDuckV1alpha1) KResources(namespace string) v1alpha1.KResourceInterface {
|
||||
return &FakeKResources{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeDuckV1alpha1) Targets(namespace string) v1alpha1.TargetInterface {
|
||||
return &FakeTargets{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeDuckV1alpha1) Topics(namespace string) v1alpha1.TopicInterface {
|
||||
return &FakeTopics{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeDuckV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeKResources implements KResourceInterface
|
||||
type FakeKResources struct {
|
||||
Fake *FakeDuckV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var kresourcesResource = schema.GroupVersionResource{Group: "duck.knative.dev", Version: "v1alpha1", Resource: "kresources"}
|
||||
|
||||
var kresourcesKind = schema.GroupVersionKind{Group: "duck.knative.dev", Version: "v1alpha1", Kind: "KResource"}
|
||||
|
||||
// Get takes name of the kResource, and returns the corresponding kResource object, and an error if there is any.
|
||||
func (c *FakeKResources) Get(name string, options v1.GetOptions) (result *v1alpha1.KResource, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(kresourcesResource, c.ns, name), &v1alpha1.KResource{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of KResources that match those selectors.
|
||||
func (c *FakeKResources) List(opts v1.ListOptions) (result *v1alpha1.KResourceList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(kresourcesResource, kresourcesKind, c.ns, opts), &v1alpha1.KResourceList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.KResourceList{ListMeta: obj.(*v1alpha1.KResourceList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.KResourceList).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 kResources.
|
||||
func (c *FakeKResources) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(kresourcesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a kResource and creates it. Returns the server's representation of the kResource, and an error, if there is any.
|
||||
func (c *FakeKResources) Create(kResource *v1alpha1.KResource) (result *v1alpha1.KResource, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(kresourcesResource, c.ns, kResource), &v1alpha1.KResource{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a kResource and updates it. Returns the server's representation of the kResource, and an error, if there is any.
|
||||
func (c *FakeKResources) Update(kResource *v1alpha1.KResource) (result *v1alpha1.KResource, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(kresourcesResource, c.ns, kResource), &v1alpha1.KResource{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), 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 *FakeKResources) UpdateStatus(kResource *v1alpha1.KResource) (*v1alpha1.KResource, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(kresourcesResource, "status", c.ns, kResource), &v1alpha1.KResource{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), err
|
||||
}
|
||||
|
||||
// Delete takes name of the kResource and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeKResources) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(kresourcesResource, c.ns, name), &v1alpha1.KResource{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeKResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(kresourcesResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.KResourceList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched kResource.
|
||||
func (c *FakeKResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.KResource, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(kresourcesResource, c.ns, name, data, subresources...), &v1alpha1.KResource{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), err
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeTargets implements TargetInterface
|
||||
type FakeTargets struct {
|
||||
Fake *FakeDuckV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var targetsResource = schema.GroupVersionResource{Group: "duck.knative.dev", Version: "v1alpha1", Resource: "targets"}
|
||||
|
||||
var targetsKind = schema.GroupVersionKind{Group: "duck.knative.dev", Version: "v1alpha1", Kind: "Target"}
|
||||
|
||||
// Get takes name of the target, and returns the corresponding target object, and an error if there is any.
|
||||
func (c *FakeTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.Target, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(targetsResource, c.ns, name), &v1alpha1.Target{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Target), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Targets that match those selectors.
|
||||
func (c *FakeTargets) List(opts v1.ListOptions) (result *v1alpha1.TargetList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(targetsResource, targetsKind, c.ns, opts), &v1alpha1.TargetList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.TargetList{ListMeta: obj.(*v1alpha1.TargetList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.TargetList).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 targets.
|
||||
func (c *FakeTargets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(targetsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a target and creates it. Returns the server's representation of the target, and an error, if there is any.
|
||||
func (c *FakeTargets) Create(target *v1alpha1.Target) (result *v1alpha1.Target, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(targetsResource, c.ns, target), &v1alpha1.Target{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Target), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a target and updates it. Returns the server's representation of the target, and an error, if there is any.
|
||||
func (c *FakeTargets) Update(target *v1alpha1.Target) (result *v1alpha1.Target, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(targetsResource, c.ns, target), &v1alpha1.Target{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Target), 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 *FakeTargets) UpdateStatus(target *v1alpha1.Target) (*v1alpha1.Target, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(targetsResource, "status", c.ns, target), &v1alpha1.Target{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Target), err
|
||||
}
|
||||
|
||||
// Delete takes name of the target and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeTargets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(targetsResource, c.ns, name), &v1alpha1.Target{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeTargets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(targetsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.TargetList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched target.
|
||||
func (c *FakeTargets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Target, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(targetsResource, c.ns, name, data, subresources...), &v1alpha1.Target{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Target), err
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeTopics implements TopicInterface
|
||||
type FakeTopics struct {
|
||||
Fake *FakeDuckV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var topicsResource = schema.GroupVersionResource{Group: "duck.knative.dev", Version: "v1alpha1", Resource: "topics"}
|
||||
|
||||
var topicsKind = schema.GroupVersionKind{Group: "duck.knative.dev", Version: "v1alpha1", Kind: "Topic"}
|
||||
|
||||
// Get takes name of the topic, and returns the corresponding topic object, and an error if there is any.
|
||||
func (c *FakeTopics) Get(name string, options v1.GetOptions) (result *v1alpha1.Topic, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(topicsResource, c.ns, name), &v1alpha1.Topic{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Topics that match those selectors.
|
||||
func (c *FakeTopics) List(opts v1.ListOptions) (result *v1alpha1.TopicList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(topicsResource, topicsKind, c.ns, opts), &v1alpha1.TopicList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.TopicList{ListMeta: obj.(*v1alpha1.TopicList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.TopicList).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 topics.
|
||||
func (c *FakeTopics) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(topicsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a topic and creates it. Returns the server's representation of the topic, and an error, if there is any.
|
||||
func (c *FakeTopics) Create(topic *v1alpha1.Topic) (result *v1alpha1.Topic, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(topicsResource, c.ns, topic), &v1alpha1.Topic{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a topic and updates it. Returns the server's representation of the topic, and an error, if there is any.
|
||||
func (c *FakeTopics) Update(topic *v1alpha1.Topic) (result *v1alpha1.Topic, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(topicsResource, c.ns, topic), &v1alpha1.Topic{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), 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 *FakeTopics) UpdateStatus(topic *v1alpha1.Topic) (*v1alpha1.Topic, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(topicsResource, "status", c.ns, topic), &v1alpha1.Topic{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), err
|
||||
}
|
||||
|
||||
// Delete takes name of the topic and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeTopics) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(topicsResource, c.ns, name), &v1alpha1.Topic{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeTopics) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(topicsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.TopicList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched topic.
|
||||
func (c *FakeTopics) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Topic, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(topicsResource, c.ns, name, data, subresources...), &v1alpha1.Topic{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), err
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
type KResourceExpansion interface{}
|
||||
|
||||
type TargetExpansion interface{}
|
||||
|
||||
type TopicExpansion interface{}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
scheme "github.com/knative/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// KResourcesGetter has a method to return a KResourceInterface.
|
||||
// A group's client should implement this interface.
|
||||
type KResourcesGetter interface {
|
||||
KResources(namespace string) KResourceInterface
|
||||
}
|
||||
|
||||
// KResourceInterface has methods to work with KResource resources.
|
||||
type KResourceInterface interface {
|
||||
Create(*v1alpha1.KResource) (*v1alpha1.KResource, error)
|
||||
Update(*v1alpha1.KResource) (*v1alpha1.KResource, error)
|
||||
UpdateStatus(*v1alpha1.KResource) (*v1alpha1.KResource, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.KResource, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.KResourceList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.KResource, err error)
|
||||
KResourceExpansion
|
||||
}
|
||||
|
||||
// kResources implements KResourceInterface
|
||||
type kResources struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newKResources returns a KResources
|
||||
func newKResources(c *DuckV1alpha1Client, namespace string) *kResources {
|
||||
return &kResources{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the kResource, and returns the corresponding kResource object, and an error if there is any.
|
||||
func (c *kResources) Get(name string, options v1.GetOptions) (result *v1alpha1.KResource, err error) {
|
||||
result = &v1alpha1.KResource{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of KResources that match those selectors.
|
||||
func (c *kResources) List(opts v1.ListOptions) (result *v1alpha1.KResourceList, err error) {
|
||||
result = &v1alpha1.KResourceList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested kResources.
|
||||
func (c *kResources) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a kResource and creates it. Returns the server's representation of the kResource, and an error, if there is any.
|
||||
func (c *kResources) Create(kResource *v1alpha1.KResource) (result *v1alpha1.KResource, err error) {
|
||||
result = &v1alpha1.KResource{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
Body(kResource).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a kResource and updates it. Returns the server's representation of the kResource, and an error, if there is any.
|
||||
func (c *kResources) Update(kResource *v1alpha1.KResource) (result *v1alpha1.KResource, err error) {
|
||||
result = &v1alpha1.KResource{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
Name(kResource.Name).
|
||||
Body(kResource).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *kResources) UpdateStatus(kResource *v1alpha1.KResource) (result *v1alpha1.KResource, err error) {
|
||||
result = &v1alpha1.KResource{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
Name(kResource.Name).
|
||||
SubResource("status").
|
||||
Body(kResource).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the kResource and deletes it. Returns an error if one occurs.
|
||||
func (c *kResources) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *kResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched kResource.
|
||||
func (c *kResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.KResource, err error) {
|
||||
result = &v1alpha1.KResource{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("kresources").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
scheme "github.com/knative/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// TargetsGetter has a method to return a TargetInterface.
|
||||
// A group's client should implement this interface.
|
||||
type TargetsGetter interface {
|
||||
Targets(namespace string) TargetInterface
|
||||
}
|
||||
|
||||
// TargetInterface has methods to work with Target resources.
|
||||
type TargetInterface interface {
|
||||
Create(*v1alpha1.Target) (*v1alpha1.Target, error)
|
||||
Update(*v1alpha1.Target) (*v1alpha1.Target, error)
|
||||
UpdateStatus(*v1alpha1.Target) (*v1alpha1.Target, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.Target, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.TargetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Target, err error)
|
||||
TargetExpansion
|
||||
}
|
||||
|
||||
// targets implements TargetInterface
|
||||
type targets struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newTargets returns a Targets
|
||||
func newTargets(c *DuckV1alpha1Client, namespace string) *targets {
|
||||
return &targets{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the target, and returns the corresponding target object, and an error if there is any.
|
||||
func (c *targets) Get(name string, options v1.GetOptions) (result *v1alpha1.Target, err error) {
|
||||
result = &v1alpha1.Target{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Targets that match those selectors.
|
||||
func (c *targets) List(opts v1.ListOptions) (result *v1alpha1.TargetList, err error) {
|
||||
result = &v1alpha1.TargetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested targets.
|
||||
func (c *targets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a target and creates it. Returns the server's representation of the target, and an error, if there is any.
|
||||
func (c *targets) Create(target *v1alpha1.Target) (result *v1alpha1.Target, err error) {
|
||||
result = &v1alpha1.Target{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
Body(target).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a target and updates it. Returns the server's representation of the target, and an error, if there is any.
|
||||
func (c *targets) Update(target *v1alpha1.Target) (result *v1alpha1.Target, err error) {
|
||||
result = &v1alpha1.Target{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
Name(target.Name).
|
||||
Body(target).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *targets) UpdateStatus(target *v1alpha1.Target) (result *v1alpha1.Target, err error) {
|
||||
result = &v1alpha1.Target{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
Name(target.Name).
|
||||
SubResource("status").
|
||||
Body(target).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the target and deletes it. Returns an error if one occurs.
|
||||
func (c *targets) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *targets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched target.
|
||||
func (c *targets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Target, err error) {
|
||||
result = &v1alpha1.Target{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("targets").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
scheme "github.com/knative/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// TopicsGetter has a method to return a TopicInterface.
|
||||
// A group's client should implement this interface.
|
||||
type TopicsGetter interface {
|
||||
Topics(namespace string) TopicInterface
|
||||
}
|
||||
|
||||
// TopicInterface has methods to work with Topic resources.
|
||||
type TopicInterface interface {
|
||||
Create(*v1alpha1.Topic) (*v1alpha1.Topic, error)
|
||||
Update(*v1alpha1.Topic) (*v1alpha1.Topic, error)
|
||||
UpdateStatus(*v1alpha1.Topic) (*v1alpha1.Topic, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.Topic, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.TopicList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Topic, err error)
|
||||
TopicExpansion
|
||||
}
|
||||
|
||||
// topics implements TopicInterface
|
||||
type topics struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newTopics returns a Topics
|
||||
func newTopics(c *DuckV1alpha1Client, namespace string) *topics {
|
||||
return &topics{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the topic, and returns the corresponding topic object, and an error if there is any.
|
||||
func (c *topics) Get(name string, options v1.GetOptions) (result *v1alpha1.Topic, err error) {
|
||||
result = &v1alpha1.Topic{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Topics that match those selectors.
|
||||
func (c *topics) List(opts v1.ListOptions) (result *v1alpha1.TopicList, err error) {
|
||||
result = &v1alpha1.TopicList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested topics.
|
||||
func (c *topics) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a topic and creates it. Returns the server's representation of the topic, and an error, if there is any.
|
||||
func (c *topics) Create(topic *v1alpha1.Topic) (result *v1alpha1.Topic, err error) {
|
||||
result = &v1alpha1.Topic{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
Body(topic).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a topic and updates it. Returns the server's representation of the topic, and an error, if there is any.
|
||||
func (c *topics) Update(topic *v1alpha1.Topic) (result *v1alpha1.Topic, err error) {
|
||||
result = &v1alpha1.Topic{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
Name(topic.Name).
|
||||
Body(topic).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *topics) UpdateStatus(topic *v1alpha1.Topic) (result *v1alpha1.Topic, err error) {
|
||||
result = &v1alpha1.Topic{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
Name(topic.Name).
|
||||
SubResource("status").
|
||||
Body(topic).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the topic and deletes it. Returns an error if one occurs.
|
||||
func (c *topics) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *topics) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched topic.
|
||||
func (c *topics) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Topic, err error) {
|
||||
result = &v1alpha1.Topic{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("topics").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 duck
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/client/informers/externalversions/duck/v1alpha1"
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
||||
V1alpha1() v1alpha1.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}
|
||||
}
|
||||
|
||||
// V1alpha1 returns a new v1alpha1.Interface.
|
||||
func (g *group) V1alpha1() v1alpha1.Interface {
|
||||
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// KResources returns a KResourceInformer.
|
||||
KResources() KResourceInformer
|
||||
// Targets returns a TargetInformer.
|
||||
Targets() TargetInformer
|
||||
// Topics returns a TopicInformer.
|
||||
Topics() TopicInformer
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
// KResources returns a KResourceInformer.
|
||||
func (v *version) KResources() KResourceInformer {
|
||||
return &kResourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// Targets returns a TargetInformer.
|
||||
func (v *version) Targets() TargetInformer {
|
||||
return &targetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// Topics returns a TopicInformer.
|
||||
func (v *version) Topics() TopicInformer {
|
||||
return &topicInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
versioned "github.com/knative/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/knative/pkg/client/listers/duck/v1alpha1"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// KResourceInformer provides access to a shared informer and lister for
|
||||
// KResources.
|
||||
type KResourceInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.KResourceLister
|
||||
}
|
||||
|
||||
type kResourceInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewKResourceInformer constructs a new informer for KResource 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 NewKResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredKResourceInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredKResourceInformer constructs a new informer for KResource 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 NewFilteredKResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().KResources(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().KResources(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&duckv1alpha1.KResource{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *kResourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredKResourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *kResourceInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&duckv1alpha1.KResource{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *kResourceInformer) Lister() v1alpha1.KResourceLister {
|
||||
return v1alpha1.NewKResourceLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
versioned "github.com/knative/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/knative/pkg/client/listers/duck/v1alpha1"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// TargetInformer provides access to a shared informer and lister for
|
||||
// Targets.
|
||||
type TargetInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.TargetLister
|
||||
}
|
||||
|
||||
type targetInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewTargetInformer constructs a new informer for Target 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 NewTargetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredTargetInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredTargetInformer constructs a new informer for Target 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 NewFilteredTargetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().Targets(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().Targets(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&duckv1alpha1.Target{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *targetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredTargetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *targetInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&duckv1alpha1.Target{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *targetInformer) Lister() v1alpha1.TargetLister {
|
||||
return v1alpha1.NewTargetLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
versioned "github.com/knative/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/knative/pkg/client/listers/duck/v1alpha1"
|
||||
v1 "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"
|
||||
)
|
||||
|
||||
// TopicInformer provides access to a shared informer and lister for
|
||||
// Topics.
|
||||
type TopicInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.TopicLister
|
||||
}
|
||||
|
||||
type topicInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewTopicInformer constructs a new informer for Topic 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 NewTopicInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredTopicInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredTopicInformer constructs a new informer for Topic 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 NewFilteredTopicInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().Topics(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DuckV1alpha1().Topics(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&duckv1alpha1.Topic{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *topicInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredTopicInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *topicInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&duckv1alpha1.Topic{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *topicInformer) Lister() v1alpha1.TopicLister {
|
||||
return v1alpha1.NewTopicLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ import (
|
|||
|
||||
versioned "github.com/knative/pkg/client/clientset/versioned"
|
||||
authentication "github.com/knative/pkg/client/informers/externalversions/authentication"
|
||||
duck "github.com/knative/pkg/client/informers/externalversions/duck"
|
||||
internalinterfaces "github.com/knative/pkg/client/informers/externalversions/internalinterfaces"
|
||||
istio "github.com/knative/pkg/client/informers/externalversions/istio"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -174,6 +175,7 @@ type SharedInformerFactory interface {
|
|||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Authentication() authentication.Interface
|
||||
Duck() duck.Interface
|
||||
Networking() istio.Interface
|
||||
}
|
||||
|
||||
|
|
@ -181,6 +183,10 @@ func (f *sharedInformerFactory) Authentication() authentication.Interface {
|
|||
return authentication.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Duck() duck.Interface {
|
||||
return duck.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Networking() istio.Interface {
|
||||
return istio.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package externalversions
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
v1alpha1 "github.com/knative/pkg/apis/istio/authentication/v1alpha1"
|
||||
v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
|
@ -57,6 +58,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
case v1alpha1.SchemeGroupVersion.WithResource("policies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Authentication().V1alpha1().Policies().Informer()}, nil
|
||||
|
||||
// Group=duck.knative.dev, Version=v1alpha1
|
||||
case duckv1alpha1.SchemeGroupVersion.WithResource("kresources"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Duck().V1alpha1().KResources().Informer()}, nil
|
||||
case duckv1alpha1.SchemeGroupVersion.WithResource("targets"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Duck().V1alpha1().Targets().Informer()}, nil
|
||||
case duckv1alpha1.SchemeGroupVersion.WithResource("topics"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Duck().V1alpha1().Topics().Informer()}, nil
|
||||
|
||||
// Group=networking.istio.io, Version=v1alpha3
|
||||
case v1alpha3.SchemeGroupVersion.WithResource("destinationrules"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha3().DestinationRules().Informer()}, nil
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
// KResourceListerExpansion allows custom methods to be added to
|
||||
// KResourceLister.
|
||||
type KResourceListerExpansion interface{}
|
||||
|
||||
// KResourceNamespaceListerExpansion allows custom methods to be added to
|
||||
// KResourceNamespaceLister.
|
||||
type KResourceNamespaceListerExpansion interface{}
|
||||
|
||||
// TargetListerExpansion allows custom methods to be added to
|
||||
// TargetLister.
|
||||
type TargetListerExpansion interface{}
|
||||
|
||||
// TargetNamespaceListerExpansion allows custom methods to be added to
|
||||
// TargetNamespaceLister.
|
||||
type TargetNamespaceListerExpansion interface{}
|
||||
|
||||
// TopicListerExpansion allows custom methods to be added to
|
||||
// TopicLister.
|
||||
type TopicListerExpansion interface{}
|
||||
|
||||
// TopicNamespaceListerExpansion allows custom methods to be added to
|
||||
// TopicNamespaceLister.
|
||||
type TopicNamespaceListerExpansion interface{}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// KResourceLister helps list KResources.
|
||||
type KResourceLister interface {
|
||||
// List lists all KResources in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.KResource, err error)
|
||||
// KResources returns an object that can list and get KResources.
|
||||
KResources(namespace string) KResourceNamespaceLister
|
||||
KResourceListerExpansion
|
||||
}
|
||||
|
||||
// kResourceLister implements the KResourceLister interface.
|
||||
type kResourceLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewKResourceLister returns a new KResourceLister.
|
||||
func NewKResourceLister(indexer cache.Indexer) KResourceLister {
|
||||
return &kResourceLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all KResources in the indexer.
|
||||
func (s *kResourceLister) List(selector labels.Selector) (ret []*v1alpha1.KResource, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.KResource))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// KResources returns an object that can list and get KResources.
|
||||
func (s *kResourceLister) KResources(namespace string) KResourceNamespaceLister {
|
||||
return kResourceNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// KResourceNamespaceLister helps list and get KResources.
|
||||
type KResourceNamespaceLister interface {
|
||||
// List lists all KResources in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.KResource, err error)
|
||||
// Get retrieves the KResource from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1alpha1.KResource, error)
|
||||
KResourceNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// kResourceNamespaceLister implements the KResourceNamespaceLister
|
||||
// interface.
|
||||
type kResourceNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all KResources in the indexer for a given namespace.
|
||||
func (s kResourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.KResource, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.KResource))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the KResource from the indexer for a given namespace and name.
|
||||
func (s kResourceNamespaceLister) Get(name string) (*v1alpha1.KResource, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("kresource"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.KResource), nil
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// TargetLister helps list Targets.
|
||||
type TargetLister interface {
|
||||
// List lists all Targets in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.Target, err error)
|
||||
// Targets returns an object that can list and get Targets.
|
||||
Targets(namespace string) TargetNamespaceLister
|
||||
TargetListerExpansion
|
||||
}
|
||||
|
||||
// targetLister implements the TargetLister interface.
|
||||
type targetLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewTargetLister returns a new TargetLister.
|
||||
func NewTargetLister(indexer cache.Indexer) TargetLister {
|
||||
return &targetLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Targets in the indexer.
|
||||
func (s *targetLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.Target))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Targets returns an object that can list and get Targets.
|
||||
func (s *targetLister) Targets(namespace string) TargetNamespaceLister {
|
||||
return targetNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// TargetNamespaceLister helps list and get Targets.
|
||||
type TargetNamespaceLister interface {
|
||||
// List lists all Targets in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.Target, err error)
|
||||
// Get retrieves the Target from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1alpha1.Target, error)
|
||||
TargetNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// targetNamespaceLister implements the TargetNamespaceLister
|
||||
// interface.
|
||||
type targetNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Targets in the indexer for a given namespace.
|
||||
func (s targetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.Target))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Target from the indexer for a given namespace and name.
|
||||
func (s targetNamespaceLister) Get(name string) (*v1alpha1.Target, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("target"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.Target), nil
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Copyright 2018 The Knative 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 v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// TopicLister helps list Topics.
|
||||
type TopicLister interface {
|
||||
// List lists all Topics in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.Topic, err error)
|
||||
// Topics returns an object that can list and get Topics.
|
||||
Topics(namespace string) TopicNamespaceLister
|
||||
TopicListerExpansion
|
||||
}
|
||||
|
||||
// topicLister implements the TopicLister interface.
|
||||
type topicLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewTopicLister returns a new TopicLister.
|
||||
func NewTopicLister(indexer cache.Indexer) TopicLister {
|
||||
return &topicLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Topics in the indexer.
|
||||
func (s *topicLister) List(selector labels.Selector) (ret []*v1alpha1.Topic, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.Topic))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Topics returns an object that can list and get Topics.
|
||||
func (s *topicLister) Topics(namespace string) TopicNamespaceLister {
|
||||
return topicNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// TopicNamespaceLister helps list and get Topics.
|
||||
type TopicNamespaceLister interface {
|
||||
// List lists all Topics in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.Topic, err error)
|
||||
// Get retrieves the Topic from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1alpha1.Topic, error)
|
||||
TopicNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// topicNamespaceLister implements the TopicNamespaceLister
|
||||
// interface.
|
||||
type topicNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Topics in the indexer for a given namespace.
|
||||
func (s topicNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Topic, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.Topic))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Topic from the indexer for a given namespace and name.
|
||||
func (s topicNamespaceLister) Get(name string) (*v1alpha1.Topic, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("topic"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.Topic), nil
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ go install ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
|
|||
# instead of the $GOPATH directly. For normal projects this can be dropped.
|
||||
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
|
||||
github.com/knative/pkg/client github.com/knative/pkg/apis \
|
||||
"istio:v1alpha3 istio/authentication:v1alpha1" \
|
||||
"istio:v1alpha3 istio/authentication:v1alpha1 duck:v1alpha1" \
|
||||
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
|
||||
|
||||
# Depends on generate-groups.sh to install bin/deepcopy-gen
|
||||
|
|
|
|||
Loading…
Reference in New Issue