A set of Java APIs for building cloud based applications.
clusterless-commons-core
- Utilities and helpers for consistent naming and temporal operations.clusterless-commons-aws
- Utilities and base Constructs for AWS CDK applications.
For use with JDK 11+.
Consistent, human-readable, names are important for usability and maintainability of cloud applications. In many cases names must be unique to a region, account, or globally.
The Label class is for making labels, String for use in different contexts.
Label id = Label.of("project").with("version");
id.camelCase(); // projectVersion
id.lowerHyphen(); // project-version
id.lowerColonPath(); // project:version
There are a few flavors of Label:
- Fixed - retains the original value
- Partition - allows for key=value pairs within each path element
- Region - for declaring AWS regions
- Stage - for declaring deployment stages
- Version - for declaring versions
Label
is an interface that can be implemented by specialized classes. Use Label.EnumLabel
to create label enums.
Ref is used to create a unique export name for a resource.
A Ref can represent
- id - the id of the exported resource (like a vpc id)
- name - the physical name of the exported resource (like S3 bucket name)
- arn - the AWS Arn of the exported resource
A Ref takes the form of:
aws:qualifier:[stage:]scopeName:scopeVersion:resourceNS:resourceType:resourceName
The ScopedConstruct class provides a way to create Refs for child resources of the construct.
Provides IntervalUnit implementations of:
- Fourths - 15 minute intervals
- Sixths - 10 minute intervals
- Twelfths - 5 minute intervals
These intervals are used by Clusterless to label lots.
There is also a IntervalDateTimeFormatter for formatting dates and times of these intervals.
Provides a few Collection helpers:
- OrderedMaps - The same as Maps.of() but retains the order of the keys
- OrderedSafeMaps - The same as OrderedMaps.of() but retains the order of the keys and ignores null values
- SafeList - The same as List.of() but ignores null values
OrderedMaps
is especially useful when the hashing order could change even if the key values don't. When creating many
CDK Constructs, Map instances are required. Using OrderedMaps.of()
will ensure the order of the keys is retained to
prevent a deployment from being unnecessarily triggered.
This module provides AWS specific related classes centered around simplifying the naming, exporting, and tagging of resources.
- ArnsRefs - ArnRefs provides a utility for resolving ARN references from a Ref or ARN string.
- ResourceNames - Provides methods for creating unique resource names.
A set of classes for creating Stacks and Constructs scoped to:
- stage - the current deployment stage
- name - the name of the application
- version - the version of the application
There are also methods to create Refs for exported resources, or to import resources via a stringified Ref or Arn.
Names are generated from these values to prevent collisions across deployments within an account, or across accounts.
- ScopedApp - A CDK App scoped to stage, name, and version.
- ScopedStack - A CDK Stack scoped to stage, name, and version by virtue of being a child of a ScopedApp.
- ScopedConstruct - A CDK Construct scoped to stage, name, and version by virtue of being a child of a ScopedStack.
- LambdaLogGroupConstruct - A construct to simplify creating a CloudWatch LogGroup for a Lambda function.
- OutputConstruct - A construct to simplify creating Stack outputs.
- TagsUtil - A utility for applying tags to AWS resources.
The TagsUtil
can be disabled to speed up deployments for stacks that have a large number of resources, in order to
speed the deployment during development.