Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Event Grid] Adding new public preview api version for new data-plane operations, release with delay and renew lock operations #25421

Merged
merged 20 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 9 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
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-06-01-preview",
"lockTokens": {
"acknowledgeOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand All @@ -20,8 +20,10 @@
"failedLockTokens": [
{
"lockToken": "CgMKATESCQoHdG9rZW4tMQ==",
"errorCode": "BadToken",
"errorDescription": ""
"error": {
"code": "BadToken",
"message": ""
}
}
],
"succeededLockTokens": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-06-01-preview",
"lockTokens": {
"rejectOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-06-01-preview",
"lockTokens": {
"releaseOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"acknowledgeOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand All @@ -20,8 +20,10 @@
"failedLockTokens": [
{
"lockToken": "CgMKATESCQoHdG9rZW4tMQ==",
"errorCode": "BadToken",
"errorDescription": ""
"error": {
"code": "BadToken",
"message": ""
}
}
],
"succeededLockTokens": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"rejectOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"delayInSeconds": 10,
"lockTokens": {
"releaseOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"content-type": "application/json",
"authorization": "SharedAccessKey 123",
"api-version": "2023-10-01-preview",
"lockTokens": {
"renewLockOptions": {
"lockTokens": [
"CgMKATESCQoHdG9rZW4tMQ=="
]
Expand Down
62 changes: 22 additions & 40 deletions specification/eventgrid/Azure.Messaging.EventGrid/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import "@azure-tools/typespec-azure-core";
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}:publish?api-version={apiVersion}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive?api-Version={apiVersion}&maxWaitTime=60&maxEvents={maxEvents}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge?api-Version={apiVersion}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}&releaseDelayInSeconds={delay}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion}
@server(
"{endpoint}",
Expand All @@ -43,14 +43,15 @@ namespace Microsoft.EventGrid {
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Foundations;
using Azure;

#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
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",
v2023_10_01_preview: "2023-10-01-preview",
}

alias StandardOperations = Azure.Core.StandardResourceOperations;
Expand Down Expand Up @@ -114,34 +115,31 @@ namespace Microsoft.EventGrid {
value: ReceiveDetails[];
}

@doc("Failed lock token information.")
@doc("Failed LockToken information.")
model FailedLockToken {
@doc("The lock token of an entry in the request.")
@doc("LockToken value")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That just reiterates the property name. It doesn't describe what the value is. Maybe expand on this more, at least for GA (not blocking)?

lockToken: string;

@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 lock token error.")
errorDescription: string;
@doc("Error information of the failed operation result for the lock token in the request.")
error: Azure.Core.Foundations.Error;
}

@doc("Supported delays for release operation.")
batrived marked this conversation as resolved.
Show resolved Hide resolved
enum ReleaseDelay {
enum Delay {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, but this will be too general for an SDK. ReleaseDelay was more specific and less likely to conflict.

@doc("Release the event after 0 seconds.")
l0lawrence marked this conversation as resolved.
Show resolved Hide resolved
ReleaseEventIn0Seconds: 0,
By0Seconds: 0,

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

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

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

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

@doc("The result of the Publish operation.")
Expand Down Expand Up @@ -298,36 +296,28 @@ namespace Microsoft.EventGrid {
op acknowledgeCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("content type")
@header("content-type")
contentType: "application/json";

@doc("AcknowledgeOptions.")
@body
lockTokens: AcknowledgeOptions;
acknowledgeOptions: AcknowledgeOptions;
},
AcknowledgeResult
>;

// Release Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion}&releaseDelayInSeconds={delay}

@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.")
@doc("Release 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 released lockTokens, along with other failed lockTokens with their corresponding error information.")
@action("release")
op releaseCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("content type")
@header("content-type")
contentType: "application/json";

@doc("ReleaseOptions")
@body
lockTokens: ReleaseOptions;
releaseOptions: ReleaseOptions;

@doc("Release cloud events with the specified delay in seconds.")
@query
delayInSeconds?: ReleaseDelay;
releaseDelayInSeconds?: Delay;
},
ReleaseResult
>;
Expand All @@ -340,32 +330,24 @@ namespace Microsoft.EventGrid {
op rejectCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("content type")
@header("content-type")
contentType: "application/json";

@doc("RejectOptions")
@body
lockTokens: RejectOptions;
rejectOptions: RejectOptions;
},
RejectResult
>;

// RenewLock Operation:
// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewlock?api-version={apiVersion}
// 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")
@action("renewLock")
op renewCloudEventLocks is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("content type")
@header("content-type")
contentType: "application/json";

@doc("RenewLockOptions")
@body
lockTokens: RenewLockOptions;
renewLockOptions: RenewLockOptions;
},
RenewCloudEventLocksResult
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ linter:
- "@azure-tools/typespec-azure-core/all"
options:
"@azure-tools/typespec-autorest":
azure-resource-provider-folder: "data-plane"
emitter-output-dir: "{project-root}/.."
examples-directory: examples
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/EventGrid.json"
omit-unreachable-types: true
output-file: EventGrid.json
emitter-output-dir: "{project-root}/../data-plane/Microsoft.EventGrid/preview/2023-10-01-preview"
output-file: "{azure-resource-provider-folder}/Microsoft.EventGrid/{version-status}/{version}/EventGrid.json"
azure-resource-provider-folder: "data-plane"
"@azure-tools/typespec-python":
package-pprint-name: "\"Azure Event Grid\""
package-version: 4.12.0b1
Expand Down
Loading
Loading