Skip to content

Commit d695ba3

Browse files
mikeharderharryli0108
authored andcommitted
[TypeSpec CI] Revert formatting check and changes to eventgrid (Azure#24430)
- Blocked until microsoft/typespec#2060 is fixed
1 parent 740b641 commit d695ba3

File tree

2 files changed

+130
-155
lines changed

2 files changed

+130
-155
lines changed

eng/pipelines/templates/steps/typespec-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ steps:
3333
fi
3434
3535
# Format parent folder to include shared files
36-
npx tsp format ../**/*.tsp
36+
# Disabled until https://github.com/microsoft/typespec/issues/2060 is fixed
37+
# npx tsp format ../**/*.tsp
3738
3839
popd
3940

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

Lines changed: 128 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import "@typespec/rest";
33
import "@typespec/versioning";
44
import "@azure-tools/typespec-azure-core";
55

6-
@useAuth(ApiKeyAuth<ApiKeyLocation.header, "SharedAccessKey">)
6+
@useAuth(
7+
ApiKeyAuth<ApiKeyLocation.header, "SharedAccessKey">
8+
)
9+
710
@service({
811
title: "Azure.Messaging.EventGridClient",
912
})
@@ -16,6 +19,8 @@ import "@azure-tools/typespec-azure-core";
1619
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge?api-Version={apiVersion}
1720
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}
1821
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion}
22+
23+
1924
@server(
2025
"{endpoint}",
2126
"The host name of the namespace",
@@ -24,24 +29,10 @@ import "@azure-tools/typespec-azure-core";
2429
endpoint: url,
2530
}
2631
)
32+
2733
@doc("Azure Messaging EventGrid Client")
2834
@versioned(ServiceApiVersions)
2935
namespace Azure.Messaging.EventGrid {
30-
31-
// Publish Operation:
32-
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}:publish?api-version={apiVersion}}
33-
34-
// Receive Operation:
35-
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive?api-Version={apiVersion}&maxWaitTime=60&maxEvents={maxEvents}
36-
37-
// Acknowledge Operation:
38-
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge&apiVersion={apiVersion}
39-
40-
// Release Operation:
41-
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}
42-
43-
// Reject Operation:
44-
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion}
4536
using TypeSpec.Http;
4637
using TypeSpec.Rest;
4738
using TypeSpec.Versioning;
@@ -51,7 +42,7 @@ namespace Azure.Messaging.EventGrid {
5142
#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
5243
enum ServiceApiVersions {
5344
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
54-
v2023_06_01_preview: "2023-06-01-preview",
45+
v2023_06_01_preview: "2023-06-01-preview"
5546
}
5647

5748
@doc("Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema.")
@@ -67,7 +58,7 @@ namespace Azure.Messaging.EventGrid {
6758

6859
@doc("Event data specific to the event type, encoded as a base64 string.")
6960
data_base64?: bytes;
70-
61+
7162
@doc("Type of event related to the originating occurrence.")
7263
type: string;
7364

@@ -110,7 +101,7 @@ namespace Azure.Messaging.EventGrid {
110101
@doc("Array of receive responses, one per cloud event.")
111102
value: ReceiveDetails[];
112103
}
113-
104+
114105
@doc("Failed LockToken information.")
115106
model FailedLockToken {
116107
@doc("LockToken value")
@@ -120,7 +111,7 @@ namespace Azure.Messaging.EventGrid {
120111
errorCode: string;
121112

122113
@doc("Description of the token error.")
123-
errorDescription: string;
114+
errorDescription: string;
124115
}
125116

126117
@doc("The result of the Publish operation.")
@@ -171,150 +162,133 @@ namespace Azure.Messaging.EventGrid {
171162
lockTokens: string[];
172163
}
173164

165+
// Publish Operation:
166+
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}:publish?api-version={apiVersion}}
167+
174168
@doc("Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ")
175-
@route(
176-
"/topics/{topicName}:publish",
177-
{
178-
shared: true,
179-
}
180-
)
181-
@post
182-
op PublishCloudEvent is Azure.Core.RpcOperation<
183-
{
184-
@doc("content type")
185-
@header("content-type")
186-
contentType: "application/cloudevents+json; charset=utf-8";
187-
188-
@doc("Topic Name.")
189-
@path
190-
topicName: string;
191-
192-
@doc("Single Cloud Event being published.")
193-
@body
194-
event: CloudEvent;
195-
},
196-
PublishResult
197-
>;
198-
199-
@doc("Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ")
200-
@route(
201-
"/topics/{topicName}:publish",
202-
{
203-
shared: true,
204-
}
205-
)
206-
@post
207-
op PublishCloudEvents is Azure.Core.RpcOperation<
208-
{
209-
@doc("content type")
210-
@header("content-type")
211-
contentType: "application/cloudevents-batch+json; charset=utf-8";
212-
213-
@doc("Topic Name.")
214-
@path
215-
topicName: string;
216-
217-
@doc("Array of Cloud Events being published.")
218-
@body
219-
events: CloudEvent[];
220-
},
221-
PublishResult
222-
>;
169+
@route("/topics/{topicName}:publish", {shared: true})
170+
@post op PublishCloudEvent is Azure.Core.RpcOperation<{
171+
@doc("content type")
172+
@header("content-type")
173+
contentType: "application/cloudevents+json; charset=utf-8";
174+
175+
@doc("Topic Name.")
176+
@path
177+
topicName: string;
178+
179+
@doc("Single Cloud Event being published.")
180+
@body
181+
event: CloudEvent;
182+
}, PublishResult>;
183+
184+
185+
@doc("Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ")
186+
@route("/topics/{topicName}:publish", {shared: true})
187+
@post op PublishCloudEvents is Azure.Core.RpcOperation<{
188+
@doc("content type")
189+
@header("content-type")
190+
contentType: "application/cloudevents-batch+json; charset=utf-8";
191+
192+
@doc("Topic Name.")
193+
@path
194+
topicName: string;
223195

196+
@doc("Array of Cloud Events being published.")
197+
@body
198+
events: CloudEvent[];
199+
}, PublishResult>;
200+
201+
// Receive Operation:
202+
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive?api-Version={apiVersion}&maxWaitTime=60&maxEvents={maxEvents}
203+
224204
@doc("Receive Batch of Cloud Events from the Event Subscription.")
225205
@route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive")
226-
@post
227-
op ReceiveCloudEvents is Azure.Core.RpcOperation<
228-
{
229-
@doc("Topic Name.")
230-
@path
231-
topicName: string;
232-
233-
@doc("Event Subscription Name.")
234-
@path
235-
eventSubscriptionName: string;
236-
237-
@doc("Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1.")
238-
@query
239-
maxEvents?: int32 = 1;
240-
241-
@doc("Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds.")
242-
@encode("seconds", int32)
243-
@query
244-
maxWaitTime?: duration;
245-
},
246-
ReceiveResult
247-
>;
206+
@post op ReceiveCloudEvents is Azure.Core.RpcOperation<{
207+
@doc("Topic Name.")
208+
@path
209+
topicName: string;
210+
211+
@doc("Event Subscription Name.")
212+
@path
213+
eventSubscriptionName: string;
214+
215+
@doc("Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1.")
216+
@query
217+
maxEvents?: int32 = 1;
218+
219+
@doc("Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds.")
220+
@encode("seconds", int32)
221+
@query
222+
maxWaitTime?: duration;
223+
}, ReceiveResult>;
224+
225+
// Acknowledge Operation:
226+
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge&apiVersion={apiVersion}
248227

249228
@doc("Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully acknowledged. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events will no longer be available to any consumer.")
250-
@route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge")
251-
@post
252-
op AcknowledgeCloudEvents is Azure.Core.RpcOperation<
253-
{
254-
@doc("content type")
255-
@header("content-type")
256-
contentType: "application/json; charset=utf-8";
257-
258-
@doc("Topic Name.")
259-
@path
260-
topicName: string;
261-
262-
@doc("Event Subscription Name.")
263-
@path
264-
eventSubscriptionName: string;
265-
266-
@doc("AcknowledgeOptions.")
267-
@body
268-
lockTokens: AcknowledgeOptions;
269-
},
270-
AcknowledgeResult
271-
>;
272229

230+
@route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge")
231+
@post op AcknowledgeCloudEvents is Azure.Core.RpcOperation<{
232+
@doc("content type")
233+
@header("content-type")
234+
contentType: "application/json; charset=utf-8";
235+
236+
@doc("Topic Name.")
237+
@path
238+
topicName: string;
239+
240+
@doc("Event Subscription Name.")
241+
@path
242+
eventSubscriptionName: string;
243+
244+
@doc("AcknowledgeOptions.")
245+
@body
246+
lockTokens: AcknowledgeOptions;
247+
}, AcknowledgeResult>;
248+
249+
// Release Operation:
250+
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}
251+
273252
@doc("Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.")
274253
@route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release")
275-
@post
276-
op ReleaseCloudEvents is Azure.Core.RpcOperation<
277-
{
278-
@doc("content type")
279-
@header("content-type")
280-
contentType: "application/json; charset=utf-8";
281-
282-
@doc("Topic Name.")
283-
@path
284-
topicName: string;
285-
286-
@doc("Event Subscription Name.")
287-
@path
288-
eventSubscriptionName: string;
289-
290-
@doc("ReleaseOptions")
291-
@body
292-
lockTokens: ReleaseOptions;
293-
},
294-
ReleaseResult
295-
>;
254+
@post op ReleaseCloudEvents is Azure.Core.RpcOperation<{
255+
@doc("content type")
256+
@header("content-type")
257+
contentType: "application/json; charset=utf-8";
258+
259+
@doc("Topic Name.")
260+
@path
261+
topicName: string;
262+
263+
@doc("Event Subscription Name.")
264+
@path
265+
eventSubscriptionName: string;
266+
267+
@doc("ReleaseOptions")
268+
@body
269+
lockTokens : ReleaseOptions;
270+
}, ReleaseResult>;
271+
272+
// Reject Operation:
273+
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion}
296274

297275
@doc("Reject batch of Cloud Events.")
298276
@route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject")
299-
@post
300-
op RejectCloudEvents is Azure.Core.RpcOperation<
301-
{
302-
@doc("content type")
303-
@header("content-type")
304-
contentType: "application/json; charset=utf-8";
305-
306-
@doc("Topic Name.")
307-
@path
308-
topicName: string;
309-
310-
@doc("Event Subscription Name.")
311-
@path
312-
eventSubscriptionName: string;
313-
314-
@doc("RejectOptions")
315-
@body
316-
lockTokens: RejectOptions;
317-
},
318-
RejectResult
319-
>;
277+
@post op RejectCloudEvents is Azure.Core.RpcOperation<{
278+
@doc("content type")
279+
@header("content-type")
280+
contentType: "application/json; charset=utf-8";
281+
282+
@doc("Topic Name.")
283+
@path
284+
topicName: string;
285+
286+
@doc("Event Subscription Name.")
287+
@path
288+
eventSubscriptionName: string;
289+
290+
@doc("RejectOptions")
291+
@body
292+
lockTokens : RejectOptions;
293+
}, RejectResult>;
320294
}

0 commit comments

Comments
 (0)