Skip to main content

Account

An Account model is the cloud provider account the infrastructure below it is deployed into. It sits between the App and its Regions, so one app can span several accounts - e.g. a separate account per environment, or per cloud provider.

Credentials are not held here. A module such as AwsIniAccountModule extends this model and supplies them through Account.getCredentials.

@example
const account = new Account(AccountType.AWS, '1234567890');
app.addAccount(account);
@group

Models/Account

@see

Definition of Default Models.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • accountType: AccountType

      The cloud provider this account belongs to.

    • accountId: string

      The provider's own identifier for the account.

    Returns Account

Properties

readonlyaccountId

accountId: string

readonlyaccountType

accountType: AccountType

readonlyinheritedanchors

anchors: (MatchingAnchor<BaseAnchorSchema> | UnknownAnchor)[] = []

The anchors attached to this model, whether declared on it or borrowed from another model.

staticreadonlyinheritedNODE_NAME

NODE_NAME: string

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

staticreadonlyinheritedNODE_PACKAGE

NODE_PACKAGE: string

The package of the node.

staticreadonlyinheritedNODE_SCHEMA

NODE_SCHEMA: unknown

The schema of the node.

staticreadonlyinheritedNODE_TYPE

NODE_TYPE: NodeType

The type of the node.

Methods

inheritedaddAnchor

  • To attach an AAnchor to this model. An anchor is only added once - re-adding the same anchor, identified by its ID and parent, throws.


    Parameters

    Returns void

addImage

  • addImage(image: Image): void
  • To add an Image. The image is used only inside this account. A module links it to the regions it is published into, and those links leave the image's own place unchanged.


    Parameters

    Returns void

addRegion

  • addRegion(region: Region): void

inheritedgetAnchor

  • getAnchor(anchorId: string, parent?: UnknownModel): UnknownAnchor | undefined
  • To get an attached anchor by its ID.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • optionalparent: UnknownModel

      The model that declared the anchor. Defaults to self.

    Returns UnknownAnchor | undefined

inheritedgetAnchorIndex

  • getAnchorIndex(anchorId: string, parent?: UnknownModel): number
  • The position of an attached anchor in AModel.anchors, or -1 when it is not attached.


    Parameters

    • anchorId: string

      The ID of the anchor.

    • optionalparent: UnknownModel

      The model that declared the anchor. Defaults to self.

    Returns number

inheritedgetAnchors

  • To get all attached anchors, narrowed by anchor class and/or by the value of their properties.


    Parameters

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

      Each filter is a property key the anchor must carry with the given value.

    • types: Constructable<MatchingAnchor<BaseAnchorSchema> | UnknownAnchor>[] = []

      The anchor classes to keep. An empty list keeps every class.

    Returns UnknownAnchor[]

inheritedgetAnchorsMatchingSchema

  • getAnchorsMatchingSchema<S>(from: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], options?: { searchBoundaryMembers?: boolean }): Promise<MatchingAnchor<S>[]>
  • To find anchors by their schema rather than by their class.

    This is how a module consumes what another module produced without importing its classes - you match on the shape you need, and any anchor satisfying that shape is returned. Anchors that do not satisfy the schema are skipped, not reported as errors.

    @see

    Definition of Anchors.


    Type parameters

    Parameters

    • from: Constructable<S>

      The anchor schema to match against.

    • propertyFilters: ObjectKeyValue<S[properties]>[] = []

      Each filter is a property key the anchor must carry with the given value.

    • options: { searchBoundaryMembers?: boolean } = {}

      searchBoundaryMembers searches the whole boundary this model belongs to. Set it to false to search only this model.

      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingAnchor<S>[]>

getCredentials

  • getCredentials(): object
  • The credentials this account authenticates with, for the paths octo drives itself rather than through a provider - an external resource's actions, most of all. The shape is the provider's own; octo only carries it from the model to whatever builds the client.

    @throws

    ModelError On the base model, which holds no credentials. Override it in the subclass a module creates.


    Returns object

inheritedgetModelsMatchingSchema

  • getModelsMatchingSchema<S>(schema: Constructable<S>, filters?: ObjectKeyValue<S>[], options?: { searchBoundaryMembers?: boolean }): Promise<MatchingModel<S>[]>
  • To find models by their schema. See AModel.getAnchorsMatchingSchema.


    Type parameters

    • S: object

    Parameters

    • schema: Constructable<S>

      The model schema to match against.

    • filters: ObjectKeyValue<S>[] = []

      Each filter is a schema key the model must carry with the given value.

    • options: { searchBoundaryMembers?: boolean } = {}

      searchBoundaryMembers searches the whole boundary this model belongs to. Set it to false to search only this model.

      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingModel<S>[]>

inheritedgetOverlaysMatchingSchema

  • getOverlaysMatchingSchema<S>(schema: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], options?: { searchBoundaryMembers?: boolean }): Promise<MatchingModel<S>[]>
  • To find overlays by their schema. See AModel.getAnchorsMatchingSchema.


    Type parameters

    Parameters

    • schema: Constructable<S>

      The overlay schema to match against.

    • propertyFilters: ObjectKeyValue<S[properties]>[] = []

      Each filter is a property key the overlay must carry with the given value.

    • options: { searchBoundaryMembers?: boolean } = {}

      searchBoundaryMembers searches the whole boundary this model belongs to. Set it to false to search only this model.

      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingModel<S>[]>

inheritedgetResourcesMatchingSchema

  • getResourcesMatchingSchema<S>(schema: Constructable<S>, propertyFilters?: ObjectKeyValue<S[properties]>[], responseFilters?: ObjectKeyValue<S[response]>[], options?: { searchBoundaryMembers?: boolean }): Promise<MatchingResource<S>[]>
  • To find resources by their schema. See AModel.getAnchorsMatchingSchema.

    Only resources produced by the modules that own the searched models are considered, so this returns another module's resources rather than every resource in the run.


    Type parameters

    Parameters

    • schema: Constructable<S>

      The resource schema to match against.

    • propertyFilters: ObjectKeyValue<S[properties]>[] = []

      Each filter is a property key the resource must carry with the given value.

    • responseFilters: ObjectKeyValue<S[response]>[] = []

      Each filter is a response key the resource must carry with the given value.

    • options: { searchBoundaryMembers?: boolean } = {}

      searchBoundaryMembers searches the whole boundary this model belongs to. Set it to false to search only this model.

      • optionalsearchBoundaryMembers: boolean = true

    Returns Promise<MatchingResource<S>[]>

inheritedremoveAllAnchors

  • removeAllAnchors(): void
  • To detach every anchor from this model.


    Returns void

inheritedremoveAnchor

  • To detach an anchor from this model. Detaching an anchor that is not attached is a no-op.


    Parameters

    Returns void