From 35afaa9e956027672468a6d69a687771ba4f2b33 Mon Sep 17 00:00:00 2001 From: Nacho Cano Date: Tue, 17 Mar 2020 15:52:52 -0700 Subject: [PATCH] add CloudEventAttributes to duckv1.SourceStatus --- apis/duck/v1/source_types.go | 20 ++++++++++++++++++++ apis/duck/v1/zz_generated.deepcopy.go | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/apis/duck/v1/source_types.go b/apis/duck/v1/source_types.go index 782556471e..3b378ca3d4 100644 --- a/apis/duck/v1/source_types.go +++ b/apis/duck/v1/source_types.go @@ -81,6 +81,22 @@ type SourceStatus struct { // Source. // +optional SinkURI *apis.URL `json:"sinkUri,omitempty"` + + // CloudEventAttributes are the specific attributes that the Source uses + // as part of its CloudEvents. + // +optional + CloudEventAttributes []CloudEventAttributes `json:"ceAttributes,omitempty"` +} + +// CloudEventAttributes specifies the attributes that a Source +// uses as part of its CloudEvents. +type CloudEventAttributes struct { + + // Type refers to the CloudEvent type attribute. + Type string `json:"type,omitempty"` + + // Source is the CloudEvents source attribute. + Source string `json:"source,omitempty"` } // IsReady returns true if the resource is ready overall. @@ -137,6 +153,10 @@ func (s *Source) Populate() { Host: "tableflip.dev", RawQuery: "flip=mattmoor", } + s.Status.CloudEventAttributes = []CloudEventAttributes{{ + Type: "dev.knative.foo", + Source: "http://knative.dev/knative/eventing", + }} } // GetListType implements apis.Listable diff --git a/apis/duck/v1/zz_generated.deepcopy.go b/apis/duck/v1/zz_generated.deepcopy.go index 2fcfbed776..3397713be0 100644 --- a/apis/duck/v1/zz_generated.deepcopy.go +++ b/apis/duck/v1/zz_generated.deepcopy.go @@ -127,6 +127,22 @@ func (in *AddressableTypeList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudEventAttributes) DeepCopyInto(out *CloudEventAttributes) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudEventAttributes. +func (in *CloudEventAttributes) DeepCopy() *CloudEventAttributes { + if in == nil { + return nil + } + out := new(CloudEventAttributes) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CloudEventOverrides) DeepCopyInto(out *CloudEventOverrides) { *out = *in @@ -384,6 +400,11 @@ func (in *SourceStatus) DeepCopyInto(out *SourceStatus) { *out = new(apis.URL) (*in).DeepCopyInto(*out) } + if in.CloudEventAttributes != nil { + in, out := &in.CloudEventAttributes, &out.CloudEventAttributes + *out = make([]CloudEventAttributes, len(*in)) + copy(*out, *in) + } return }