Skip to content

Commit

Permalink
Add mobo to TypeSpec-Azure common types (#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlitzelMendez authored Sep 6, 2024
1 parent cc0ac4f commit 2d7c279
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Add mobo type to TypeSpec-Azure common types
28 changes: 28 additions & 0 deletions docs/libraries/azure-resource-manager/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,20 @@ model Azure.ResourceManager.CommonTypes.LocationResourceParameter
| -------- | -------------------- | ----------------------------- |
| location | `Core.azureLocation` | The name of the Azure region. |

### `ManagedOnBehalfOfConfiguration` {#Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration}

Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider manages those resources on behalf of the resource owner.

```typespec
model Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration
```

#### Properties

| Name | Type | Description |
| -------------------- | -------------------------------------------------- | ------------------------------------- |
| moboBrokerResources? | `ResourceManager.CommonTypes.MoboBrokerResource[]` | Managed-On-Behalf-Of broker resources |

### `ManagedServiceIdentity` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity}

Managed service identity (system assigned and/or user assigned identities)
Expand Down Expand Up @@ -1258,6 +1272,20 @@ model Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter
| ------------------- | -------- | --------------------------------------------------------------- |
| managementGroupName | `string` | The name of the management group. The name is case insensitive. |

### `MoboBrokerResource` {#Azure.ResourceManager.CommonTypes.MoboBrokerResource}

Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on behalf of the user.

```typespec
model Azure.ResourceManager.CommonTypes.MoboBrokerResource
```

#### Properties

| Name | Type | Description |
| ---- | ---------------------------- | ------------------------------------------------------------- |
| id? | `Core.armResourceIdentifier` | Resource identifier of a Managed-On-Behalf-Of broker resource |

### `Operation` {#Azure.ResourceManager.CommonTypes.Operation}

Details of a REST API operation, returned from the Resource Provider Operations API
Expand Down
2 changes: 2 additions & 0 deletions docs/libraries/azure-resource-manager/reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager
- [`LocationData`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationData)
- [`LocationParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationParameter)
- [`LocationResourceParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationResourceParameter)
- [`ManagedOnBehalfOfConfiguration`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration)
- [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity)
- [`ManagementGroupNameParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter)
- [`MoboBrokerResource`](./data-types.md#Azure.ResourceManager.CommonTypes.MoboBrokerResource)
- [`Operation`](./data-types.md#Azure.ResourceManager.CommonTypes.Operation)
- [`OperationDisplay`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationDisplay)
- [`OperationIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationIdParameter)
Expand Down
1 change: 1 addition & 0 deletions packages/samples/common-types/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ await emitCommonTypesSwagger("customer-managed-keys");
await emitCommonTypesSwagger("managed-identity");
await emitCommonTypesSwagger("private-links");
await emitCommonTypesSwagger("types");
await emitCommonTypesSwagger("mobo");

function log(...args: any[]) {
// eslint-disable-next-line no-console
Expand Down
38 changes: 38 additions & 0 deletions packages/samples/common-types/openapi/v5/mobo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"swagger": "2.0",
"info": {
"title": "Common types",
"version": "v5"
},
"paths": {},
"definitions": {
"ManagedOnBehalfOfConfiguration": {
"type": "object",
"description": "Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider manages those resources on behalf of the resource owner.",
"properties": {
"moboBrokerResources": {
"type": "array",
"description": "Managed-On-Behalf-Of broker resources",
"items": {
"$ref": "#/definitions/MoboBrokerResource"
},
"readOnly": true,
"x-ms-identifiers": [
"id"
]
}
}
},
"MoboBrokerResource": {
"type": "object",
"description": "Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on behalf of the user.",
"properties": {
"id": {
"type": "string",
"format": "arm-id",
"description": "Resource identifier of a Managed-On-Behalf-Of broker resource"
}
}
}
}
}
9 changes: 9 additions & 0 deletions packages/samples/common-types/src/mobo.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./base.tsp";

import "../../node_modules/@azure-tools/typespec-azure-resource-manager/lib/common-types/mobo.tsp";

using OpenAPI;

namespace Azure.ResourceManager.CommonTypes;

@@extension(ManagedOnBehalfOfConfiguration.moboBrokerResources, "x-ms-identifiers", ["id"]);
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ import "./extended-location-ref.tsp";
import "./internal.tsp";
import "./commontypes.private.decorators.tsp";
import "./versions.tsp";
import "./mobo.tsp";

namespace Azure.ResourceManager.CommonTypes;
19 changes: 19 additions & 0 deletions packages/typespec-azure-resource-manager/lib/common-types/mobo.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Azure.Core;
using TypeSpec.Versioning;

namespace Azure.ResourceManager.CommonTypes;

/** Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider manages those resources on behalf of the resource owner. */
@added(Versions.v5)
model ManagedOnBehalfOfConfiguration {
/** Managed-On-Behalf-Of broker resources */
@visibility("read")
moboBrokerResources?: MoboBrokerResource[];
}

/** Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on behalf of the user. */
@added(Versions.v5)
model MoboBrokerResource {
/** Resource identifier of a Managed-On-Behalf-Of broker resource */
id?: Azure.Core.armResourceIdentifier;
}

0 comments on commit 2d7c279

Please sign in to comment.