Skip to content

Commit

Permalink
Add visibility and optionality for provisioning state & linting rules (
Browse files Browse the repository at this point in the history
…#323)

Azure/typespec-azure-pr#2638

---------

Co-authored-by: Timothee Guerin <[email protected]>
  • Loading branch information
allenjzhang and timotheeguerin authored Mar 4, 2024
1 parent c032b71 commit b6c3bf2
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 148 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Adding `@visibility("read")` & optional linting rules linting rules for ARM `provisioningState`
6 changes: 3 additions & 3 deletions docs/libraries/azure-resource-manager/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ model FooProperties {

#### Properties

| Name | Type | Description |
| ----------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------- |
| provisioningState | [`ResourceProvisioningState`](./data-types.md#Azure.ResourceManager.ResourceProvisioningState) | The provisioning state of the resource. |
| Name | Type | Description |
| ------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------- |
| provisioningState? | [`ResourceProvisioningState`](./data-types.md#Azure.ResourceManager.ResourceProvisioningState) | The provisioning state of the resource. |

### `Encryption` {#Azure.ResourceManager.Encryption}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: arm-resource-provisioning-state
---

```text title=- Full name-
@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state
```

`ProvisioningState` property of ARM resource must be:

- optional
- readonly
- must at least contain `Succeeded`, `Canceled`, and `Canceled`

#### ❌ Incorrect

```tsp
model ResourceProperties {
provisioningState: ResourceProvisioningState;
}
```

#### ✅ Correct

```tsp
model ResourceProperties {
@visibility("read")
provisioningState?: ResourceProvisioningState;
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -1905,12 +1905,12 @@
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"flavor",
"provisioningState"
"flavor"
]
},
"Microsoft.OperationsTest.TestTrackedProperties2": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,13 @@
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"role",
"employeeType",
"provisioningState"
"employeeType"
]
},
"EmployeeType": {
Expand Down Expand Up @@ -588,10 +588,6 @@
"employeeType": {
"$ref": "#/definitions/EmployeeType",
"description": "The HR compensation type of the employee"
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,10 @@
"properties": {
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"provisioningState"
]
}
},
"MediumString": {
"type": "string",
Expand Down Expand Up @@ -749,15 +747,15 @@
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"organizationId",
"ssoUrl",
"offerDetail",
"userDetail",
"provisioningState"
"userDetail"
]
},
"OrganizationUpdate": {
Expand Down Expand Up @@ -788,10 +786,6 @@
"userDetail": {
"$ref": "#/definitions/UserDetailUpdate",
"description": "Subscriber details."
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,12 @@
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"userId",
"provisioningState"
"userId"
]
},
"PlayerDatabaseReference": {
Expand Down Expand Up @@ -788,10 +788,6 @@
"items": {
"$ref": "#/definitions/TitleReference"
}
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
}
}
},
Expand Down Expand Up @@ -851,12 +847,12 @@
},
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"parentDatabase",
"provisioningState"
"parentDatabase"
]
},
"TitleReference": {
Expand All @@ -882,20 +878,6 @@
"additionalProperties": {
"type": "string"
}
},
"properties": {
"$ref": "#/definitions/TitleUpdateProperties",
"x-ms-client-flatten": true
}
}
},
"TitleUpdateProperties": {
"type": "object",
"description": "The updatable properties of the Title.",
"properties": {
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2095,12 +2095,10 @@
"properties": {
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"provisioningState"
]
}
},
"SubAccountResource": {
"type": "object",
Expand Down Expand Up @@ -2216,12 +2214,10 @@
"properties": {
"provisioningState": {
"$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState",
"description": "The provisioning state of the resource."
"description": "The provisioning state of the resource.",
"readOnly": true
}
},
"required": [
"provisioningState"
]
}
},
"TagRuleResource": {
"type": "object",
Expand Down
Loading

0 comments on commit b6c3bf2

Please sign in to comment.