ProvisioningComponent class
Base class for all tree nodes in the library object model.
Example
import { ProvisioningComponent } from "@azure/provisioning-core";
import { KeyVault, Secret } from "@azure/provisioning-keyvault";
class DataTier extends ProvisioningComponent {
readonly vault: KeyVault;
readonly secret: Secret;
constructor(parent: ProvisioningComponent, tenantId: string, secretValue: string) {
super(parent);
this.vault = new KeyVault(this, {
name: "kv-my-app",
location: "eastus",
properties: { tenantId, sku: { family: "A", name: "standard" } },
});
this.secret = new Secret(this.vault, {
name: "database-password",
properties: { value: secretValue },
});
}
}
Remarks
Both Stack and Resource extend ProvisioningComponent. It provides parent-child
tree tracking and deployment context lookup — walking up the tree to find
the nearest context set by a Stack or ResourceGroup.
Subclass ProvisioningComponent directly to create reusable groupings of resources
that don't correspond to an ARM resource. For ARM resources, extend
Resource instead.
Constructors
| Provisioning |
Properties
| children | |
| deployment |
The effective deployment context inherited from ancestors, resolved by walking up the parent chain (this node's own local contribution is intentionally excluded — a node's contribution flows to its descendants, not to itself). Each field is resolved per its own rule:
Returns an object whose fields may all be |
| parent | |
| self | Public identity for this node. |
Methods
| is |
|
| transform((component: Provisioning |
Applies a callback to every descendant component/resource that matches the
given constructor, including |
| transform<TComponent>(Provisioning |
|
| visit((component: Provisioning |
Depth-first visit of this node and all descendants.
Return |
Constructor Details
ProvisioningComponent(ProvisioningComponent)
Property Details
children
deploymentContext
The effective deployment context inherited from ancestors, resolved by walking up the parent chain (this node's own local contribution is intentionally excluded — a node's contribution flows to its descendants, not to itself). Each field is resolved per its own rule:
location: nearest ancestor with a value wins.namingPolicy: nearest ancestor with a value wins.tags: flat-merged across all ancestors; innermost wins on key conflict.
Returns an object whose fields may all be undefined if no ancestor
contributed anything.
DeploymentContext deploymentContext
Property Value
parent
self
Public identity for this node.
this self
Property Value
this
Method Details
isChildOf(ProvisioningComponent)
function isChildOf(component: ProvisioningComponent): boolean
Parameters
- component
- ProvisioningComponent
Returns
boolean
transform((component: ProvisioningComponent) => void)
Applies a callback to every descendant component/resource that matches the
given constructor, including this when it matches.
function transform(callback: (component: ProvisioningComponent) => void): this
Parameters
- callback
-
(component: ProvisioningComponent) => void
Returns
this
transform<TComponent>(ProvisioningComponentConstructor<TComponent>, (component: TComponent) => void)
function transform<TComponent>(ctor: ProvisioningComponentConstructor<TComponent>, callback: (component: TComponent) => void): this
Parameters
- ctor
-
ProvisioningComponentConstructor<TComponent>
- callback
-
(component: TComponent) => void
Returns
this
visit((component: ProvisioningComponent) => boolean | void)
Depth-first visit of this node and all descendants.
Return false from the callback to skip visiting that node's children.
function visit(callback: (component: ProvisioningComponent) => boolean | void)
Parameters
- callback
-
(component: ProvisioningComponent) => boolean | void