UNPKG

typed-aws

Version:

Helps you write AWS CloudFormation in TypeScript

63 lines (62 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CfnResource = void 0; const dataTypes_1 = require("./dataTypes"); // eslint-disable-next-line @typescript-eslint/no-explicit-any class CfnResource { constructor(Type, Properties) { this.Type = Type; this.Properties = Properties; } dependsOn(dependencies) { const newDependencies = Array.isArray(dependencies) ? dependencies : [dependencies]; if (typeof this.DependsOn === 'undefined' || this.DependsOn instanceof dataTypes_1.IntrinsicFunction) { this.DependsOn = [...newDependencies]; } else { this.DependsOn.push(...newDependencies); } return this; } setDependsOn(dependencies) { this.DependsOn = dependencies; return this; } metadata(metadata) { this.Metadata = this.Metadata || {}; Object.assign(this.Metadata, metadata); return this; } setMetadata(metadata) { this.Metadata = metadata; return this; } creationPolicy(policy) { this.CreationPolicy = policy; return this; } deletionPolicy(policy) { this.DeletionPolicy = policy; return this; } updatePolicy(policy) { this.UpdatePolicy = policy; return this; } updateReplacePolicy(policy) { this.UpdateReplacePolicy = policy; return this; } condition(condition) { this.Condition = condition; return this; } with(apply) { apply(this); return this; } } exports.CfnResource = CfnResource;