Skip to content

Commit de1ef06

Browse files
sarkar-rajarshiadamtuck-msftmarcma123cparisinetiwilliamzhao87
authored
[ACS][JobRouter] GA Version (#25763)
* jobrouter ga typespec initial commit * add x-ms-example * change unknown to object * fix consumes for upsert routes * fix naming validation error * remove x-ms-examples * unreferenced json file validation fix * change to using unknown * rename generated client to XXXXXRestClient * test generating convenience methods * add line * rebased * correctly represent uri * try out standard operations for classification policy * use standard ops wherever possible * try placing route decorator at namespace level * remove router decorator from namespace * update tspconfig * add conditional headers * use azure core etag * fix floats to doubles * update typespec-python options + regenerate rest specs * fix lint errors * add examples * ci fixes 2 * ci fixes 3 * remove reference to Azure.Core.Etag (throws lint error) * review feedback * added list query params * try codegen without url scalar * retry python emitter with url fix * try specifying python output directory * python emitter - change package-mode to azure-dataplane * remove @example decorator * remove redundant imports * fix examples * make ScheduleAndSuspendMode.ScheduleAt a required field * uri scalar add * clean up * Update JS sdk config to azure-rest * change JobMatchingMode polymorphic type * rename client remove Rest * rename acceptJob, declineJob to acceptJobOffer, declineJobOffer * test internal decorator * make all upsert methods internal * specify python package version * Make upsert methods internal * make status selectors internal for python * sdk feedback review items * more review feedback items * update examples * Add partial-update for java * try updating client.tsp to rename method for .NET * make ExceptionAction.Id optional * run prettier * fix more examples * minor doc update * Update projected names and internal modifier * Modify internal to only apply for java, csharp, python * Update internal * make upsert method visible for python * modify enums for python * revert * sdk review comment 3 * Test generator without endpoint * Revert change * manually add empty response schemas in swagger because of #25605 (comment) * add linter in tspconfig.yaml * add to custom words * doc updates * fix nextlink lint error * test changes in client.tsp for validation failures * run cleanup * Update java internal models * Remove projectedName annotations * more linter fixes * exception action make id not readonly since needs to be serialized * make methods for canceljon, complete job, close job and decline offer internal so as to not expose empty response objects * update azure-tools/typespec-ts emitter options * try update example for LintDiff errors * set nextLink value to null * Update unassignJob internal csharp * move out assignmentId to path * linter fixes * Revert unassign job changes * Add internal for unassign csharp * use standard ResourceAction for all action except closeJob * fix linters * close job should always return 200 * fix linter errors * Suppress violation ValidFormats in LintDiff * test method rename * try rename again * try again * try again * try again * set default values for min and maz concurrent offer * set default value of bypass selectors * try codegen removing @route decorator * clean up @route decorator * revert making unassign internal for csharp * try renaming completeJob to completeJobInternal for csharp * rename op cancel, close, complete, decline for csharp * Add "where" clause to ValidFormats suppression * redefine empty model differently * fix spelling of primitive * Suppress INVALID_TYPE caused by bug in ModelValidation - #25381 * add default and change empty model representation * Make unassign job internal * linter fixes * Update specification/communication/Communication.JobRouter/models.tsp Co-authored-by: Mike Kistler <[email protected]> * Update specification/communication/Communication.JobRouter/models.tsp Co-authored-by: Mike Kistler <[email protected]> * linter fixes --------- Co-authored-by: Adam Tuck <[email protected]> Co-authored-by: Marc Ma <[email protected]> Co-authored-by: Charandeep Parisineti <[email protected]> Co-authored-by: williamzhao87 <[email protected]> Co-authored-by: Mike Harder <[email protected]> Co-authored-by: Mike Kistler <[email protected]>
1 parent d686188 commit de1ef06

File tree

100 files changed

+10316
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10316
-1
lines changed

custom-words.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ continuationtoken
563563
continuousdataexports
564564
continuouswebjobs
565565
contoso
566+
Contoso's
566567
contosodataset
567568
contosomedia
568569
contributer
@@ -2944,6 +2945,7 @@ ulaanbaatar
29442945
unallocated
29452946
unarchive
29462947
unassign
2948+
unassigning
29472949
unassignment
29482950
unassigns
29492951
unattend
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/package.json
2+
**/package-lock.json
3+
**/.npmrc
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Azure Communication Job Router TypeSpec Specification
2+
3+
The TypeSpec and generated API specification for the Azure Communication Job Router.
4+
5+
## Development Environment
6+
7+
0. Change directory into the `specification\communication\Communication.JobRouter\` directory.
8+
9+
1. Install Node.js 16 LTS and ensure you are able to run the npm command in a command prompt:
10+
11+
```console
12+
npm --version
13+
```
14+
15+
2. Install Azure DevOps Auth helper for npm to pull the libraries from the secured feed
16+
17+
```console
18+
npm install -g vsts-npm-auth
19+
vsts-npm-auth -config .npmrc
20+
```
21+
22+
3. Install TypeSpec compiler and libraries:
23+
24+
```console
25+
npm install -g @typespec/compiler
26+
```
27+
28+
4. (Optional) Install the TypeSpec extension for your editor of choice:
29+
30+
- Visual Studio Code
31+
32+
``` console
33+
tsp code install
34+
```
35+
36+
- Visual Studio
37+
38+
``` console
39+
tsp vs install
40+
```
41+
42+
5. Install node package dependencies:
43+
44+
```console
45+
tsp install
46+
```
47+
48+
6. Compile TypeSpec to Swagger. This will update the files in the directory `..\data-plane\JobRouter\<version-status>\<api-version>\communicationservicejobrouter.json`:
49+
50+
```console
51+
npx tsp compile specification\communication\Communication.JobRouter
52+
```
53+
54+
7. To re-generate examples, download and install the [OAV
55+
tool](https://github.com/Azure/oav) and run it: note: This directory is taken
56+
from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs),
57+
and the following commands should be run from there.
58+
59+
```console
60+
npm install -g oav@latest
61+
oav generate-examples <path to communicationservicejobrouter.json>
62+
```
63+
64+
## Testing and Viewing API as an Interface
65+
66+
1. Visit the official [Swagger Editor](https://editor.swagger.io/).
67+
68+
2. Copy the generated Swagger from `communicationservicejobrouter.json` and paste it into the editor.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// client.tsp
2+
import "@azure-tools/typespec-client-generator-core";
3+
import "@typespec/versioning";
4+
5+
import "./main.tsp";
6+
7+
using Azure.ClientGenerator.Core;
8+
using TypeSpec.Versioning;
9+
10+
@useDependency(AzureCommunicationRoutingService.Versions.c2023_11_01)
11+
namespace ClientForAcsJobRouter;
12+
13+
// Your customizations here
14+
@client({
15+
name: "JobRouterAdministrationClient",
16+
service: AzureCommunicationRoutingService,
17+
})
18+
interface JobRouterAdministrationRestClient {
19+
@internal("csharp")
20+
@internal("java")
21+
upsertDistributionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.upsertDistributionPolicy;
22+
23+
getDistributionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getDistributionPolicy;
24+
25+
listDistributionPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listDistributionPolicies;
26+
27+
deleteDistributionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteDistributionPolicy;
28+
29+
@internal("csharp")
30+
@internal("java")
31+
upsertClassificationPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.upsertClassificationPolicy;
32+
33+
getClassificationPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getClassificationPolicy;
34+
35+
listClassificationPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listClassificationPolicies;
36+
37+
deleteClassificationPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteClassificationPolicy;
38+
39+
@internal("csharp")
40+
@internal("java")
41+
upsertExceptionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.upsertExceptionPolicy;
42+
43+
getExceptionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getExceptionPolicy;
44+
45+
listExceptionPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listExceptionPolicies;
46+
47+
deleteExceptionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteExceptionPolicy;
48+
49+
@internal("csharp")
50+
@internal("java")
51+
upsertQueue is AzureCommunicationRoutingService.JobRouterAdministrationOperations.upsertQueue;
52+
53+
getQueue is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getQueue;
54+
55+
listQueues is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listQueues;
56+
57+
deleteQueue is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteQueue;
58+
}
59+
60+
@client({
61+
name: "JobRouterClient",
62+
service: AzureCommunicationRoutingService,
63+
})
64+
interface JobRouterRestClient {
65+
@internal("csharp")
66+
@internal("java")
67+
upsertJob is AzureCommunicationRoutingService.JobRouterOperations.upsertJob;
68+
69+
getJob is AzureCommunicationRoutingService.JobRouterOperations.getJob;
70+
71+
deleteJob is AzureCommunicationRoutingService.JobRouterOperations.deleteJob;
72+
73+
@internal("csharp")
74+
@internal("python")
75+
@internal("java")
76+
reclassify is AzureCommunicationRoutingService.JobRouterOperations.reclassify;
77+
78+
@internal("csharp")
79+
@internal("python")
80+
@internal("java")
81+
cancel is AzureCommunicationRoutingService.JobRouterOperations.cancel;
82+
83+
@internal("csharp")
84+
@internal("python")
85+
@internal("java")
86+
complete is AzureCommunicationRoutingService.JobRouterOperations.complete;
87+
88+
@internal("csharp")
89+
@internal("python")
90+
@internal("java")
91+
close is AzureCommunicationRoutingService.JobRouterOperations.close;
92+
93+
listJobs is AzureCommunicationRoutingService.JobRouterOperations.listJobs;
94+
95+
#suppress "@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops" "Need to revist how to correctly define singletons https://github.com/Azure/azure-rest-api-specs/issues/25605#issuecomment-1736265997"
96+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Need to revist how to correctly define singletons https://github.com/Azure/azure-rest-api-specs/issues/25605#issuecomment-1736265997"
97+
getQueuePosition is AzureCommunicationRoutingService.JobRouterOperations.getInQueuePosition;
98+
99+
@internal("csharp")
100+
unassign is AzureCommunicationRoutingService.JobRouterOperations.unassign;
101+
102+
accept is AzureCommunicationRoutingService.JobRouterOperations.accept;
103+
104+
@internal("csharp")
105+
@internal("python")
106+
@internal("java")
107+
decline is AzureCommunicationRoutingService.JobRouterOperations.decline;
108+
109+
#suppress "@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops" "Need to revist how to correctly define singletons https://github.com/Azure/azure-rest-api-specs/issues/25605#issuecomment-1736265997"
110+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Need to revist how to correctly define singletons https://github.com/Azure/azure-rest-api-specs/issues/25605#issuecomment-1736265997"
111+
getQueueStatistics is AzureCommunicationRoutingService.JobRouterOperations.getQueueStatistics;
112+
113+
@internal("csharp")
114+
@internal("java")
115+
upsertWorker is AzureCommunicationRoutingService.JobRouterOperations.upsertWorker;
116+
117+
getWorker is AzureCommunicationRoutingService.JobRouterOperations.getWorker;
118+
119+
deleteWorker is AzureCommunicationRoutingService.JobRouterOperations.deleteWorker;
120+
121+
listWorkers is AzureCommunicationRoutingService.JobRouterOperations.listWorkers;
122+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"title": "Creates a Classification Policy",
3+
"operationId": "JobRouterAdministrationOperations_UpsertClassificationPolicy",
4+
"parameters": {
5+
"endpoint": "https://contoso.westus.communications.azure.com",
6+
"api-version": "2023-11-01",
7+
"classificationPolicyId": "90eb00c4-234e-4df7-a231-ef7895518384",
8+
"resource": {
9+
"name": "Main",
10+
"fallbackQueueId": "MainQueue",
11+
"queueSelectorAttachments": [
12+
{
13+
"kind": "conditional",
14+
"condition": {
15+
"kind": "expression-rule",
16+
"language": "powerFx",
17+
"expression": "1 = 1"
18+
},
19+
"queueSelectors": [
20+
{
21+
"key": "foo",
22+
"labelOperator": "equal",
23+
"value": "bar"
24+
}
25+
]
26+
}
27+
],
28+
"prioritizationRule": {
29+
"kind": "static-rule",
30+
"value": "2"
31+
}
32+
}
33+
},
34+
"responses": {
35+
"200": {
36+
"body": {
37+
"id": "90eb00c4-234e-4df7-a231-ef7895518384",
38+
"name": "Main",
39+
"fallbackQueueId": "MainQueue",
40+
"queueSelectorAttachments": [
41+
{
42+
"kind": "conditional",
43+
"condition": {
44+
"kind": "expression-rule",
45+
"language": "powerFx",
46+
"expression": "1 = 1"
47+
},
48+
"queueSelectors": [
49+
{
50+
"key": "foo",
51+
"labelOperator": "equal",
52+
"value": "bar"
53+
}
54+
]
55+
}
56+
],
57+
"prioritizationRule": {
58+
"kind": "static-rule",
59+
"value": "2"
60+
},
61+
"workerSelectorAttachments": [],
62+
"etag": "etag"
63+
}
64+
},
65+
"201": {
66+
"body": {
67+
"id": "90eb00c4-234e-4df7-a231-ef7895518384",
68+
"name": "Main",
69+
"fallbackQueueId": "MainQueue",
70+
"queueSelectorAttachments": [
71+
{
72+
"kind": "conditional",
73+
"condition": {
74+
"kind": "expression-rule",
75+
"language": "powerFx",
76+
"expression": "1 = 1"
77+
},
78+
"queueSelectors": [
79+
{
80+
"key": "foo",
81+
"labelOperator": "equal",
82+
"value": "bar"
83+
}
84+
]
85+
}
86+
],
87+
"prioritizationRule": {
88+
"kind": "static-rule",
89+
"value": "2"
90+
},
91+
"workerSelectorAttachments": [],
92+
"etag": "etag"
93+
}
94+
}
95+
}
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"title": "Delete a classification policy",
3+
"operationId": "JobRouterAdministrationOperations_DeleteClassificationPolicy",
4+
"parameters": {
5+
"endpoint": "https://contoso.westus.communications.azure.com",
6+
"api-version": "2023-11-01",
7+
"classificationPolicyId": "MainClassificationPolicy"
8+
},
9+
"responses": {
10+
"204": {}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"title": "Retrieves an existing classification policy by Id",
3+
"operationId": "JobRouterAdministrationOperations_GetClassificationPolicy",
4+
"parameters": {
5+
"endpoint": "https://contoso.westus.communications.azure.com",
6+
"api-version": "2023-11-01",
7+
"classificationPolicyId": "MainClassificationPolicy"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"id": "MainClassificationPolicy",
13+
"name": "Main",
14+
"fallbackQueueId": "MainQueue",
15+
"queueSelectorAttachments": [
16+
{
17+
"kind": "conditional",
18+
"condition": {
19+
"kind": "expression-rule",
20+
"language": "powerFx",
21+
"expression": "1 = 1"
22+
},
23+
"queueSelectors": [
24+
{
25+
"key": "foo",
26+
"labelOperator": "equal",
27+
"value": "bar"
28+
}
29+
]
30+
}
31+
],
32+
"prioritizationRule": {
33+
"kind": "static-rule",
34+
"value": "2"
35+
},
36+
"workerSelectorAttachments": [
37+
{
38+
"kind": "pass-through",
39+
"key": "language",
40+
"labelOperator": "equal"
41+
}
42+
],
43+
"etag": "etag"
44+
}
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)