Package com.structurizr.model
Class ContainerInstance
java.lang.Object
com.structurizr.model.Element
com.structurizr.model.DeploymentElement
com.structurizr.model.ContainerInstance
public final class ContainerInstance extends DeploymentElement
Represents a deployment instance of a
Container, which can be added to a DeploymentNode.-
Method Summary
Modifier and Type Method Description HttpHealthCheckaddHealthCheck(java.lang.String name, java.lang.String url)Adds a new health check, with the default interval (60 seconds) and timeout (0 milliseconds).HttpHealthCheckaddHealthCheck(java.lang.String name, java.lang.String url, int interval, long timeout)Adds a new health check.PerspectiveaddPerspective(java.lang.String name, java.lang.String description)Adds a perspective to this model item.voidaddProperty(java.lang.String name, java.lang.String value)Adds a name-value pair property to this element.voidaddTags(java.lang.String... tags)java.lang.StringgetCanonicalName()ContainergetContainer()java.lang.StringgetContainerId()Gets the ID of the container that this object represents a deployment instance of.java.util.Set<HttpHealthCheck>getHealthChecks()Gets the set of health checks associated with this container instance.java.lang.StringgetId()Gets the ID of this item in the model.intgetInstanceId()Gets the instance ID of this container.java.lang.StringgetName()Gets the name of this element.ElementgetParent()Gets the parent of this element.java.util.Set<Perspective>getPerspectives()Gets the set of perspectives associated with this model item.java.util.Map<java.lang.String,java.lang.String>getProperties()Gets the collection of name-value property pairs associated with this element, as a Map.protected java.util.Set<java.lang.String>getRequiredTags()java.lang.StringgetTags()Gets the comma separated list of tags.java.util.Set<java.lang.String>getTagsAsSet()booleanhasTag(java.lang.String tag)Determines whether this model item has the given tag.booleanremoveTag(java.lang.String tag)Removes the given tag.voidsetName(java.lang.String name)Methods inherited from class com.structurizr.model.Element
getDescription, getEfferentRelationshipWith, getModel, getRelationships, getUrl, hasAfferentRelationships, hasEfferentRelationshipWith, setDescription, setModel, setUrl, toString
-
Method Details
-
getContainer
-
getContainerId
public java.lang.String getContainerId()Gets the ID of the container that this object represents a deployment instance of.- Returns:
- the container ID, as a String
-
getInstanceId
public int getInstanceId()Gets the instance ID of this container.- Returns:
- the instance ID, an integer greater than zero
-
getRequiredTags
protected java.util.Set<java.lang.String> getRequiredTags() -
removeTag
public boolean removeTag(java.lang.String tag)Removes the given tag.- Parameters:
tag- the tag to remove- Returns:
- true if the tag was removed; will return false if a non-existent tag is passed, or if an attempt is made to remove required tags, which cannot be removed.
-
getCanonicalName
public java.lang.String getCanonicalName()- Specified by:
getCanonicalNamein classElement
-
getParent
Description copied from class:ElementGets the parent of this element. -
getName
public java.lang.String getName()Description copied from class:ElementGets the name of this element. -
setName
public void setName(java.lang.String name) -
getHealthChecks
Gets the set of health checks associated with this container instance.- Returns:
- a Set of HttpHealthCheck instances
-
addHealthCheck
Adds a new health check, with the default interval (60 seconds) and timeout (0 milliseconds).- Parameters:
name- the name of the health checkurl- the URL of the health check- Returns:
- a HttpHealthCheck instance representing the health check that has been added
- Throws:
java.lang.IllegalArgumentException- if the name is empty, or the URL is not a well-formed URL
-
addHealthCheck
@Nonnull public HttpHealthCheck addHealthCheck(java.lang.String name, java.lang.String url, int interval, long timeout)Adds a new health check.- Parameters:
name- the name of the health checkurl- the URL of the health checkinterval- the polling interval, in secondstimeout- the timeout, in milliseconds- Returns:
- a HttpHealthCheck instance representing the health check that has been added
- Throws:
java.lang.IllegalArgumentException- if the name is empty, the URL is not a well-formed URL, or the interval/timeout is not zero/a positive integer
-
getId
public java.lang.String getId()Gets the ID of this item in the model.- Returns:
- the ID, as a String
-
getTags
public java.lang.String getTags()Gets the comma separated list of tags.- Returns:
- a comma separated list of tags, or an empty string if there are no tags
-
getTagsAsSet
public java.util.Set<java.lang.String> getTagsAsSet() -
addTags
public void addTags(java.lang.String... tags) -
hasTag
public boolean hasTag(java.lang.String tag)Determines whether this model item has the given tag.- Parameters:
tag- the tag to check for- Returns:
- true if tag is present as a tag on this item, or if it is one of the required tags defined by the model in getRequiredTags(), false otherwise
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()Gets the collection of name-value property pairs associated with this element, as a Map.- Returns:
- a Map (String, String) (empty if there are no properties)
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)Adds a name-value pair property to this element.- Parameters:
name- the name of the propertyvalue- the value of the property
-
getPerspectives
Gets the set of perspectives associated with this model item.- Returns:
- a Set of Perspective objects (empty if there are none)
-
addPerspective
Adds a perspective to this model item.- Parameters:
name- the name of the perspective (e.g. "Security", must be unique)description- a description of the perspective- Returns:
- a Perspective object
- Throws:
java.lang.IllegalArgumentException- if perspective details are not specified, or the named perspective exists already
-