Skip to content

Commit

Permalink
Updating ProvisioningState from enum to union (#521)
Browse files Browse the repository at this point in the history
1. Updated ARM lib default `ResourceProvisioningState` to union
2. Updated samples `enum ProvisioningState` to union
3. Updated @lroStatus to support nested union ProvisioningState
  • Loading branch information
allenjzhang authored Apr 17, 2024
1 parent 6a59458 commit 0162292
Show file tree
Hide file tree
Showing 19 changed files with 550 additions and 139 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: breaking
packages:
- "@azure-tools/typespec-azure-core"
- "@azure-tools/typespec-azure-resource-manager"
---

Switching ProvisioningState from enum to Open union
22 changes: 16 additions & 6 deletions docs/getstarted/azure-resource-manager/step05.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,22 @@ namespace Microsoft.ContosoProviderHub;
interface Operations extends Azure.ResourceManager.Operations {}
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
Provisioning,
Updating,
Deleting,
Accepted,
union ProvisioningState {
ResourceProvisioningState,
/** The resource is being provisioned. */
Provisioning: "Provisioning",
/** The resource is being updated. */
Updating: "Updating",
/** The resource is being deleted. */
Deleting: "Deleting",
/** The resource provisioning request has been accepted. */
Accepted: "Accepted",
string,
}
@doc("The properties of UserResource")
Expand Down
56 changes: 28 additions & 28 deletions docs/libraries/azure-resource-manager/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1074,65 +1074,65 @@ model Azure.ResourceManager.TrackedResource<Properties>
| ----------- | ------------ | ----------- |
| properties? | `Properties` | |

### `PrivateEndpointConnectionProvisioningState` {#Azure.ResourceManager.PrivateEndpointConnectionProvisioningState}
### `Versions` {#Azure.ResourceManager.Versions}

The provisioning state of the connection
Supported versions of Azure.ResourceManager building blocks.

```typespec
enum Azure.ResourceManager.PrivateEndpointConnectionProvisioningState
enum Azure.ResourceManager.Versions
```

### `PrivateEndpointServiceConnectionStatus` {#Azure.ResourceManager.PrivateEndpointServiceConnectionStatus}
### `InfrastructureEncryption` {#Azure.ResourceManager.InfrastructureEncryption}

The private endpoint connection status
(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled.

```typespec
enum Azure.ResourceManager.PrivateEndpointServiceConnectionStatus
union Azure.ResourceManager.InfrastructureEncryption
```

### `ResourceProvisioningState` {#Azure.ResourceManager.ResourceProvisioningState}
### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.KeyEncryptionKeyIdentity}

Standard terminal provisioning state of resource type. You can spread into your
custom provision state to avoid duplication and ensure consistency
The type of identity to use.

```typespec
enum Azure.ResourceManager.ResourceProvisioningState
union Azure.ResourceManager.KeyEncryptionKeyIdentity
```

#### Examples
### `PrivateEndpointConnectionProvisioningState` {#Azure.ResourceManager.PrivateEndpointConnectionProvisioningState}

The provisioning state of the connection

```typespec
enum FooProvisioningState {
...ResourceProvisioningState, // include standard provisioning states
starting,
started,
stopping,
stopped,
}
union Azure.ResourceManager.PrivateEndpointConnectionProvisioningState
```

### `Versions` {#Azure.ResourceManager.Versions}
### `PrivateEndpointServiceConnectionStatus` {#Azure.ResourceManager.PrivateEndpointServiceConnectionStatus}

Supported versions of Azure.ResourceManager building blocks.
The private endpoint connection status

```typespec
enum Azure.ResourceManager.Versions
union Azure.ResourceManager.PrivateEndpointServiceConnectionStatus
```

### `InfrastructureEncryption` {#Azure.ResourceManager.InfrastructureEncryption}
### `ResourceProvisioningState` {#Azure.ResourceManager.ResourceProvisioningState}

(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled.
Standard terminal provisioning state of resource type. You can include in your
custom provision state to avoid duplication and ensure consistency

```typespec
union Azure.ResourceManager.InfrastructureEncryption
union Azure.ResourceManager.ResourceProvisioningState
```

### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.KeyEncryptionKeyIdentity}

The type of identity to use.
#### Examples

```typespec
union Azure.ResourceManager.KeyEncryptionKeyIdentity
union FooProvisioningState {
ResourceProvisioningState, // include standard provisioning states
starting: "starting",
started: "started",
stopping: "stopping",
stopped: "stopped",
}
```

## Azure.ResourceManager.CommonTypes
Expand Down
14 changes: 8 additions & 6 deletions eng/feeds/arm-canonical/employee.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ model EmployeeProperties {

/** The resource provisioning state. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

/** The resource is being updated. */
Updating,
Updating: "Updating",

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
22 changes: 12 additions & 10 deletions eng/feeds/arm/employee.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ model EmployeeProperties {

/** The resource provisioning state. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

/** The resource is being updated. */
Updating,
/** The resource is updating */
Updating: "Updating",

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ model RoleAssignmentProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ model EmployeeProperties {

/** The provisioning state of a resource. */
@lroStatus
enum ProvisioningState {
...ResourceProvisioningState,
union ProvisioningState {
ResourceProvisioningState,

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

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

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

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

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
Expand Down
Loading

0 comments on commit 0162292

Please sign in to comment.