UNPKG

@azure-tools/typespec-azure-resource-manager

Version:

TypeSpec Azure Resource Manager library

177 lines 9.91 kB
import type { DecoratorContext, Interface, Model, ModelProperty, Operation, Scalar, Type } from "@typespec/compiler"; /** * * * * @param values Values */ export type ResourceParameterBaseForDecorator = (context: DecoratorContext, target: ModelProperty, values: Type) => void; /** * * * * @param propertyName Name of the property to omit */ export type ResourceBaseParametersOfDecorator = (context: DecoratorContext, target: Model, propertyName: Model) => void; /** * * * * @param resource Resource model */ export type AssignProviderNameValueDecorator = (context: DecoratorContext, target: ModelProperty, resource: Model) => void; /** * This decorator is used to identify Azure Resource Manager resource. In generated * swagger definition, it will be marked with `x-ms-azure-resource`. * * It is *not* meant to be used directly by a spec author, */ export type AzureResourceBaseDecorator = (context: DecoratorContext, target: Model) => void; /** * Update the Azure Resource Manager provider namespace for a given entity. */ export type ArmUpdateProviderNamespaceDecorator = (context: DecoratorContext, target: Operation) => void; /** * * * * @param resource Resource model */ export type AssignUniqueProviderNameValueDecorator = (context: DecoratorContext, target: ModelProperty, resource: Model) => void; /** * This decorator is used to identify Azure Resource Manager resource types and extract their * metadata. It is *not* meant to be used directly by a spec author, it instead * gets implicitly applied when the spec author defines a model type in this form: * * `model Server is TrackedResource<ServerProperties>;` * * The `TrackedResource<Resource>` type (and other associated base types) use the * `@armResource` decorator, so it also gets applied to the type which absorbs the * `TrackedResource<Resource>` definition by using the `is` keyword. * * @param properties Azure Resource Manager resource properties */ export type ArmResourceInternalDecorator = (context: DecoratorContext, target: Model, properties: Model) => void; /** * This decorator identifies Azure Resource Manager resource types that do not define * the name identifier parameter and type * * @param target Azure Resource Manager resource type * @param properties Azure Resource Manager resource properties * @param type The resource type name, e.g. "virtualMachines" * @param nameParameter The name of the resource name parameter, e.g. "virtualMachineName" */ export type ArmResourceWithParameterDecorator = (context: DecoratorContext, target: Model, properties: Model, type: string, nameParameter: string) => void; /** * Provides default name decoration on resource name property with * camelcased and pluralized key and segment name */ export type DefaultResourceKeySegmentNameDecorator = (context: DecoratorContext, target: ModelProperty, armResource: Model, keyName: string, segment: string) => void; /** * Provides strict contraint type check. * * Due to TypeSpec language and all optional properties of `Foundations.Resource`, * the `Resource extends Foundations.SimpleResource` on many of the standard ARM templates is * essentially equal to `Resource extends {}` and does not enforce the containt. * * Note, this is intended for internal use only for now. */ export type EnforceConstraintDecorator = (context: DecoratorContext, target: Operation | Model, sourceType: Model, constraintType: Model) => void; /** * Marks the operation as being a collection action * * @param resourceType Resource * @param parentTypeName : Parent type name. * @param parentFriendlyTypeName Friendly name for parent. * @param applyOperationRename If true, apply both doc and operation name update */ export type ArmRenameListByOperationDecorator = (context: DecoratorContext, target: Operation, resourceType: Model, parentTypeName?: string, parentFriendlyTypeName?: string, applyOperationRename?: boolean) => void; /** * Please DO NOT USE in RestAPI specs. * This decorator is used to adjust optionality on ARM Resource's `properties` field for brownfield service conversion. */ export type ArmResourcePropertiesOptionalityDecorator = (context: DecoratorContext, target: ModelProperty, isOptional: boolean) => void; /** * designates a parameter as an explicit bodyRoot and sets the optionality of the parameter */ export type ArmBodyRootDecorator = (context: DecoratorContext, target: ModelProperty, isOptional: boolean) => void; /** * designates a type as a legacy type and emits a warning diagnostic when used */ export type LegacyTypeDecorator = (context: DecoratorContext, target: Model | Operation | Interface | Scalar) => void; /** * Determines the built-in parent of a base resource * * @param parentType The parent type of the resource (Subscription, ResourceGroup, Tenant, Extension) */ export type ResourceParentTypeDecorator = (context: DecoratorContext, target: Model, parentType: "Subscription" | "ResourceGroup" | "Tenant" | "Extension") => void; /** * Marks a resource operation with the associated resource, operation type, and name. If no name is provided, the name is calculated by resource type. * * @param target The operation to associate the resourceType with * @param resourceType The resource model * @param operationType The type of operation being performed * @param resourceName Optional. The name of the resource. If not provided, the resource type will be used */ export type LegacyResourceOperationDecorator = (context: DecoratorContext, target: Operation, resourceType: Model, operationType: "read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence", resourceName?: string) => void; /** * Marks an extension resource operation with the associated resource, operation type, and name. If no name is provided, the name is calculated by resource type. * * @param target The operation to associate the resourceType with * @param targetResourceType The resource model for the target resource * @param extensionResourceType The resource model for the extension resource * @param operationType The type of operation being performed * @param resourceName Optional. The name of the resource. If not provided, the scope and resource name will be used */ export type ExtensionResourceOperationDecorator = (context: DecoratorContext, target: Operation, targetResourceType: Model, extensionResourceType: Model, operationType: "read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence", resourceName?: string) => void; /** * Marks an extension resource operation with the associated resource, operation type, and name. If no name is provided, the name is calculated by resource type. * * @param target The operation to associate the resourceType with * @param targetResourceType The resource model for the target resource * @param extensionResourceType The resource model for the extension resource * @param operationType The type of operation being performed * @param resourceName Optional. The name of the resource. If not provided, the scope and resource name will be used */ export type BuiltInResourceOperationDecorator = (context: DecoratorContext, target: Operation, parentResourceType: Model, builtInResourceType: Model, operationType: "read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence", resourceName?: string) => void; /** * Marks a resource operation with the associated resource, operation type, and name. If no name is provided, the name is calculated by resource type. * * @param target The operation to associate the resourceType with * @param resourceType The resource model * @param operationType The type of operation being performed * @param resourceName Optional. The name of the resource. If not provided, the resource type will be used */ export type LegacyExtensionResourceOperationDecorator = (context: DecoratorContext, target: Operation, resourceType: Model, operationType: "read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence", resourceName?: string) => void; /** * Validates that the specified common-types version is valid for the given resource type. * * @param target The resource model * @param version The common-types version * @param resourceName The name of the resource */ export type ValidateCommonTypesVersionForResourceDecorator = (context: DecoratorContext, target: Model, version: string, resourceName: string) => void; export type AzureResourceManagerPrivateDecorators = { resourceParameterBaseFor: ResourceParameterBaseForDecorator; resourceBaseParametersOf: ResourceBaseParametersOfDecorator; omitIfEmpty: OmitIfEmptyDecorator; assignProviderNameValue: AssignProviderNameValueDecorator; azureResourceBase: AzureResourceBaseDecorator; armUpdateProviderNamespace: ArmUpdateProviderNamespaceDecorator; assignUniqueProviderNameValue: AssignUniqueProviderNameValueDecorator; armResourceInternal: ArmResourceInternalDecorator; armResourceWithParameter: ArmResourceWithParameterDecorator; defaultResourceKeySegmentName: DefaultResourceKeySegmentNameDecorator; enforceConstraint: EnforceConstraintDecorator; armRenameListByOperation: ArmRenameListByOperationDecorator; armResourcePropertiesOptionality: ArmResourcePropertiesOptionalityDecorator; armBodyRoot: ArmBodyRootDecorator; legacyType: LegacyTypeDecorator; resourceParentType: ResourceParentTypeDecorator; legacyResourceOperation: LegacyResourceOperationDecorator; extensionResourceOperation: ExtensionResourceOperationDecorator; builtInResourceOperation: BuiltInResourceOperationDecorator; legacyExtensionResourceOperation: LegacyExtensionResourceOperationDecorator; validateCommonTypesVersionForResource: ValidateCommonTypesVersionForResourceDecorator; }; //# sourceMappingURL=Azure.ResourceManager.Private.d.ts.map