diff --git a/.chronus/changes/almend-AddMissingComponents-2024-8-5-9-51-50.md b/.chronus/changes/almend-AddMissingComponents-2024-8-5-9-51-50.md new file mode 100644 index 0000000000..e1b72a1a23 --- /dev/null +++ b/.chronus/changes/almend-AddMissingComponents-2024-8-5-9-51-50.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/typespec-azure-resource-manager" +--- + +Add mobo type to TypeSpec-Azure common types \ No newline at end of file diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 769f6b7d37..e1a1fbed2b 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -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) @@ -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 diff --git a/docs/libraries/azure-resource-manager/reference/index.mdx b/docs/libraries/azure-resource-manager/reference/index.mdx index 92c2232391..8fa442cd3c 100644 --- a/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/docs/libraries/azure-resource-manager/reference/index.mdx @@ -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) diff --git a/packages/samples/common-types/gen.ts b/packages/samples/common-types/gen.ts index 24dccbfb67..79e70d0716 100644 --- a/packages/samples/common-types/gen.ts +++ b/packages/samples/common-types/gen.ts @@ -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 diff --git a/packages/samples/common-types/openapi/v5/mobo.json b/packages/samples/common-types/openapi/v5/mobo.json new file mode 100644 index 0000000000..e52a0cb00c --- /dev/null +++ b/packages/samples/common-types/openapi/v5/mobo.json @@ -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" + } + } + } + } +} \ No newline at end of file diff --git a/packages/samples/common-types/src/mobo.tsp b/packages/samples/common-types/src/mobo.tsp new file mode 100644 index 0000000000..6001776671 --- /dev/null +++ b/packages/samples/common-types/src/mobo.tsp @@ -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"]); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp index da45362cca..4851f84985 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp @@ -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; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/mobo.tsp b/packages/typespec-azure-resource-manager/lib/common-types/mobo.tsp new file mode 100644 index 0000000000..03169cb224 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/mobo.tsp @@ -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; +}