Dynamic Resource-Naming with Appranix

Resource Name

Resource Name is assigned for the application platforms deployed in an infrastructure to meet the standards and conventions required by an organization. Appranix enables dynamic creation of Resource Name that follows any standards or conventions mandated under an organization.

The instructions below have a simple and comprehensive guide to create dynamic Resource Name with Appranix.

Resource Name Service

Appranix provides a rest service which generates Resource Name based on the pattern requested to the service. The service accepts the naming pattern created in Spring Expression Language(SpEL) format.

The Resource Name Service has to be added as a cloud service after creating your cloud. Configure the service by adding the below details,

Url - endpoint to the Resource Name Provider

Username & Password - user credentials to access Resource Name Provider

Format - add the resource-name format expression as key-value pair.
For example, Key: compute & Value: expression. More formats can be added for any required service.

You can also setup your custom Resource Name Provider for your organizational requirements.

Generating Resource Name Format

In order to dynamically generate a Resource Name the required format has to be presented as a SpEL expression.

Consider a fqdn AZRWEBSITEDEV-ENVIRONMENTDEVCRM001.us.demo-inc.group

Description Char Example
Cloud name 3 AZR (Azure)
Platform name WEBSITE
Environment name DEV-ENVIRONMENT
EnvironmentGroup name DEV
Assembly name 3 CRM
Platform/Server number 3 001 (serial)

the Resource Name 'AZRWEBSITEDEV-ENVIRONMENTDEVCRM001' is generated by the following expression format,

get(cloudName) + platformName + environmentName +  environmentGroupName + assemblyName.substring(0,3) +  pad(('0',3,sequence(instanceId,assemblyName,environmentName,platformName))

The Resource Name service gets the below json request when a deployment for an application platform is triggered,

  "organizationName": "demo-inc",
  "assemblyName": "crm",
  "platformName": "website",
  "cloudName": "azure",
  "environmentName": "dev-environment",
  "environmentGroupName": "dev",
  "format": "get(cloudName) + platformName + environmentName + environmentGroupName + assemblyName.substring(0,3) +  pad(('0',3,sequence(instanceId,assemblyName,environmentName,platformName))",
  "instanceId": 112132

The Resource Name service returns the following json response with the dynamically generated Resource Name along with the fqdn,

  "createdAt": "06/10/17 11:44:07",
  "fqdn": "AZRWEBSITEDEV-ENVIRONMENTDEVCRM001.us.demo-inc.group"

How get, pad and sequence works?

The dynamic Resource Name generation by the Resource Name service involves the following methods,


The get(String key) method returns the value for the stored key.

For example, assume the below key-value pair is stored for a cloud name under an organization,

"Azure" : "AZR"

get(Azure) will return the value 'AZR'

Note: The key-value mappings required for any part of the Resource Name created under an organization can be added by sending a request to the Resource Name Provider as shown below,

Request type: POST

URL: http://resource-name-provider:6853/api/v1/static-mapping/demo-inc

payload: {
  "Azure" : "AZR"


The pad(String padChar, Integer length, Long value) method generates a string padding based on the input provided.

  1. The first parameter padChar denotes the format of order sequence,

    • '0' will generate the order sequence as 0,1,2,3...
    • 'A' will generate the order sequence as A,B,C,D...

  2. The second parameter length denotes the length of the string the method returns.

    • if padChar='0' and length=3, the padded string will start with 000.

  3. The third parameter serial is a Long value returned by the sequence method.

    • if the value is 6, then 006 is returned.
    • if the value is 88, then 088 is returned.
    • if the value is 789, then 789 is returned.


The Long sequence(String instanceId, String... args) method generates a sequence of long value taking the unique instanceId and String arguments.

sequence(instanceId, assemblyName, environmentName, platformName)

  • If instanceId is unique, a new record gets created and returns 1.
  • If instanceId already exists with the same arguments, it returns 2.

results matching ""

    No results matching ""