Skip to content

Latest commit

 

History

History
343 lines (196 loc) · 8.11 KB

modules.md

File metadata and controls

343 lines (196 loc) · 8.11 KB

@tinystacks/iac-utils / Exports

@tinystacks/iac-utils

Table of contents

Enumerations

Classes

Interfaces

Variables

Functions

Variables

alphaNumericAndHyphen

Const alphaNumericAndHyphen: RegExp

Defined in

naming/naming-restrictions.ts:3


alphaNumericAndHyphenAllowedCharacterTypes

Const alphaNumericAndHyphenAllowedCharacterTypes: "alphanumeric characters and hyphens"

Defined in

naming/naming-restrictions.ts:4


alphaNumericOnly

Const alphaNumericOnly: RegExp

Defined in

naming/naming-restrictions.ts:5


alphaNumericOnlyAllowedCharacters

Const alphaNumericOnlyAllowedCharacters: "alphanumeric characters"

Defined in

naming/naming-restrictions.ts:6


resourceNameRules

Const resourceNameRules: Object

Index signature

▪ [provider: string]: { [resourceType: string]: NameRestriction; }

Defined in

naming/naming-restrictions.ts:8

Functions

allocateCidrBlock

allocateCidrBlock(args): CidrBlockAllocation

Deterministically generate a CIDR block range.

Remarks

Given the same inputs, it will generate the same output. This can be useful if you need to create mutiple VPCs that need to be peered since peered VPCs cannot have overlapping CIDR ranges.

Parameters

Name Type Description
args AllocateCidrBlockArguments AllocateCidrBlockArguments

Returns

CidrBlockAllocation

CidrBlockAllocation - CidrBlockAllocation

Defined in

cidr/allocate-cidr-block.ts:173


allocateSubnetMask

allocateSubnetMask(cidrMask, subnetCount): number

Given the subnet mask of a cidr range and the number of desired subnets, this function will calculate the largest possible mask for the count of subnets to fit within the cidr range.

Example

allocateSubnetMask(16, 4) // => 18
allocateSubnetMask(24, 4) // => 26
allocateSubnetMask(16, 18) // => 21

Parameters

Name Type Description
cidrMask number number
subnetCount number number

Returns

number

number

Defined in

cidr/allocate-subnet-mask.ts:13


constantCase

constantCase(input?): string

Takes a string and converts it to CONSTANT_CASE

Default Value

''

Parameters

Name Type Default value Description
input string '' string

Returns

string

string

Defined in

string-manipulation/constant-case.ts:9


constructId

constructId(...identifiers): string

Takes 1 or more string identifiers and returns a string in our standard construct id format.

Parameters

Name Type Description
...identifiers string[] ...string

Returns

string

constructId - string

Defined in

naming/construct-id.ts:9


generateName

generateName(args): string

Generates a name by:

  • concatenating a unique copy of the provided identifiers with the provided separator
  • converting to the specified case
  • removing restricted characters
  • truncating the result with a semi-hash for uniqueness if it exceeds the character limit

Parameters

Name Type Description
args GenerateNameArguments GenerateNameArguments

Returns

string

string

Defined in

naming/generate-name.ts:38


kebabCase

kebabCase(input?): string

Takes a string and converts it to kebab-case

Default Value

''

Parameters

Name Type Default value Description
input string '' string

Returns

string

string

Defined in

string-manipulation/kebab-case.ts:7


titleCase

titleCase(input?): string

Takes a string and converts it to TitleCase

Default Value

''

Parameters

Name Type Default value Description
input string '' string

Returns

string

string

Defined in

string-manipulation/title-case.ts:10


truncateWithSemiHash

truncateWithSemiHash(name, maxLength): string

Takes a name and a maximum length and returns a string of that length. If the name parameter's length is greater than the specified max lenght it will be truncated and the last 8 characters will be replaced with the last 8 characters of the md5 hash of the original value for name.

Parameters

Name Type Description
name string string
maxLength number number

Returns

string

string

Defined in

naming/truncate-w-hash.ts:10


validateName

validateName(name?, nameRestriction?, label?): NameValidationResponse

Validates a name against a NameRestriction. Returns a response with a boolean property indicating validity and a string property with a human readable reason for invalidity.

Parameters

Name Type Default value
name string ''
nameRestriction NameRestriction {}
label string 'Name'

Returns

NameValidationResponse

Defined in

naming/validate-name.ts:19