Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NodeAllocationManager

Hierarchy

Index

Constructors

Properties

cache: Dict<number, Dict<number, Allocation>>
client: PteroApp

Accessors

  • get FILTERS(): readonly never[]
  • get INCLUDES(): readonly string[]
  • get SORTS(): readonly never[]

Methods

  • _patch(node: number, data: any): any
  • adminURLFor(id: number): string
  • create(node: number, ip: string, ports: string[]): Promise<void>
  • Creates a number of allocations based on the ports specified. Note that the created allocations will not be returned due to the number that can be created in a single request, which can cause unwanted issues.

    example
    app.allocations.create(4, '10.0.0.1', ['8000-9000'])
    .catch(console.error);

    Parameters

    • node: number

      The ID of the node.

    • ip: string

      The IP for the allocation.

    • ports: string[]

      A list of ports or port ranges for the allocation.

    Returns Promise<void>

  • delete(node: number, id: number): Promise<void>
  • Deletes an allocation from a node.

    example
    app.allocations.delete(4, 92).catch(console.error);
    

    Parameters

    • node: number

      The ID of the node.

    • id: number

      The ID of the allocation.

    Returns Promise<void>

  • fetchAvailable(node: number, single: true): Promise<undefined | Allocation>
  • fetchAvailable(node: number, single: false): Promise<Dict<number, Allocation>>
  • Fetches the available allocations on a node and returns a single one.

    example
    app.allocations.fetchAvailable(4, true)
    .then(console.log)
    .catch(console.error);

    Parameters

    • node: number

      The ID of the node.

    • single: true

      Whether to return a single allocation.

    Returns Promise<undefined | Allocation>

    The available allocation(s).

  • Fetches the available allocations on a node.

    example
    app.allocations.fetchAvailable(4, false)
    .then(all => all.forEach(a => console.log(a)))
    .catch(console.error);

    Parameters

    • node: number

      The ID of the node.

    • single: false

      Whether to return a single allocation.

    Returns Promise<Dict<number, Allocation>>

    The available allocation(s).

  • getFetchAll<T, K>(...options: unknown[]): Promise<Dict<T, K>>
  • getQueryOptions(): { filters: readonly string[]; includes: readonly string[]; sorts: readonly string[] }
  • Gets the allowed query options from the inherited manager.

    internal

    Returns { filters: readonly string[]; includes: readonly string[]; sorts: readonly string[] }

    The query options.

    • filters: readonly string[]
    • includes: readonly string[]
    • sorts: readonly string[]

Generated using TypeDoc