Skip to content

Commit 8713240

Browse files
l0lawrenceripark
andauthored
[EG] GA client.tsp updates (#29208)
* try this * ver * update * details * update * renew locks result rename * add new version - testing * remove diff * ga version * update * try alias * all operations mark as internal to allow for topic/sub customization * remove * tsp format * alias change * details * changes * after merge required regen * nit * try * tsp format * edits off of lang * only python * nit * Fixing some names for Go, based on Go arch feedback. * One more rename * Update specification/eventgrid/Azure.Messaging.EventGrid/client.tsp * fixing go diff * update * update internal --------- Co-authored-by: ripark <[email protected]>
1 parent bf97382 commit 8713240

File tree

6 files changed

+351
-293
lines changed

6 files changed

+351
-293
lines changed
Lines changed: 143 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,148 @@
11
import "@azure-tools/typespec-client-generator-core";
22
import "./main.tsp";
3+
import "@typespec/versioning";
34

45
using Azure.ClientGenerator.Core;
6+
using Microsoft.EventGrid;
57

6-
@@access(Microsoft.EventGrid.publishCloudEvent, Access.internal, "python");
7-
@@access(Microsoft.EventGrid.publishCloudEvents, Access.internal, "python");
8-
@@access(Microsoft.EventGrid.receiveCloudEvents, Access.internal, "python");
8+
@TypeSpec.Versioning.useDependency(ServiceApiVersions.v2024_06_01)
9+
namespace Customizations {
10+
@client(
11+
{
12+
name: "EventGridPublisherClient",
13+
service: Microsoft.EventGrid,
14+
},
15+
"python"
16+
)
17+
interface Client1 {
18+
send is publishCloudEvent;
19+
sendEvents is publishCloudEvents;
20+
}
21+
22+
@client(
23+
{
24+
name: "EventGridConsumerClient",
25+
service: Microsoft.EventGrid,
26+
},
27+
"python"
28+
)
29+
interface Client2 {
30+
receive is receiveCloudEvents;
31+
acknowledge is acknowledgeCloudEvents;
32+
release is releaseCloudEvents;
33+
reject is rejectCloudEvents;
34+
renewLocks is renewCloudEventLocks;
35+
}
36+
37+
@client(
38+
{
39+
name: "EventGridSenderClient",
40+
service: Microsoft.EventGrid,
41+
},
42+
"csharp"
43+
)
44+
interface ClientSender {
45+
send is publishCloudEvent;
46+
sendEvents is publishCloudEvents;
47+
}
48+
49+
@client(
50+
{
51+
name: "EventGridReceiverClient",
52+
service: Microsoft.EventGrid,
53+
},
54+
"csharp"
55+
)
56+
interface ClientReceiver {
57+
receive is receiveCloudEvents;
58+
acknowledge is acknowledgeCloudEvents;
59+
release is releaseCloudEvents;
60+
reject is rejectCloudEvents;
61+
renewLocks is renewCloudEventLocks;
62+
}
63+
64+
@client(
65+
{
66+
name: "EventGridSenderClient",
67+
service: Microsoft.EventGrid,
68+
},
69+
"java"
70+
)
71+
interface ClientSender2 {
72+
send is publishCloudEvent;
73+
sendEvents is publishCloudEvents;
74+
}
75+
76+
@client(
77+
{
78+
name: "EventGridReceiverClient",
79+
service: Microsoft.EventGrid,
80+
},
81+
"java"
82+
)
83+
interface ClientReceiver2 {
84+
receive is receiveCloudEvents;
85+
acknowledge is acknowledgeCloudEvents;
86+
release is releaseCloudEvents;
87+
reject is rejectCloudEvents;
88+
renewLocks is renewCloudEventLocks;
89+
}
90+
91+
@client(
92+
{
93+
name: "SenderClient",
94+
service: Microsoft.EventGrid,
95+
},
96+
"go"
97+
)
98+
interface ClientSenderGo {
99+
sendEvent is publishCloudEvent;
100+
sendEvents is publishCloudEvents;
101+
}
102+
103+
@client(
104+
{
105+
name: "ReceiverClient",
106+
service: Microsoft.EventGrid,
107+
},
108+
"go"
109+
)
110+
interface ClientReceiverGo {
111+
receiveEvents is receiveCloudEvents;
112+
acknowledgeEvents is acknowledgeCloudEvents;
113+
releaseEvents is releaseCloudEvents;
114+
rejectEvents is rejectCloudEvents;
115+
renewEventLocks is renewCloudEventLocks;
116+
}
117+
}
118+
119+
// All Language customizations
120+
121+
// publishCloudEvent access level
122+
@@access(publishCloudEvent, Access.internal, "python");
123+
124+
// publishCloudEvents access level
125+
@@access(publishCloudEvents, Access.internal, "python");
126+
127+
@@access(receiveCloudEvents, Access.internal, "python");
128+
@@access(acknowledgeCloudEvents, Access.internal, "python");
129+
@@access(releaseCloudEvents, Access.internal, "python");
130+
@@access(rejectCloudEvents, Access.internal, "python");
131+
@@access(renewCloudEventLocks, Access.internal, "python");
132+
133+
@@access(AcknowledgeResult, Access.public);
134+
@@access(ReleaseResult, Access.public);
135+
@@access(RejectResult, Access.public);
136+
@@access(RenewCloudEventLocksResult, Access.public);
137+
@@access(ReleaseDelay, Access.public);
138+
@@access(FailedLockToken, Access.public);
139+
140+
@@clientName(ReleaseDelay.By0Seconds, "NoDelay");
141+
@@clientName(ReleaseDelay.By10Seconds, "TenSeconds");
142+
@@clientName(ReleaseDelay.By3600Seconds, "OneHour");
143+
@@clientName(ReleaseDelay.By600Seconds, "TenMinutes");
144+
@@clientName(ReleaseDelay.By60Seconds, "OneMinute");
145+
146+
@@clientName(RenewCloudEventLocksResult, "RenewLocksResult");
147+
148+
@@clientName(ReceiveResult.value, "details");

specification/eventgrid/Azure.Messaging.EventGrid/main.tsp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -189,29 +189,25 @@ namespace Microsoft.EventGrid {
189189
succeededLockTokens: string[];
190190
}
191191

192-
@doc("Array of lock tokens for the corresponding received Cloud Events to be released.")
193-
model ReleaseOptions {
192+
alias ReleaseOptions = {
194193
@doc("Array of lock tokens.")
195194
lockTokens: string[];
196-
}
195+
};
197196

198-
@doc("Array of lock tokens for the corresponding received Cloud Events to be acknowledged.")
199-
model AcknowledgeOptions {
197+
alias AcknowledgeOptions = {
200198
@doc("Array of lock tokens.")
201199
lockTokens: string[];
202-
}
200+
};
203201

204-
@doc("Array of lock tokens for the corresponding received Cloud Events to be rejected.")
205-
model RejectOptions {
202+
alias RejectOptions = {
206203
@doc("Array of lock tokens.")
207204
lockTokens: string[];
208-
}
205+
};
209206

210-
@doc("Array of lock tokens for the corresponding received Cloud Events to be renewed.")
211-
model RenewLockOptions {
207+
alias RenewLockOptions = {
212208
@doc("Array of lock tokens.")
213209
lockTokens: string[];
214-
}
210+
};
215211

216212
@doc("Topic Resource.")
217213
@resource("topics")
@@ -304,9 +300,7 @@ namespace Microsoft.EventGrid {
304300
op acknowledgeCloudEvents is StandardOperations.ResourceAction<
305301
EventSubscription,
306302
{
307-
@doc("AcknowledgeOptions.")
308-
@bodyRoot
309-
acknowledgeOptions: AcknowledgeOptions;
303+
...AcknowledgeOptions;
310304
},
311305
AcknowledgeResult
312306
>;
@@ -319,9 +313,7 @@ namespace Microsoft.EventGrid {
319313
op releaseCloudEvents is StandardOperations.ResourceAction<
320314
EventSubscription,
321315
{
322-
@doc("ReleaseOptions")
323-
@bodyRoot
324-
releaseOptions: ReleaseOptions;
316+
...ReleaseOptions;
325317

326318
@added(ServiceApiVersions.v2023_10_01_preview)
327319
@removed(ServiceApiVersions.v2023_11_01)
@@ -341,9 +333,7 @@ namespace Microsoft.EventGrid {
341333
op rejectCloudEvents is StandardOperations.ResourceAction<
342334
EventSubscription,
343335
{
344-
@doc("RejectOptions")
345-
@bodyRoot
346-
rejectOptions: RejectOptions;
336+
...RejectOptions;
347337
},
348338
RejectResult
349339
>;
@@ -358,9 +348,7 @@ namespace Microsoft.EventGrid {
358348
op renewCloudEventLocks is StandardOperations.ResourceAction<
359349
EventSubscription,
360350
{
361-
@doc("RenewLockOptions")
362-
@bodyRoot
363-
renewLockOptions: RenewLockOptions;
351+
...RenewLockOptions;
364352
},
365353
RenewCloudEventLocksResult
366354
>;

specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,23 @@
195195
"type": "string"
196196
},
197197
{
198-
"name": "acknowledgeOptions",
198+
"name": "body",
199199
"in": "body",
200-
"description": "AcknowledgeOptions.",
201200
"required": true,
202201
"schema": {
203-
"$ref": "#/definitions/AcknowledgeOptions"
202+
"type": "object",
203+
"properties": {
204+
"lockTokens": {
205+
"type": "array",
206+
"description": "Array of lock tokens.",
207+
"items": {
208+
"type": "string"
209+
}
210+
}
211+
},
212+
"required": [
213+
"lockTokens"
214+
]
204215
}
205216
}
206217
],
@@ -254,12 +265,23 @@
254265
"type": "string"
255266
},
256267
{
257-
"name": "releaseOptions",
268+
"name": "body",
258269
"in": "body",
259-
"description": "ReleaseOptions",
260270
"required": true,
261271
"schema": {
262-
"$ref": "#/definitions/ReleaseOptions"
272+
"type": "object",
273+
"properties": {
274+
"lockTokens": {
275+
"type": "array",
276+
"description": "Array of lock tokens.",
277+
"items": {
278+
"type": "string"
279+
}
280+
}
281+
},
282+
"required": [
283+
"lockTokens"
284+
]
263285
}
264286
}
265287
],
@@ -313,12 +335,23 @@
313335
"type": "string"
314336
},
315337
{
316-
"name": "rejectOptions",
338+
"name": "body",
317339
"in": "body",
318-
"description": "RejectOptions",
319340
"required": true,
320341
"schema": {
321-
"$ref": "#/definitions/RejectOptions"
342+
"type": "object",
343+
"properties": {
344+
"lockTokens": {
345+
"type": "array",
346+
"description": "Array of lock tokens.",
347+
"items": {
348+
"type": "string"
349+
}
350+
}
351+
},
352+
"required": [
353+
"lockTokens"
354+
]
322355
}
323356
}
324357
],
@@ -411,22 +444,6 @@
411444
}
412445
},
413446
"definitions": {
414-
"AcknowledgeOptions": {
415-
"type": "object",
416-
"description": "Array of lock tokens for the corresponding received Cloud Events to be acknowledged.",
417-
"properties": {
418-
"lockTokens": {
419-
"type": "array",
420-
"description": "Array of lock tokens.",
421-
"items": {
422-
"type": "string"
423-
}
424-
}
425-
},
426-
"required": [
427-
"lockTokens"
428-
]
429-
},
430447
"AcknowledgeResult": {
431448
"type": "object",
432449
"description": "The result of the Acknowledge operation.",
@@ -642,22 +659,6 @@
642659
"value"
643660
]
644661
},
645-
"RejectOptions": {
646-
"type": "object",
647-
"description": "Array of lock tokens for the corresponding received Cloud Events to be rejected.",
648-
"properties": {
649-
"lockTokens": {
650-
"type": "array",
651-
"description": "Array of lock tokens.",
652-
"items": {
653-
"type": "string"
654-
}
655-
}
656-
},
657-
"required": [
658-
"lockTokens"
659-
]
660-
},
661662
"RejectResult": {
662663
"type": "object",
663664
"description": "The result of the Reject operation.",
@@ -683,22 +684,6 @@
683684
"succeededLockTokens"
684685
]
685686
},
686-
"ReleaseOptions": {
687-
"type": "object",
688-
"description": "Array of lock tokens for the corresponding received Cloud Events to be released.",
689-
"properties": {
690-
"lockTokens": {
691-
"type": "array",
692-
"description": "Array of lock tokens.",
693-
"items": {
694-
"type": "string"
695-
}
696-
}
697-
},
698-
"required": [
699-
"lockTokens"
700-
]
701-
},
702687
"ReleaseResult": {
703688
"type": "object",
704689
"description": "The result of the Release operation.",

0 commit comments

Comments
 (0)