Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

specs, LRO, use pollingOperation to customize non-standard LRO #415

Merged
merged 8 commits into from
Oct 13, 2023
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 @@ -359,7 +359,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,12 @@ Expected response body:
""")
@route("/create-resource-poll-via-operation-location")
interface CreateResourcePollViaOperationLocation {
@doc("Poll a Job")
getJob is ResourceOperations.ResourceRead<JobResult>;

#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"
@pollingOperation(CreateResourcePollViaOperationLocation.getJob)
weidongxu-microsoft marked this conversation as resolved.
Show resolved Hide resolved
@doc("Creates a Job")
@route("/jobs")
@post
createJob is Local.LongRunningLegacyOperation<JobData, JobResult, JobResult>;
createJob is LongRunningRpcOperation<JobData, JobResult, JobResult>;
}

This file was deleted.