Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: feature
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Remove restrictions requiring Foundation.Resource in ArmResourceListByParent. This will allow using the template for non-standard resources / collection actions that return a list.
As part of the change, the response can now return any type. This will be specified in the response section using a new `ResourceListCustomResult<type>` model.
21 changes: 21 additions & 0 deletions docs/libraries/azure-resource-manager/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,27 @@ model Foo is TrackedResource<FooProperties> {
| ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| kind? | `string` | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. |

### `ResourceListCustomResult` {#Azure.ResourceManager.ResourceListCustomResult}

Paged response containing results

```typespec
model Azure.ResourceManager.ResourceListCustomResult<Result>
```

#### Template Parameters

| Name | Description |
| ------ | ----------------------------------------------------- |
| Result | The type of the values returned in the paged response |

#### Properties

| Name | Type | Description |
| --------- | ---------------- | ---------------------------------- |
| value | `Array<Element>` | The items on this page |
| nextLink? | `string` | The link to the next page of items |

### `ResourceListResult` {#Azure.ResourceManager.ResourceListResult}

Paged response containing resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager
- [`ResourceGroupLocationResource`](./data-types.md#Azure.ResourceManager.ResourceGroupLocationResource)
- [`ResourceInstanceParameters`](./data-types.md#Azure.ResourceManager.ResourceInstanceParameters)
- [`ResourceKindProperty`](./data-types.md#Azure.ResourceManager.ResourceKindProperty)
- [`ResourceListCustomResult`](./data-types.md#Azure.ResourceManager.ResourceListCustomResult)
- [`ResourceListResult`](./data-types.md#Azure.ResourceManager.ResourceListResult)
- [`ResourceNameParameter`](./data-types.md#Azure.ResourceManager.ResourceNameParameter)
- [`ResourceParentParameters`](./data-types.md#Azure.ResourceManager.ResourceParentParameters)
Expand Down
17 changes: 17 additions & 0 deletions packages/typespec-azure-resource-manager/lib/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,23 @@ model ResourceKindProperty {
@friendlyName("{name}ListResult", Resource)
model ResourceListResult<Resource extends Foundations.Resource> is Azure.Core.Page<Resource>;

/**
* Paged response containing results
* @template Result The type of the values returned in the paged response
*/
@doc("The custom response of a list operation.")
@friendlyName("{name}ListResult", Result)
@pagedResult
model ResourceListCustomResult<Result> {
/** The items on this page */
@items
value: Result[];

/** The link to the next page of items */
@nextLink
nextLink?: string;
}

#deprecated "`ResourcePlan` will be deprecated. Please use `ResourcePlanProperty` instead."
alias ResourcePlan = ResourcePlanProperty;
/**
Expand Down