Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add implementation of standard async operations
  • Loading branch information
markcowl committed Jun 25, 2025
commit 43683a99e0003bc88cfde0b953fcf4e8f624d1fc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { DecoratorContext, Model } from "@typespec/compiler";

/**
* `@builtInResource` marks a model as built-in to Azure ResourceManager
*
* @param target The model that is marked as built-in.
*/
export type BuiltInResourceDecorator = (context: DecoratorContext, target: Model) => void;

export type AzureResourceManagerExtensionPrivateDecorators = {
builtInResource: BuiltInResourceDecorator;
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ export type ArmResourceCollectionActionDecorator = (
*/
export type ArmProviderNameValueDecorator = (context: DecoratorContext, target: Operation) => void;

/**
* `@tenantResource` marks an Azure Resource Manager resource model as a Tenant resource/Root resource/Top-Level resource.
*
* Tenant resources have REST API paths like:
* `/provider/Microsoft.Contoso/FooResources`
*
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type)
*/
export type TenantResourceDecorator = (context: DecoratorContext, target: Model) => void;

/**
* This decorator is used on Azure Resource Manager resources that are not based on
* Azure.ResourceManager common types.
*
* @param propertiesType : The type of the resource properties.
*/
export type ArmVirtualResourceDecorator = (
context: DecoratorContext,
target: Model,
provider?: string,
) => void;

/**
* `@armProviderNamespace` sets the Azure Resource Manager provider name. It will default to use the
* Namespace element value unless an override value is specified.
Expand Down Expand Up @@ -88,16 +110,6 @@ export type SingletonDecorator = (
keyValue?: string | "default",
) => void;

/**
* `@tenantResource` marks an Azure Resource Manager resource model as a Tenant resource/Root resource/Top-Level resource.
*
* Tenant resources have REST API paths like:
* `/provider/Microsoft.Contoso/FooResources`
*
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type)
*/
export type TenantResourceDecorator = (context: DecoratorContext, target: Model) => void;

/**
* `@subscriptionResource` marks an Azure Resource Manager resource model as a subscription resource.
*
Expand Down Expand Up @@ -242,14 +254,6 @@ export type ArmCommonTypesVersionDecorator = (
version: string | EnumValue,
) => void;

/**
* This decorator is used on Azure Resource Manager resources that are not based on
* Azure.ResourceManager common types.
*
* @param propertiesType : The type of the resource properties.
*/
export type ArmVirtualResourceDecorator = (context: DecoratorContext, target: Model) => void;

/**
* This decorator sets the base type of the given resource.
*
Expand Down Expand Up @@ -283,11 +287,12 @@ export type IdentifiersDecorator = (
export type AzureResourceManagerDecorators = {
armResourceCollectionAction: ArmResourceCollectionActionDecorator;
armProviderNameValue: ArmProviderNameValueDecorator;
tenantResource: TenantResourceDecorator;
armVirtualResource: ArmVirtualResourceDecorator;
armProviderNamespace: ArmProviderNamespaceDecorator;
useLibraryNamespace: UseLibraryNamespaceDecorator;
armLibraryNamespace: ArmLibraryNamespaceDecorator;
singleton: SingletonDecorator;
tenantResource: TenantResourceDecorator;
subscriptionResource: SubscriptionResourceDecorator;
locationResource: LocationResourceDecorator;
resourceGroupResource: ResourceGroupResourceDecorator;
Expand All @@ -300,7 +305,6 @@ export type AzureResourceManagerDecorators = {
armResourceList: ArmResourceListDecorator;
armResourceOperations: ArmResourceOperationsDecorator;
armCommonTypesVersion: ArmCommonTypesVersionDecorator;
armVirtualResource: ArmVirtualResourceDecorator;
resourceBaseType: ResourceBaseTypeDecorator;
identifiers: IdentifiersDecorator;
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "./customer-managed-keys-ref.tsp";
import "./extended-location-ref.tsp";
import "./internal.tsp";
import "./commontypes.private.decorators.tsp";
import "./commontypes.extension.models.tsp";
import "./versions.tsp";
import "./mobo-ref.tsp";
import "./network-security-perimeter-ref.tsp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ using Http;
using Rest;
using Azure.Core;
using Azure.ResourceManager.Private;
using Azure.ResourceManager.Extension.Private;

namespace Azure.ResourceManager.Extension;
namespace Azure.ResourceManager.CommonTypes.Extension;

/** Represents an extension resource group */
@parentResource(Subscription)
@Private.builtInResource
model ResourceGroup is CommonTypes.ResourceGroupNameParameter;
@parentResource(SubscriptionTarget)
@builtInResource
model ResourceGroupTarget is ResourceGroupParameter;

@Private.builtInResource
model Subscription is CommonTypes.SubscriptionIdParameter;
@builtInResource
model SubscriptionTarget is SubscriptionIdParameter;

/** Represents a management group */
@tenantResource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "@azure-tools/typespec-azure-core";
import "./models.tsp";
import "./operations.tsp";
import "./parameters.tsp";
import "./private.decorators.tsp";
Expand Down
Loading