Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"operationId": "AcknowledgeCloudEvents",
"title": "Acknowledge Cloud Event",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"eventSubscriptionName": "myEventSubscription",
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
},
"responses": {
"200": {
"body": {
"failedLockTokens": [
{
"lockToken": "CgMKATESCQoHdG9rZW4tMQ==",
"errorCode": "BadToken",
"errorDescription": ""
}
],
"succeededLockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"operationId": "PublishCloudEvents",
"title": "Publish Cloud Event",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"content-type": "application/cloudevents-batch+json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"events": [
{
"id": "b3ccc7e3-c1cb-49bf-b7c8-0d4e60980616",
"source": "/microsoft/autorest/examples/eventgrid/cloud-events/publish",
"specversion": "1.0",
"data": {
"Property1": "Value1",
"Property2": "Value2"
},
"type": "Microsoft.Contoso.TestEvent",
"time": "2023-05-04T23:06:09.147165Z"
}
]
},
"responses": {
"200": {
"body": {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"operationId": "ReceiveCloudEvents",
"title": "Receive Cloud Event",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"eventSubscriptionName": "myEventSubscription",
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"maxEvents": 1,
"maxWaitTime": 60
},
"responses": {
"200": {
"body": {
"value": [
{
"brokerProperties": {
"lockToken": "CgMKATESCQoHdG9rZW4tMQ==",
"deliveryCount": 1
},
"event": {
"specversion": "1.0",
"type": "demo-started",
"source": "/test",
"subject": "all-hands-0405",
"id": "e770f36b-381a-41db-8b2b-b7199daeb202",
"time": "2023-05-05T17:31:00Z",
"datacontenttype": "application/json",
"data": "test"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"operationId": "RejectCloudEvents",
"title": "Reject Cloud Event",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"eventSubscriptionName": "myEventSubscription",
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
},
"responses": {
"200": {
"body": {
"failedLockTokens": [],
"succeededLockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"operationId": "ReleaseCloudEvents",
"title": "Release Cloud Event with an optional delay.",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"eventSubscriptionName": "myEventSubscription",
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"delayInSeconds": 10,
"lockTokens": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
},
"responses": {
"200": {
"body": {
"failedLockTokens": [],
"succeededLockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"operationId": "RenewCloudEventLocks",
"title": "Renew lock for batch of Cloud Events",
"parameters": {
"endpoint": "myNamespaceName.westus-1.eventgrid.azure.net",
"topicName": "myTopic",
"eventSubscriptionName": "myEventSubscription",
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
},
"responses": {
"200": {
"body": {
"failedLockTokens": [],
"succeededLockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
}
}
}
}
99 changes: 79 additions & 20 deletions specification/eventgrid/Azure.Messaging.EventGrid/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ namespace EventGrid {
enum ServiceApiVersions {
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
v2023_06_01_preview: "2023-06-01-preview",

@useDependency(Azure.Core.Versions.v1_0_Preview_2)
v2023_09_01_preview: "2023-10-01-preview",
}

alias StandardOperations = Azure.Core.StandardResourceOperations;
Expand Down Expand Up @@ -78,7 +81,7 @@ namespace EventGrid {

@doc("Properties of the Event Broker operation.")
model BrokerProperties {
@doc("The token used to lock the event.")
@doc("The token of the lock on the event.")
lockToken: string;

@doc("The attempt count for delivering the event.")
Expand All @@ -100,63 +103,96 @@ namespace EventGrid {
value: ReceiveDetails[];
}

@doc("Failed LockToken information.")
@doc("Failed lock token information.")
model FailedLockToken {
@doc("LockToken value")
@doc("The lock token of an entry in the request.")
lockToken: string;

@doc("Error code related to the token. Example of such error codes are BadToken: which indicates the Token is not formatted correctly, TokenLost: which indicates that token is not found, and InternalServerError: For any internal server errors.")
@doc("Error code related to the lock token. Example of such error codes are TokenLost: which indicates that token is not found, and InternalServerError: For any internal server errors.")
errorCode: string;

@doc("Description of the token error.")
@doc("Description of the lock token error.")
errorDescription: string;
}

@doc("Supported delays for release operation.")
Comment thread
batrived marked this conversation as resolved.
enum ReleaseDelay {
@doc("Release the event after 0 seconds.")
Comment thread
l0lawrence marked this conversation as resolved.
ReleaseEventIn0Seconds: 0,

@doc("Release the event after 10 seconds.")
ReleaseEventIn10Seconds: 10,

@doc("Release the event after 60 seconds.")
ReleaseEventIn60Seconds: 60,

@doc("Release the event after 600 seconds.")
ReleaseEventIn600Seconds: 600,

@doc("Release the event after 3600 seconds.")
ReleaseEventIn3600Seconds: 3600,
}

@doc("The result of the Publish operation.")
model PublishResult {}

@doc("The result of the Acknowledge operation.")
model AcknowledgeResult {
@doc("Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description).")
@doc("Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description).")
failedLockTokens: FailedLockToken[];

@doc("Array of lock tokens values for the successfully acknowledged cloud events.")
@doc("Array of lock tokens for the successfully acknowledged cloud events.")
succeededLockTokens: string[];
}

@doc("The result of the Release operation.")
model ReleaseResult {
@doc("Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description).")
@doc("Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description).")
failedLockTokens: FailedLockToken[];

@doc("Array of lock tokens values for the successfully released cloud events.")
@doc("Array of lock tokens for the successfully released cloud events.")
succeededLockTokens: string[];
}

@doc("The result of the Reject operation.")
model RejectResult {
@doc("Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description).")
@doc("Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description).")
failedLockTokens: FailedLockToken[];

@doc("Array of lock tokens values for the successfully rejected cloud events.")
@doc("Array of lock tokens for the successfully rejected cloud events.")
succeededLockTokens: string[];
}

@doc("Array of lock token strings for the corresponding received Cloud Events to be released.")
@doc("The result of the RenewLock operation.")
model RenewCloudEventLocksResult {
@doc("Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description).")
failedLockTokens: FailedLockToken[];

@doc("Array of lock tokens for the successfully renewed locks.")
succeededLockTokens: string[];
Comment thread
batrived marked this conversation as resolved.
}

@doc("Array of lock tokens for the corresponding received Cloud Events to be released.")
model ReleaseOptions {
@doc("String array of lock tokens.")
@doc("Array of lock tokens.")
lockTokens: string[];
}

@doc("Array of lock token strings for the corresponding received Cloud Events to be acknowledged.")
@doc("Array of lock tokens for the corresponding received Cloud Events to be acknowledged.")
model AcknowledgeOptions {
@doc("String array of lock tokens.")
@doc("Array of lock tokens.")
lockTokens: string[];
}

@doc("Array of lock token strings for the corresponding received Cloud Events to be rejected.")
@doc("Array of lock tokens for the corresponding received Cloud Events to be rejected.")
model RejectOptions {
@doc("String array of lock tokens.")
@doc("Array of lock tokens.")
lockTokens: string[];
}

@doc("Array of lock tokens for the corresponding received Cloud Events to be renewed.")
model RenewLockOptions {
Comment thread
batrived marked this conversation as resolved.
@doc("Array of lock tokens.")
lockTokens: string[];
}

Expand Down Expand Up @@ -246,7 +282,7 @@ namespace EventGrid {
// Acknowledge Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge&apiVersion={apiVersion}

@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.")
@doc("Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. 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.")
@action("acknowledge")
op acknowledgeCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
Expand All @@ -265,7 +301,7 @@ namespace EventGrid {
// Release Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}

@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.")
@doc("Release batch of Cloud Events with an optional delay in seconds. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.")
@action("release")
op releaseCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
Expand All @@ -277,14 +313,18 @@ namespace EventGrid {
@doc("ReleaseOptions")
@body
lockTokens: ReleaseOptions;

@doc("Release cloud events with the specified delay in seconds.")
@query
delayInSeconds?: ReleaseDelay;
},
ReleaseResult
>;

// Reject Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion}

@doc("Reject batch of Cloud Events.")
@doc("Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information.")
@action("reject")
op rejectCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
Expand All @@ -299,4 +339,23 @@ namespace EventGrid {
},
RejectResult
>;

// RenewLock Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewlock?api-version={apiVersion}

@doc("Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error information.")
@action("renewlock")
op renewCloudEventLocks is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("content type")
@header("content-type")
contentType: "application/json";

@doc("RenewLockOptions")
@body
lockTokens: RenewLockOptions;
},
RenewCloudEventLocksResult
>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ options:
examples-directory: examples
omit-unreachable-types: true
output-file: EventGrid.json
emitter-output-dir: "{project-root}/../data-plane/Microsoft.EventGrid/preview/2023-06-01-preview"
emitter-output-dir: "{project-root}/../data-plane/Microsoft.EventGrid/preview/2023-10-01-preview"
Comment thread
lmazuel marked this conversation as resolved.
Outdated
"@azure-tools/typespec-python":
package-pprint-name: "\"Azure Event Grid\""
package-mode: "dataplane"
Expand Down
Loading