public interface CloudMachineNamer
Implementations must provide a constructor which takes a single argument,
being the ConfigBag
for the context where the machine is being created
(usually a Location
).
With that bag, the config key CloudLocationConfig.CALLER_CONTEXT
typically contains the Entity
for which the machine is being created.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
generateNewGroupId(ConfigBag setup)
Generate a name stem for a group of machines, based on context.
|
java.lang.String |
generateNewMachineUniqueName(ConfigBag setup)
Generate a name for a new machine, based on context.
|
java.lang.String |
generateNewMachineUniqueNameFromGroupId(ConfigBag setup,
java.lang.String groupId)
Generate a unique name from the given name stem.
|
java.lang.String generateNewMachineUniqueName(ConfigBag setup)
The name should normally be unique, as a context might produce multiple machines, for example basing it partially on information from the context but also including some random salt.
java.lang.String generateNewGroupId(ConfigBag setup)
The name does not need to be unique, as uniqueness will be applied by #generateNewMachineUniqueNameFromGroupId(String)
.
java.lang.String generateNewMachineUniqueNameFromGroupId(ConfigBag setup, java.lang.String groupId)
The name stem is normally based on context information so the usual
function of this method is to apply a suffix which helps to uniquely distinguish between machines
in cases where the same name stem (#generateNewGroupId()
) is used for multiple machines.