Skip to content

Commit e96e9eb

Browse files
committed
feat: add go types for requestreply
Signed-off-by: Cali0707 <[email protected]>
1 parent ef479cf commit e96e9eb

30 files changed

+2744
-2
lines changed

docs/eventing-api.md

Lines changed: 301 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Resource Types:
5252
<h3 id="duck.knative.dev/v1.AppliedEventPoliciesStatus">AppliedEventPoliciesStatus
5353
</h3>
5454
<p>
55-
(<em>Appears on:</em><a href="#duck.knative.dev/v1.ChannelableStatus">ChannelableStatus</a>, <a href="#eventing.knative.dev/v1.BrokerStatus">BrokerStatus</a>, <a href="#flows.knative.dev/v1.ParallelStatus">ParallelStatus</a>, <a href="#flows.knative.dev/v1.SequenceStatus">SequenceStatus</a>, <a href="#sinks.knative.dev/v1alpha1.JobSinkStatus">JobSinkStatus</a>)
55+
(<em>Appears on:</em><a href="#duck.knative.dev/v1.ChannelableStatus">ChannelableStatus</a>, <a href="#eventing.knative.dev/v1.BrokerStatus">BrokerStatus</a>, <a href="#eventing.knative.dev/v1alpha1.RequestReplyStatus">RequestReplyStatus</a>, <a href="#flows.knative.dev/v1.ParallelStatus">ParallelStatus</a>, <a href="#flows.knative.dev/v1.SequenceStatus">SequenceStatus</a>, <a href="#sinks.knative.dev/v1alpha1.JobSinkStatus">JobSinkStatus</a>)
5656
</p>
5757
<p>
5858
<p>AppliedEventPoliciesStatus contains the list of policies which apply to a resource.
@@ -393,7 +393,7 @@ AppliedEventPoliciesStatus
393393
<h3 id="duck.knative.dev/v1.DeliverySpec">DeliverySpec
394394
</h3>
395395
<p>
396-
(<em>Appears on:</em><a href="#duck.knative.dev/v1.ChannelableSpec">ChannelableSpec</a>, <a href="#duck.knative.dev/v1.SubscriberSpec">SubscriberSpec</a>, <a href="#eventing.knative.dev/v1.BrokerSpec">BrokerSpec</a>, <a href="#eventing.knative.dev/v1.TriggerSpec">TriggerSpec</a>, <a href="#flows.knative.dev/v1.ParallelBranch">ParallelBranch</a>, <a href="#flows.knative.dev/v1.SequenceStep">SequenceStep</a>, <a href="#messaging.knative.dev/v1.SubscriptionSpec">SubscriptionSpec</a>)
396+
(<em>Appears on:</em><a href="#duck.knative.dev/v1.ChannelableSpec">ChannelableSpec</a>, <a href="#duck.knative.dev/v1.SubscriberSpec">SubscriberSpec</a>, <a href="#eventing.knative.dev/v1.BrokerSpec">BrokerSpec</a>, <a href="#eventing.knative.dev/v1.TriggerSpec">TriggerSpec</a>, <a href="#eventing.knative.dev/v1alpha1.RequestReplySpec">RequestReplySpec</a>, <a href="#flows.knative.dev/v1.ParallelBranch">ParallelBranch</a>, <a href="#flows.knative.dev/v1.SequenceStep">SequenceStep</a>, <a href="#messaging.knative.dev/v1.SubscriptionSpec">SubscriptionSpec</a>)
397397
</p>
398398
<p>
399399
<p>DeliverySpec contains the delivery options for event senders,
@@ -2648,6 +2648,8 @@ knative.dev/pkg/apis/duck/v1.AuthStatus
26482648
Resource Types:
26492649
<ul><li>
26502650
<a href="#eventing.knative.dev/v1alpha1.EventPolicy">EventPolicy</a>
2651+
</li><li>
2652+
<a href="#eventing.knative.dev/v1alpha1.RequestReply">RequestReply</a>
26512653
</li></ul>
26522654
<h3 id="eventing.knative.dev/v1alpha1.EventPolicy">EventPolicy
26532655
</h3>
@@ -2776,6 +2778,150 @@ This data may be out of date.</p>
27762778
</tr>
27772779
</tbody>
27782780
</table>
2781+
<h3 id="eventing.knative.dev/v1alpha1.RequestReply">RequestReply
2782+
</h3>
2783+
<p>
2784+
<p>RequestRepluy represents synchronous interface to sending and receiving events from a Broker.</p>
2785+
</p>
2786+
<table>
2787+
<thead>
2788+
<tr>
2789+
<th>Field</th>
2790+
<th>Description</th>
2791+
</tr>
2792+
</thead>
2793+
<tbody>
2794+
<tr>
2795+
<td>
2796+
<code>apiVersion</code><br/>
2797+
string</td>
2798+
<td>
2799+
<code>
2800+
eventing.knative.dev/v1alpha1
2801+
</code>
2802+
</td>
2803+
</tr>
2804+
<tr>
2805+
<td>
2806+
<code>kind</code><br/>
2807+
string
2808+
</td>
2809+
<td><code>RequestReply</code></td>
2810+
</tr>
2811+
<tr>
2812+
<td>
2813+
<code>metadata</code><br/>
2814+
<em>
2815+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#objectmeta-v1-meta">
2816+
Kubernetes meta/v1.ObjectMeta
2817+
</a>
2818+
</em>
2819+
</td>
2820+
<td>
2821+
<em>(Optional)</em>
2822+
Refer to the Kubernetes API documentation for the fields of the
2823+
<code>metadata</code> field.
2824+
</td>
2825+
</tr>
2826+
<tr>
2827+
<td>
2828+
<code>spec</code><br/>
2829+
<em>
2830+
<a href="#eventing.knative.dev/v1alpha1.RequestReplySpec">
2831+
RequestReplySpec
2832+
</a>
2833+
</em>
2834+
</td>
2835+
<td>
2836+
<p>Spec defines the desired state of the EventPolicy.</p>
2837+
<br/>
2838+
<br/>
2839+
<table>
2840+
<tr>
2841+
<td>
2842+
<code>brokerRef</code><br/>
2843+
<em>
2844+
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#KReference">
2845+
knative.dev/pkg/apis/duck/v1.KReference
2846+
</a>
2847+
</em>
2848+
</td>
2849+
<td>
2850+
<p>BrokerRef contains the reference to the broker the RequestReply sends events to.</p>
2851+
</td>
2852+
</tr>
2853+
<tr>
2854+
<td>
2855+
<code>correlationAttribute</code><br/>
2856+
<em>
2857+
string
2858+
</em>
2859+
</td>
2860+
<td>
2861+
</td>
2862+
</tr>
2863+
<tr>
2864+
<td>
2865+
<code>replyAttribute</code><br/>
2866+
<em>
2867+
string
2868+
</em>
2869+
</td>
2870+
<td>
2871+
</td>
2872+
</tr>
2873+
<tr>
2874+
<td>
2875+
<code>timeout</code><br/>
2876+
<em>
2877+
string
2878+
</em>
2879+
</td>
2880+
<td>
2881+
</td>
2882+
</tr>
2883+
<tr>
2884+
<td>
2885+
<code>delivery</code><br/>
2886+
<em>
2887+
<a href="#duck.knative.dev/v1.DeliverySpec">
2888+
DeliverySpec
2889+
</a>
2890+
</em>
2891+
</td>
2892+
<td>
2893+
</td>
2894+
</tr>
2895+
<tr>
2896+
<td>
2897+
<code>secrets</code><br/>
2898+
<em>
2899+
[]string
2900+
</em>
2901+
</td>
2902+
<td>
2903+
</td>
2904+
</tr>
2905+
</table>
2906+
</td>
2907+
</tr>
2908+
<tr>
2909+
<td>
2910+
<code>status</code><br/>
2911+
<em>
2912+
<a href="#eventing.knative.dev/v1alpha1.RequestReplyStatus">
2913+
RequestReplyStatus
2914+
</a>
2915+
</em>
2916+
</td>
2917+
<td>
2918+
<em>(Optional)</em>
2919+
<p>Status represents the current state of the EventPolicy.
2920+
This data may be out of date.</p>
2921+
</td>
2922+
</tr>
2923+
</tbody>
2924+
</table>
27792925
<h3 id="eventing.knative.dev/v1alpha1.EventPolicyFromReference">EventPolicyFromReference
27802926
</h3>
27812927
<p>
@@ -3127,6 +3273,159 @@ More info: <a href="https://kubernetes.io/docs/concepts/overview/working-with-ob
31273273
</tr>
31283274
</tbody>
31293275
</table>
3276+
<h3 id="eventing.knative.dev/v1alpha1.RequestReplySpec">RequestReplySpec
3277+
</h3>
3278+
<p>
3279+
(<em>Appears on:</em><a href="#eventing.knative.dev/v1alpha1.RequestReply">RequestReply</a>)
3280+
</p>
3281+
<p>
3282+
</p>
3283+
<table>
3284+
<thead>
3285+
<tr>
3286+
<th>Field</th>
3287+
<th>Description</th>
3288+
</tr>
3289+
</thead>
3290+
<tbody>
3291+
<tr>
3292+
<td>
3293+
<code>brokerRef</code><br/>
3294+
<em>
3295+
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#KReference">
3296+
knative.dev/pkg/apis/duck/v1.KReference
3297+
</a>
3298+
</em>
3299+
</td>
3300+
<td>
3301+
<p>BrokerRef contains the reference to the broker the RequestReply sends events to.</p>
3302+
</td>
3303+
</tr>
3304+
<tr>
3305+
<td>
3306+
<code>correlationAttribute</code><br/>
3307+
<em>
3308+
string
3309+
</em>
3310+
</td>
3311+
<td>
3312+
</td>
3313+
</tr>
3314+
<tr>
3315+
<td>
3316+
<code>replyAttribute</code><br/>
3317+
<em>
3318+
string
3319+
</em>
3320+
</td>
3321+
<td>
3322+
</td>
3323+
</tr>
3324+
<tr>
3325+
<td>
3326+
<code>timeout</code><br/>
3327+
<em>
3328+
string
3329+
</em>
3330+
</td>
3331+
<td>
3332+
</td>
3333+
</tr>
3334+
<tr>
3335+
<td>
3336+
<code>delivery</code><br/>
3337+
<em>
3338+
<a href="#duck.knative.dev/v1.DeliverySpec">
3339+
DeliverySpec
3340+
</a>
3341+
</em>
3342+
</td>
3343+
<td>
3344+
</td>
3345+
</tr>
3346+
<tr>
3347+
<td>
3348+
<code>secrets</code><br/>
3349+
<em>
3350+
[]string
3351+
</em>
3352+
</td>
3353+
<td>
3354+
</td>
3355+
</tr>
3356+
</tbody>
3357+
</table>
3358+
<h3 id="eventing.knative.dev/v1alpha1.RequestReplyStatus">RequestReplyStatus
3359+
</h3>
3360+
<p>
3361+
(<em>Appears on:</em><a href="#eventing.knative.dev/v1alpha1.RequestReply">RequestReply</a>)
3362+
</p>
3363+
<p>
3364+
<p>RequestReplyStatus represents the current state of a RequestReply.</p>
3365+
</p>
3366+
<table>
3367+
<thead>
3368+
<tr>
3369+
<th>Field</th>
3370+
<th>Description</th>
3371+
</tr>
3372+
</thead>
3373+
<tbody>
3374+
<tr>
3375+
<td>
3376+
<code>Status</code><br/>
3377+
<em>
3378+
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#Status">
3379+
knative.dev/pkg/apis/duck/v1.Status
3380+
</a>
3381+
</em>
3382+
</td>
3383+
<td>
3384+
<p>
3385+
(Members of <code>Status</code> are embedded into this type.)
3386+
</p>
3387+
<p>inherits duck/v1 Status, which currently provides:
3388+
* ObservedGeneration - the &lsquo;Generation&rsquo; of the Service that was last processed by the controller.
3389+
* Conditions - the latest available observations of a resource&rsquo;s current state.</p>
3390+
</td>
3391+
</tr>
3392+
<tr>
3393+
<td>
3394+
<code>AddressStatus</code><br/>
3395+
<em>
3396+
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#AddressStatus">
3397+
knative.dev/pkg/apis/duck/v1.AddressStatus
3398+
</a>
3399+
</em>
3400+
</td>
3401+
<td>
3402+
<p>
3403+
(Members of <code>AddressStatus</code> are embedded into this type.)
3404+
</p>
3405+
<em>(Optional)</em>
3406+
<p>AddressStatus is the part where the RequestReply fulfills the Addressable contract.
3407+
It exposes the endpoint as an URI to get events delivered.</p>
3408+
</td>
3409+
</tr>
3410+
<tr>
3411+
<td>
3412+
<code>AppliedEventPoliciesStatus</code><br/>
3413+
<em>
3414+
<a href="#duck.knative.dev/v1.AppliedEventPoliciesStatus">
3415+
AppliedEventPoliciesStatus
3416+
</a>
3417+
</em>
3418+
</td>
3419+
<td>
3420+
<p>
3421+
(Members of <code>AppliedEventPoliciesStatus</code> are embedded into this type.)
3422+
</p>
3423+
<em>(Optional)</em>
3424+
<p>AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker.</p>
3425+
</td>
3426+
</tr>
3427+
</tbody>
3428+
</table>
31303429
<hr/>
31313430
<h2 id="eventing.knative.dev/v1beta1">eventing.knative.dev/v1beta1</h2>
31323431
<p>

pkg/apis/eventing/v1alpha1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
4747
scheme.AddKnownTypes(SchemeGroupVersion,
4848
&EventPolicy{},
4949
&EventPolicyList{},
50+
&RequestReply{},
51+
&RequestReplyList{},
5052
)
5153
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
5254
return nil
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright 2020 The Knative Authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
"context"
21+
"fmt"
22+
23+
"knative.dev/pkg/apis"
24+
)
25+
26+
// ConvertTo implements apis.Convertible
27+
func (ep *RequestReply) ConvertTo(ctx context.Context, obj apis.Convertible) error {
28+
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", obj)
29+
}
30+
31+
// ConvertFrom implements apis.Convertible
32+
func (ep *RequestReply) ConvertFrom(ctx context.Context, obj apis.Convertible) error {
33+
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", obj)
34+
}

0 commit comments

Comments
 (0)