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

[EG] GA client.tsp updates #29208

Merged
merged 34 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a848baa
try this
l0lawrence May 21, 2024
2be2e10
ver
l0lawrence May 21, 2024
10ab804
update
l0lawrence May 21, 2024
2cb4010
details
l0lawrence May 21, 2024
e2e7c85
update
l0lawrence May 21, 2024
ec3f4bb
renew locks result rename
l0lawrence May 22, 2024
42600f0
add new version - testing
l0lawrence May 22, 2024
efbb564
remove diff
l0lawrence May 22, 2024
7db3bc3
ga version
l0lawrence May 22, 2024
f1e412b
update
l0lawrence May 22, 2024
ab893fd
try alias
l0lawrence May 23, 2024
0f01e1f
all operations mark as internal to allow for topic/sub customization
l0lawrence May 23, 2024
0766de4
remove
l0lawrence May 24, 2024
edb90a6
tsp format
l0lawrence May 24, 2024
5f0bb86
alias change
l0lawrence May 24, 2024
ff438b5
details
l0lawrence May 24, 2024
5d05aa8
Merge branch 'main' into ga_updates
l0lawrence May 27, 2024
a38eec0
changes
l0lawrence May 28, 2024
30924e4
Merge branch 'main' into ga_updates
l0lawrence May 28, 2024
3fc80c2
after merge required regen
l0lawrence May 28, 2024
5f6f259
nit
l0lawrence May 28, 2024
2daa386
try
l0lawrence May 28, 2024
c10e5d5
tsp format
l0lawrence May 28, 2024
3098514
edits off of lang
l0lawrence May 29, 2024
448cc9e
only python
l0lawrence May 29, 2024
4a1e8b3
Merge branch 'main' into ga_updates
l0lawrence May 29, 2024
b114b9d
nit
l0lawrence May 29, 2024
bad7e05
Fixing some names for Go, based on Go arch feedback.
Jun 1, 2024
1c475f2
One more rename
Jun 1, 2024
e2e15f6
Merge pull request #4 from richardpark-msft/ts-fix-client-naming-for-go
l0lawrence Jun 3, 2024
44fb711
Update specification/eventgrid/Azure.Messaging.EventGrid/client.tsp
l0lawrence Jun 3, 2024
b604142
fixing go diff
l0lawrence Jun 3, 2024
f9d9b82
update
l0lawrence Jun 3, 2024
8123be5
update internal
l0lawrence Jun 3, 2024
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
148 changes: 145 additions & 3 deletions specification/eventgrid/Azure.Messaging.EventGrid/client.tsp
Original file line number Diff line number Diff line change
@@ -1,8 +1,150 @@
import "@azure-tools/typespec-client-generator-core";
import "./main.tsp";
import "@typespec/versioning";

using Azure.ClientGenerator.Core;
using Microsoft.EventGrid;

@@access(Microsoft.EventGrid.publishCloudEvent, Access.internal, "python");
@@access(Microsoft.EventGrid.publishCloudEvents, Access.internal, "python");
@@access(Microsoft.EventGrid.receiveCloudEvents, Access.internal, "python");
@TypeSpec.Versioning.useDependency(ServiceApiVersions.v2024_06_01)
namespace Customizations {
@client(
{
name: "EventGridPublisherClient",
service: Microsoft.EventGrid,
},
"python"
)
interface Client1 {
send is publishCloudEvent;
sendEvents is publishCloudEvents;
}

@client(
{
name: "EventGridConsumerClient",
service: Microsoft.EventGrid,
},
"python"
)
interface Client2 {
receive is receiveCloudEvents;
acknowledge is acknowledgeCloudEvents;
release is releaseCloudEvents;
reject is rejectCloudEvents;
renewLock is renewCloudEventLocks;
}

@client(
{
name: "EventGridSenderClient",
service: Microsoft.EventGrid,
},
"csharp"
)
interface ClientSender {
send is publishCloudEvent;
sendEvents is publishCloudEvents;
}

@client(
{
name: "EventGridReceiverClient",
service: Microsoft.EventGrid,
},
"csharp"
)
interface ClientReceiver {
receive is receiveCloudEvents;
acknowledge is acknowledgeCloudEvents;
release is releaseCloudEvents;
reject is rejectCloudEvents;
renewLock is renewCloudEventLocks;
}

@client(
{
name: "EventGridSenderClient",
service: Microsoft.EventGrid,
},
"java"
)
interface ClientSender2 {
send is publishCloudEvent;
sendEvents is publishCloudEvents;
}

@client(
{
name: "EventGridReceiverClient",
service: Microsoft.EventGrid,
},
"java"
)
interface ClientReceiver2 {
receive is receiveCloudEvents;
acknowledge is acknowledgeCloudEvents;
release is releaseCloudEvents;
reject is rejectCloudEvents;
renewLock is renewCloudEventLocks;
}

@client(
{
name: "SenderClient",
service: Microsoft.EventGrid,
},
"go"
)
interface ClientSenderGo {
sendEvent is publishCloudEvent;
sendEvents is publishCloudEvents;
}

@client(
{
name: "ReceiverClient",
service: Microsoft.EventGrid,
},
"go"
)
interface ClientReceiverGo {
receiveEvents is receiveCloudEvents;
acknowledgeEvents is acknowledgeCloudEvents;
releaseEvents is releaseCloudEvents;
rejectEvents is rejectCloudEvents;
renewEventLocks is renewCloudEventLocks;
}
}

