Skip to content

Commit

Permalink
[ACS JobRouter][GA] Change discriminators to enum instead of string f…
Browse files Browse the repository at this point in the history
…or all polymorphic base class (#26658)

* change discriminators to enum instead of string

* Mark list methods as internal

* update examples

* update typespec-ts option

* update examples

* Suppress DISCRIMINATOR_NOT_REQUIRED and INVALID_DISCRIMINATOR_TYPE

* Update projected list method names for csharp

* Revert

* add missing package-dir in tspconfig

---------

Co-authored-by: williamzhao87 <[email protected]>
Co-authored-by: Mike Harder <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2023
1 parent 68dc5ca commit 752c7a5
Show file tree
Hide file tree
Showing 39 changed files with 529 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface JobRouterAdministrationRestClient {

getDistributionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getDistributionPolicy;

@access(Access.internal, "csharp")
listDistributionPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listDistributionPolicies;

deleteDistributionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteDistributionPolicy;
Expand All @@ -32,6 +33,7 @@ interface JobRouterAdministrationRestClient {

getClassificationPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getClassificationPolicy;

@access(Access.internal, "csharp")
listClassificationPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listClassificationPolicies;

deleteClassificationPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteClassificationPolicy;
Expand All @@ -42,6 +44,7 @@ interface JobRouterAdministrationRestClient {

getExceptionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getExceptionPolicy;

@access(Access.internal, "csharp")
listExceptionPolicies is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listExceptionPolicies;

deleteExceptionPolicy is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteExceptionPolicy;
Expand All @@ -52,6 +55,7 @@ interface JobRouterAdministrationRestClient {

getQueue is AzureCommunicationRoutingService.JobRouterAdministrationOperations.getQueue;

@access(Access.internal, "csharp")
listQueues is AzureCommunicationRoutingService.JobRouterAdministrationOperations.listQueues;

deleteQueue is AzureCommunicationRoutingService.JobRouterAdministrationOperations.deleteQueue;
Expand Down Expand Up @@ -90,6 +94,7 @@ interface JobRouterRestClient {
@access(Access.internal, "java")
close is AzureCommunicationRoutingService.JobRouterOperations.close;

@access(Access.internal, "csharp")
listJobs is AzureCommunicationRoutingService.JobRouterOperations.listJobs;

#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"
Expand Down Expand Up @@ -118,5 +123,6 @@ interface JobRouterRestClient {

deleteWorker is AzureCommunicationRoutingService.JobRouterOperations.deleteWorker;

@access(Access.internal, "csharp")
listWorkers is AzureCommunicationRoutingService.JobRouterOperations.listWorkers;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -26,7 +26,7 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
}
}
Expand All @@ -41,7 +41,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -55,7 +55,7 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [],
Expand All @@ -71,7 +71,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -85,7 +85,7 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -30,12 +30,12 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [
{
"kind": "pass-through",
"kind": "passThrough",
"key": "language",
"labelOperator": "equal"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
"fallbackQueueId": "MainQueue",
"queueSelectorAttachments": [
{
"kind": "rule-engine",
"kind": "ruleEngine",
"rule": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "If(job.Escalated = true, \"SecondaryQueue\", \"MainQueue\")"
}
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [],
Expand All @@ -37,16 +37,16 @@
"fallbackQueueId": "MainQueue",
"queueSelectorAttachments": [
{
"kind": "rule-engine",
"kind": "ruleEngine",
"rule": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "If(job.VIP = true, \"VIPQueue\", \"MainQueue\")"
}
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "1"
},
"workerSelectorAttachments": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -33,7 +33,7 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [],
Expand All @@ -49,7 +49,7 @@
{
"kind": "conditional",
"condition": {
"kind": "expression-rule",
"kind": "expression",
"language": "powerFx",
"expression": "1 = 1"
},
Expand All @@ -63,7 +63,7 @@
}
],
"prioritizationRule": {
"kind": "static-rule",
"kind": "static",
"value": "2"
},
"workerSelectorAttachments": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"distributionPolicyId": "d9033d56-659c-437a-b5b7-4f3b14301dd4",
"resource": {
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand All @@ -23,7 +23,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand All @@ -37,7 +37,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"name": "Secondary",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "round-robin",
"kind": "roundRobin",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 2,
"bypassSelectors": false
Expand All @@ -27,7 +27,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"distributionPolicyId": "d9033d56-659c-437a-b5b7-4f3b14301dd4",
"resource": {
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand All @@ -23,7 +23,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand All @@ -37,7 +37,7 @@
"name": "Main",
"offerExpiresAfterSeconds": 300,
"mode": {
"kind": "longest-idle",
"kind": "longestIdle",
"minConcurrentOffers": 1,
"maxConcurrentOffers": 5,
"bypassSelectors": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
],
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
}
}
Expand All @@ -36,7 +36,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand All @@ -62,7 +62,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand All @@ -41,7 +41,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 50
},
"actions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
],
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
}
}
Expand All @@ -36,7 +36,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand All @@ -62,7 +62,7 @@
{
"id": "MaxWaitTimeExceeded",
"trigger": {
"kind": "wait-time",
"kind": "waitTime",
"thresholdSeconds": 20
},
"actions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"labels": {},
"matchingMode": {
"kind": "queue-and-match"
"kind": "queueAndMatch"
}
}
},
Expand Down Expand Up @@ -48,7 +48,7 @@
"assignments": {},
"notes": [],
"matchingMode": {
"kind": "queue-and-match"
"kind": "queueAndMatch"
},
"etag": "etag"
}
Expand Down Expand Up @@ -77,7 +77,7 @@
"assignments": {},
"notes": [],
"matchingMode": {
"kind": "queue-and-match"
"kind": "queueAndMatch"
},
"etag": "etag"
}
Expand Down
Loading

0 comments on commit 752c7a5

Please sign in to comment.