UNPKG

terraform-generator

Version:

Generate Terraform configurations with Node.js.

75 lines (74 loc) 1.79 kB
import { Argument, Attribute } from '../arguments'; import { TerraformArgs, TerraformElement } from '../utils'; /** * @category Block */ export declare abstract class Block<Args extends TerraformArgs = TerraformArgs> extends TerraformElement { #private; readonly blockType: string; readonly blockNames: string[]; /** * Construct block. * * @param type type * @param names names * @param args arguments */ constructor(type: string, names: string[], args: Args, innerBlocks?: Block[], insideTerraformBlock?: boolean); /** * Is this block to be placed inside top-level terraform block. */ isInsideTerraformBlock(): boolean; /** * Get arguments. */ getArguments(): Args; /** * Get argument by key. * * @param key key */ getArgument<K extends keyof Args>(key: K): Args[K]; /** * Set argument. * * @param key key * @param value value */ setArgument<K extends keyof Args>(key: K, value: Args[K]): this; /** * Set arguments. * * @param args arguments */ setArguments(args: Partial<Args>): this; /** * Delete argument by key. * * @param key key */ deleteArgument(key: string): this; /** * Get inner blocks. */ protected getInnerBlocks(): Block[]; /** * Set inner blocks. */ protected setInnerBlocks(innerBlocks: Block[] | undefined): this; toTerraform(): string; /** * Represent block as argument. */ abstract asArgument(): Argument; /** * Get block's attribute. * * @param name attribute name */ abstract attr(name: string): Attribute; /** * Block's id attribute. */ get id(): Attribute; }