// All Language customizations

// publishCloudEvent access level
@@access(publishCloudEvent, Access.public, "go"); // making public for Go, it's a simpler fix on the backend than generating it as internal
@@access(publishCloudEvent, Access.internal);

// publishCloudEvents access level
@@access(publishCloudEvents, Access.public, "go"); // making public for Go, it's a simpler fix on the backend than generating it as internal
@@access(publishCloudEvent, Access.internal);
l0lawrence marked this conversation as resolved.
Show resolved Hide resolved

@@access(receiveCloudEvents, Access.internal, "python");
@@access(acknowledgeCloudEvents, Access.internal, "python");
@@access(releaseCloudEvents, Access.internal, "python");
@@access(rejectCloudEvents, Access.internal, "python");
@@access(renewCloudEventLocks, Access.internal, "python");

@@access(AcknowledgeResult, Access.public);
@@access(ReleaseResult, Access.public);
@@access(RejectResult, Access.public);
@@access(RenewCloudEventLocksResult, Access.public);
@@access(ReleaseDelay, Access.public);
@@access(FailedLockToken, Access.public);

@@clientName(ReleaseDelay.By0Seconds, "NoDelay");
@@clientName(ReleaseDelay.By10Seconds, "TenSeconds");
@@clientName(ReleaseDelay.By3600Seconds, "OneHour");
@@clientName(ReleaseDelay.By600Seconds, "TenMinutes");
@@clientName(ReleaseDelay.By60Seconds, "OneMinute");

@@clientName(RenewCloudEventLocksResult, "RenewLocksResult");

@@clientName(ReceiveResult.value, "details");
36 changes: 12 additions & 24 deletions specification/eventgrid/Azure.Messaging.EventGrid/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -189,29 +189,25 @@ namespace Microsoft.EventGrid {
succeededLockTokens: string[];
}

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

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

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

@doc("Array of lock tokens for the corresponding received Cloud Events to be renewed.")
model RenewLockOptions {
alias RenewLockOptions = {
@doc("Array of lock tokens.")
lockTokens: string[];
}
};

@doc("Topic Resource.")
@resource("topics")
Expand Down Expand Up @@ -304,9 +300,7 @@ namespace Microsoft.EventGrid {
op acknowledgeCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("AcknowledgeOptions.")
@bodyRoot
acknowledgeOptions: AcknowledgeOptions;
...AcknowledgeOptions;
},
AcknowledgeResult
>;
Expand All @@ -319,9 +313,7 @@ namespace Microsoft.EventGrid {
op releaseCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("ReleaseOptions")
@bodyRoot
releaseOptions: ReleaseOptions;
...ReleaseOptions;

@added(ServiceApiVersions.v2023_10_01_preview)
@removed(ServiceApiVersions.v2023_11_01)
Expand All @@ -341,9 +333,7 @@ namespace Microsoft.EventGrid {
op rejectCloudEvents is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("RejectOptions")
@bodyRoot
rejectOptions: RejectOptions;
...RejectOptions;
},
RejectResult
>;
Expand All @@ -358,9 +348,7 @@ namespace Microsoft.EventGrid {
op renewCloudEventLocks is StandardOperations.ResourceAction<
EventSubscription,
{
@doc("RenewLockOptions")
@bodyRoot
renewLockOptions: RenewLockOptions;
...RenewLockOptions;
},
RenewCloudEventLocksResult
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,23 @@
"type": "string"
},
{
"name": "acknowledgeOptions",
"name": "body",
"in": "body",
"description": "AcknowledgeOptions.",
"required": true,
"schema": {
"$ref": "#/definitions/AcknowledgeOptions"
"type": "object",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
}
}
],
Expand Down Expand Up @@ -254,12 +265,23 @@
"type": "string"
},
{
"name": "releaseOptions",
"name": "body",
"in": "body",
"description": "ReleaseOptions",
"required": true,
"schema": {
"$ref": "#/definitions/ReleaseOptions"
"type": "object",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
}
}
],
Expand Down Expand Up @@ -313,12 +335,23 @@
"type": "string"
},
{
"name": "rejectOptions",
"name": "body",
"in": "body",
"description": "RejectOptions",
"required": true,
"schema": {
"$ref": "#/definitions/RejectOptions"
"type": "object",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
}
}
],
Expand Down Expand Up @@ -411,22 +444,6 @@
}
},
"definitions": {
"AcknowledgeOptions": {
"type": "object",
"description": "Array of lock tokens for the corresponding received Cloud Events to be acknowledged.",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
},
"AcknowledgeResult": {
"type": "object",
"description": "The result of the Acknowledge operation.",
Expand Down Expand Up @@ -642,22 +659,6 @@
"value"
]
},
"RejectOptions": {
"type": "object",
"description": "Array of lock tokens for the corresponding received Cloud Events to be rejected.",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
},
"RejectResult": {
"type": "object",
"description": "The result of the Reject operation.",
Expand All @@ -683,22 +684,6 @@
"succeededLockTokens"
]
},
"ReleaseOptions": {
"type": "object",
"description": "Array of lock tokens for the corresponding received Cloud Events to be released.",
"properties": {
"lockTokens": {
"type": "array",
"description": "Array of lock tokens.",
"items": {
"type": "string"
}
}
},
"required": [
"lockTokens"
]
},
"ReleaseResult": {
"type": "object",
"description": "The result of the Release operation.",
Expand Down
Loading