Skip to main content

Region

A Region model is a physical geographical area where the app can be deployed. Typically, for redundancy and low latency, an app is deployed in multiple regions. Therefore, it's common to have multiple region nodes under the app.

@example
const region = new Region('us-east-1');
@see

Definition of Default Models.

Hierarchy

Index

Constructors

constructor

  • new Region(regionId: string): Region
  • Parameters

    • regionId: string

    Returns Region

Properties

readonlyNODE_NAME

NODE_NAME: string = 'region'

The unique name of the node. All nodes with same name are of the same category.

readonlyNODE_TYPE

NODE_TYPE: NodeType = NodeType.MODEL

The type of the node.

readonlyregionId

regionId: string

Methods

addAnchor

  • To add an Anchor.

    Each node can store multiple anchors for reference. These anchors don't necessarily need to be parented by self, but must be unique, i.e. an anchor, identified by it's parent, cannot be added twice to self's list of anchors.


    Parameters

    Returns void

addChild

  • To add another node as a child of self.

    @throws

    Error Dependency relationship already exists!


    Parameters

    • onField: string

      The field in self on which the dependency is being defined.

    • child: UnknownNode

      The child node.

    • toField: string

      The field in child on which the dependency is being defined.

    Returns { childToParentDependency: Dependency; parentToChildDependency: Dependency }

    • childToParentDependency: The dependency edge from child to self.
    • parentToChildDependency: The dependency edge from self to child.

addEnvironment

addRelationship

  • To add another node as a sibling of self.


    Parameters

    Returns { thatToThisDependency: Dependency; thisToThatDependency: Dependency }

    • thatToThisDependency: The dependency edge from sibling to self.
    • thisToThatDependency: The dependency edge from self to sibling.

addSubnet

  • addSubnet(subnet: Subnet): void

diff

  • diff(): Promise<Diff[]>
  • Compares and calculates the difference between the current version of self node, and the previous version.

    • Recursively compares self children too.

    Returns Promise<Diff[]>

diffProperties

  • diffProperties(): Promise<Diff[]>
  • To compare properties of the current version of self node, vs. the previous version. It is a helper method to the diff() method.

    • This method is called by the () method.

    Returns Promise<Diff[]>

getAncestors

  • To get all ancestors of self.

    • Includes parent nodes.
    • Might include sibling nodes, if the dependency behaviors dictate the sibling is necessary for self node to exist.

    Returns UnknownNode[]

getAnchor

  • To get an anchor with a given ID and parent.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • optionalparent: UnknownModel

      The parent of the anchor.

      • If parent is not given, then self is considered the parent of this anchor.

    Returns undefined | AAnchor

getAnchorIndex

  • getAnchorIndex(anchorId: string, parent?: UnknownModel): number
  • To get the index of an anchor with a given ID and parent.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • optionalparent: UnknownModel

      The parent of the anchor.

      • If parent is not given, then self is considered the parent of this anchor.

    Returns number

getAnchors

  • getAnchors(filters?: { key: string; value: any }[]): AAnchor[]
  • To get all anchors, filtered by anchor properties.


    Parameters

    • filters: { key: string; value: any }[] = []

      A set of filters, where key is the property name and value is the value to filter by.

    Returns AAnchor[]

getBoundaryMembers

  • To get a boundary (sub graph) of self. A boundary is a group of nodes that must belong together. The boundary consists of all nodes associated with self, which includes parents, grand parents, children, grand children, and siblings.


    Returns UnknownNode[]

getChild

  • getChild(name: string, filters?: { key: string; value: any }[]): undefined | UnknownNode
  • To get a child of self that matches the given filters.

    @throws

    Error If more than one child is found.


    Parameters

    • name: string

      The NODE_NAME of the child.

    • filters: { key: string; value: any }[] = []

      A set of filters, to be applied on children, where key is the property name and value is the value to filter by.

    Returns undefined | UnknownNode

getChildren

  • getChildren(name?: string): {}
  • To get all children of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the children.

    Returns {}

    All children as an object with the NODE_NAME as the key, and self's dependency to the child as the value.

getContext

  • getContext(): string
  • To get the context of self. A context is a string representation of self that uniquely identifies self in the graph.


    Returns string

getDependencies

  • To get all dependencies of self.

    • Can be filtered to just dependencies with a single node.

    Parameters

    • optionalto: UnknownNode

      The other node. If present, will only return dependencies of self with this node.

    Returns Dependency[]

getDependency

  • To get a dependency of self with another node.


    Parameters

    Returns undefined | Dependency

    The dependency with the other node having the given relationship, or undefined if not found.

getDependencyIndex

  • To get the index of a dependency of self with another node.


    Parameters

    Returns number

    The index of the dependency with the other node having the given relationship, or -1 if not found.

getParents

  • getParents(name?: string): {}
  • To get all parent of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the parent.

    Returns {}

    All parents as an object with the NODE_NAME as the key, and self's dependency to the parent as the value.

getSiblings

  • getSiblings(name?: string): {}
  • To get all siblings of self.


    Parameters

    • optionalname: string

      The NODE_NAME of the sibling.

    Returns {}

    All siblings as an object with the NODE_NAME as the key, and self's dependency to the sibling as the value.

hasAncestor

  • To check if given node is an ancestor of self.


    Parameters

    Returns boolean

removeAllAnchors

  • removeAllAnchors(): void
  • To remove all anchors from self.


    Returns void

removeAnchor

  • removeAnchor(anchor: AAnchor): void
  • To remove an anchor from self.


    Parameters

    • anchor: AAnchor

      The anchor to remove.

    Returns void

removeDependency

  • removeDependency(dependencyIndex: number): void
  • To remove a dependency from self.


    Parameters

    • dependencyIndex: number

      The index of the dependency to remove.

    Returns void

removeRelationship

  • To remove ALL dependencies from self for the given node.


    Parameters

    Returns void

setContext

  • setContext(): string
  • To set the context of self. A context is a string representation of self that uniquely identifies self in the graph.


    Returns string

synth

  • Generates a serializable representation of self.


    Returns IRegion

staticunSynth

  • Parameters

    Returns Promise<Region>