All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.HashedAddressingScheme Maven / Gradle / Ivy

There is a newer version: 0.36.1
Show newest version
package software.amazon.awscdk;

/**
 * Renders a hashed ID for a resource.
 * 
 * In order to make sure logical IDs are unique and stable, we hash the resource
 * construct tree path (i.e. toplevel/secondlevel/.../myresource) and add it as
 * a suffix to the path components joined without a separator (CloudFormation
 * IDs only allow alphanumeric characters).
 * 
 * The result will be:
 * 
 *    
 *      "human"      "hash"
 * 
 * If the "human" part of the ID exceeds 240 characters, we simply trim it so
 * the total ID doesn't exceed CloudFormation's 255 character limit.
 * 
 * We only take 8 characters from the md5 hash (0.000005 chance of collision).
 * 
 * Special cases:
 * 
 * - If the path only contains a single component (i.e. it's a top-level
 *    resource), we won't add the hash to it. The hash is not needed for
 *    disamiguation and also, it allows for a more straightforward migration an
 *    existing CloudFormation template to a CDK stack without logical ID changes
 *    (or renames).
 * - For aesthetic reasons, if the last components of the path are the same
 *    (i.e. `L1/L2/Pipeline/Pipeline`), they will be de-duplicated to make the
 *    resulting human portion of the ID more pleasing: `L1L2Pipeline`
 *    instead of `L1L2PipelinePipeline`
 * - If a component is named "Default" it will be omitted from the path. This
 *    allows refactoring higher level abstractions around constructs without affecting
 *    the IDs of already deployed resources.
 * - If a component is named "Resource" it will be omitted from the user-visible
 *    path, but included in the hash. This reduces visual noise in the human readable
 *    part of the identifier.
 */
@javax.annotation.Generated(value = "jsii-pacmak/0.10.5 (build 46bc9b0)", date = "2019-05-06T20:49:40.949Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.$Module.class, fqn = "@aws-cdk/cdk.HashedAddressingScheme")
public class HashedAddressingScheme extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.IAddressingScheme {
    protected HashedAddressingScheme(final software.amazon.jsii.JsiiObject.InitializationMode mode) {
        super(mode);
    }
    public HashedAddressingScheme() {
        super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
    }

    /**
     * Return the logical ID for the given list of Construct names on the path.
     */
    @Override
    public java.lang.String allocateAddress(final java.util.List addressComponents) {
        return this.jsiiCall("allocateAddress", java.lang.String.class, new Object[] { java.util.Objects.requireNonNull(addressComponents, "addressComponents is required") });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy