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

Update docs to reference union instead of unions #706

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 23 additions & 5 deletions docs/howtos/ARM/resource-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,29 @@ model EmployeeResource is TrackedResource<EmployeeProperties> {
name: string;
}

enum EmployeeProvisioningState {
Creating,
GeneratingId,
...ResourceProvisioningState,
Deleting,
union EmployeeProvisioningState {
string,

/** The resource create request has been accepted */
Accepted: "Accepted",

/** The resource is being provisioned */
Provisioning: "Provisioning",

/** The resource is updating */
Updating: "Updating",

/** Resource has been created. */
Succeeded: "Succeeded",

/** Resource creation failed. */
Failed: "Failed",

/** Resource creation was canceled. */
Canceled: "Canceled",

/** The resource is being deleted */
Deleting: "Deleting",
}

@minValue(50)
Expand Down
64 changes: 35 additions & 29 deletions docs/howtos/Azure Core/long-running-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ A StatusMonitor provides information that drives client polling until an operati

| Decorator | Value |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `@lroStatus` | A decorator marking the field of the StatusMonitor that contains status information. This field should use an `enum` type to specify terminal status values. |
| `@lroStatus` | A decorator marking the field of the StatusMonitor that contains status information. This field should use a `union` type to specify terminal status values. |
| `@lroResult` | A decorator marking the property of the Status monitor that contains the result of the operation, when the operation completes successfully. By default, any field named 'result' in a StatusMonitor is assumed to contain the result of a successful operation. |
| `@lroErrorResult` | A decorator marking the property of the Status monitor that contains errors when the operation is unsuccessful. By default, any field named 'error' in a StatusMonitor is assumed to contain the result of a successful operation. |
| `@lroSucceeded` | If a status monitor uses a value other than `Succeeded` to indicate operation termination with success, then the enum value corresponding to successful completion should be decorated with this decorator. |
| `@lroCanceled` | If a status monitor uses a value other than `Canceled` to indicate that the operation was cancelled, then the enum value corresponding to cancellation should be decorated with this decorator. |
| `@lroFailed` | If a status monitor uses a value other than `Failed` to indicate operation termination with failure, then the enum value corresponding to operation failure should be decorated with this decorator. |
| `@lroSucceeded` | If a status monitor uses a value other than `Succeeded` to indicate operation termination with success, then the variant corresponding to successful completion should be decorated with this decorator. |
| `@lroCanceled` | If a status monitor uses a value other than `Canceled` to indicate that the operation was cancelled, then the variant corresponding to cancellation should be decorated with this decorator. |
| `@lroFailed` | If a status monitor uses a value other than `Failed` to indicate operation termination with failure, then the variant corresponding to operation failure should be decorated with this decorator. |
| `@pollingOperationParameter` | Indicates which request parameters or response properties of an operation can be used to call the operation that retrieves lro status (Status Monitor). Each application of the decorator may reference or name the corresponding parameter in the `getStatus` operation. |

### Examples of common (non-standard) Lro Patterns
Expand All @@ -133,17 +133,19 @@ In this example, the Status Monitor terminal properties for "Succeeded", "Failed

```tsp
@lroStatus
enum OperationStatus {
Running,
union OperationStatus {
Running: "Running",

@lroSucceeded
Completed,
Completed: "Completed",

@lroCanceled
Aborted,
Aborted: "Aborted",

@lroFailed
Faulted,
Faulted: "Faulted",

string,
}

model StatusMonitor {
Expand Down Expand Up @@ -249,11 +251,12 @@ In this example, the operation returns a `location` header with a link to the St

```tsp
@lroStatus
enum OperationStatus {
Running,
Succeeded,
Canceled,
Failed,
union OperationStatus {
Running: "Running",
Succeeded: "Succeeded",
Canceled: "Canceled",
Failed: "Failed",
string,
}

model StatusMonitor {
Expand Down Expand Up @@ -316,11 +319,12 @@ In this example, the operation returns a `Azure-AsyncOperation` header with a li

```tsp
@lroStatus
enum OperationStatus {
Running,
Succeeded,
Canceled,
Failed,
union OperationStatus {
Running: "Running",
Succeeded: "Succeeded",
Canceled: "Canceled",
Failed: "Failed",
string,
}

model StatusMonitor {
Expand Down Expand Up @@ -384,11 +388,12 @@ In this example, the operation returns a link to the Status Monitor (in `Azure-A

```tsp
@lroStatus
enum OperationStatus {
Running,
Succeeded,
Canceled,
Failed,
union OperationStatus {
Running: "Running",
Succeeded: "Succeeded",
Canceled: "Canceled",
Failed: "Failed",
string,
}

model StatusMonitor {
Expand Down Expand Up @@ -464,11 +469,12 @@ In this example, the operation does not return a link, instead, the request para

```tsp
@lroStatus
enum OperationStatus {
Running,
Succeeded,
Canceled,
Failed,
union OperationStatus {
Running: "Running",
Succeeded: "Succeeded",
Canceled: "Canceled",
Failed: "Failed",
string,
}

model StatusMonitor {
Expand Down
Loading