Skip to content

Commit

Permalink
specs, LRO, use pollingOperation to customize non-standard LRO (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Oct 13, 2023
1 parent 75b3945 commit 226169c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-tables-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": patch
---

Use pollingOperation to customize non-standard LRO
4 changes: 3 additions & 1 deletion packages/cadl-ranch-specs/cadl-ranch-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ Expected response body:

### Azure_Core_Lro_Rpc_Legacy_CreateResourcePollViaOperationLocation

- Endpoint: `post /azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location/jobs`
- Endpoints:
- `get /azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location`
- `get /azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location/jobs`

POST to create resource.
Poll URL via operation-location header in response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "@azure-tools/typespec-azure-core";
import "@azure-tools/cadl-ranch-expect";
import "@typespec/rest";
import "@typespec/versioning";
import "./util.tsp";

using TypeSpec.Rest;
using TypeSpec.Http;
Expand Down Expand Up @@ -138,10 +137,11 @@ Expected response body:
""")
@route("/create-resource-poll-via-operation-location")
interface CreateResourcePollViaOperationLocation {
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Legacy LRO uses local template"
#suppress "@azure-tools/typespec-azure-core/long-running-polling-operation-required" "Operation link pollingOperation is not required for getLroMetadata"
@doc("Poll a Job")
getJob is ResourceOperations.ResourceRead<JobResult>;

@pollingOperation(CreateResourcePollViaOperationLocation.getJob)
@doc("Creates a Job")
@route("/jobs")
@post
createJob is Local.LongRunningLegacyOperation<JobData, JobResult, JobResult>;
createJob is LongRunningRpcOperation<JobData, JobResult, JobResult>;
}
26 changes: 0 additions & 26 deletions packages/cadl-ranch-specs/http/azure/core/lro/rpc-legacy/util.tsp

This file was deleted.

0 comments on commit 226169c

Please sign in to comment.