@tinystacks/iac-utils / Exports
- alphaNumericAndHyphen
- alphaNumericAndHyphenAllowedCharacterTypes
- alphaNumericOnly
- alphaNumericOnlyAllowedCharacters
- resourceNameRules
- allocateCidrBlock
- allocateSubnetMask
- constantCase
- constructId
- generateName
- kebabCase
- titleCase
- truncateWithSemiHash
- validateName
• Const
alphaNumericAndHyphen: RegExp
naming/naming-restrictions.ts:3
• Const
alphaNumericAndHyphenAllowedCharacterTypes: "alphanumeric characters and hyphens"
naming/naming-restrictions.ts:4
• Const
alphaNumericOnly: RegExp
naming/naming-restrictions.ts:5
• Const
alphaNumericOnlyAllowedCharacters: "alphanumeric characters"
naming/naming-restrictions.ts:6
• Const
resourceNameRules: Object
▪ [provider: string
]: { [resourceType: string]
: NameRestriction
; }
naming/naming-restrictions.ts:8
▸ 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.
Name | Type | Description |
---|---|---|
args |
AllocateCidrBlockArguments |
AllocateCidrBlockArguments |
CidrBlockAllocation - CidrBlockAllocation
cidr/allocate-cidr-block.ts:173
▸ 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
Name | Type | Description |
---|---|---|
cidrMask |
number |
number |
subnetCount |
number |
number |
number
number
cidr/allocate-subnet-mask.ts:13
▸ constantCase(input?
): string
Takes a string and converts it to CONSTANT_CASE
Default Value
''
Name | Type | Default value | Description |
---|---|---|---|
input |
string |
'' |
string |
string
string
string-manipulation/constant-case.ts:9
▸ constructId(...identifiers
): string
Takes 1 or more string identifiers and returns a string in our standard construct id format.
Name | Type | Description |
---|---|---|
...identifiers |
string [] |
...string |
string
constructId - string
▸ 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
Name | Type | Description |
---|---|---|
args |
GenerateNameArguments |
GenerateNameArguments |
string
string
▸ kebabCase(input?
): string
Takes a string and converts it to kebab-case
Default Value
''
Name | Type | Default value | Description |
---|---|---|---|
input |
string |
'' |
string |
string
string
string-manipulation/kebab-case.ts:7
▸ titleCase(input?
): string
Takes a string and converts it to TitleCase
Default Value
''
Name | Type | Default value | Description |
---|---|---|---|
input |
string |
'' |
string |
string
string
string-manipulation/title-case.ts:10
▸ 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.
Name | Type | Description |
---|---|---|
name |
string |
string |
maxLength |
number |
number |
string
string
▸ 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.
Name | Type | Default value |
---|---|---|
name |
string |
'' |
nameRestriction |
NameRestriction |
{} |
label |
string |
'Name' |