Options
All
  • Public
  • Public/Protected
  • All
Menu

External module @twilio-labs/serverless-api/dist/api

Index

Functions

activateBuild

  • activateBuild(buildSid: string, environmentSid: string, serviceSid: string, client: GotClient): Promise<any>
  • Activates a specific build for a given environment by creating a new deployment

    export

    Parameters

    • buildSid: string

      the build to be activated

    • environmentSid: string

      the target environment for the build to be deployed to

    • serviceSid: string

      the service of the project

    • client: GotClient

      API client

    Returns Promise<any>

createEnvironmentFromSuffix

  • Creates a new environment given a domain suffix

    export

    Parameters

    • domainSuffix: string

      the domain suffix for the environment

    • serviceSid: string

      the service to create the environment for

    • client: GotClient

      API client

    Returns Promise<EnvironmentResource>

createEnvironmentIfNotExists

  • Creates an environment if non with the given suffix exists

    export

    Parameters

    • domainSuffix: string

      the domain suffix of the environment

    • serviceSid: string

      the service the environment belongs to

    • client: GotClient

      API client

    Returns Promise<EnvironmentResource>

createFunctionResource

  • Creates a new Function instance by calling the API

    Parameters

    • name: string

      the friendly name of the function to create

    • serviceSid: string

      the service the function should belong to

    • client: GotClient

      API client

    Returns Promise<FunctionApiResource>

createService

  • createService(serviceName: string, client: GotClient): Promise<string>
  • Creates a new service given a service name

    export

    Parameters

    • serviceName: string

      the unique name for the service

    • client: GotClient

      API client

    Returns Promise<string>

findServiceSid

  • findServiceSid(uniqueName: string, client: GotClient): Promise<string | undefined>
  • Tries to find the service SID associated to a service name

    export

    Parameters

    • uniqueName: string

      the unique name of the service

    • client: GotClient

      API client

    Returns Promise<string | undefined>

getBuild

  • Retrieves a specific build by its SID

    export

    Parameters

    • buildSid: string

      SID of build to retrieve

    • serviceSid: string

      service to retrieve build from

    • client: GotClient

      API client

    Returns Promise<BuildResource>

getDependencies

  • getDependencies(pkgJson: PackageJson): Dependency[]
  • Creates a list of dependencies compatible with the Serverless API givn a package.json file

    export

    Parameters

    • pkgJson: PackageJson

      an object structured like a package.json

    Returns Dependency[]

getEnvironment

  • Retrieves a specific environment using the API

    export

    Parameters

    • environmentSid: Sid

      the environment to retrieve

    • serviceSid: Sid

      the service the environment belongs to

    • client: GotClient

      API client

    Returns Promise<EnvironmentResource>

getEnvironmentFromSuffix

  • Looks up an environment given a domain suffix.

    export

    Parameters

    • domainSuffix: string

      the suffix to look for

    • serviceSid: string

      the service the environment belongs to

    • client: GotClient

      API client

    Returns Promise<EnvironmentResource>

getLog

  • Calls the API to retrieve a list of all assets

    Parameters

    • logSid: Sid

      SID of log to retrieve

    • environmentSid: Sid

      environment in which to get logs

    • serviceSid: Sid

      service to look for logs

    • client: GotClient

      API client

    Returns Promise<LogApiResource>

getOrCreateAssetResources

  • Given a list of resources it will first check which assets already exists and create the remaining ones.

    Parameters

    Returns Promise<AssetResource[]>

getOrCreateFunctionResources

  • Given a list of functions it will create the ones that don't exist and retrieves the others

    export

    Parameters

    Returns Promise<FunctionResource[]>

getService

isEnvironmentSid

  • isEnvironmentSid(str: string): boolean
  • Checks if a string is an environment SID by checking its prefix and length

    export

    Parameters

    • str: string

      the string to check

    Returns boolean

listAssetResources

  • Calls the API to retrieve a list of all assets

    Parameters

    • serviceSid: string

      service to look for assets

    • client: GotClient

      API client

    Returns Promise<AssetApiResource[]>

listBuilds

  • Returns a list of all builds related to service

    export

    Parameters

    • serviceSid: string

      the SID of the service

    • client: GotClient

      API client

    Returns Promise<BuildResource[]>

listEnvironments

  • Lists all environments for a given service

    export

    Parameters

    • serviceSid: string

      the service that the environments belong to

    • client: GotClient

      API client

    Returns Promise<EnvironmentResource[]>

listFunctionResources

  • Lists all functions associated to a service

    export

    Parameters

    • serviceSid: string

      the service to look up

    • client: GotClient

      API client

    Returns Promise<FunctionApiResource[]>

listLogResources

  • Calls the API to retrieve a list of all assets

    Parameters

    • environmentSid: Sid

      environment in which to get logs

    • serviceSid: Sid

      service to look for logs

    • client: GotClient

      API client

    Returns Promise<LogApiResource[]>

listServices

  • Lists all services attached to an account

    export

    Parameters

    Returns Promise<ServiceResource[]>

listVariablesForEnvironment

  • Lists all variables for a given environment

    export

    Parameters

    • environmentSid: string

      the environment to get the variables for

    • serviceSid: string

      the service the environment belongs to

    • client: GotClient

      API client

    Returns Promise<VariableResource[]>

setEnvironmentVariables

  • Sets or updates the values passed in an object of environment variables for a specfic environment

    export

    Parameters

    • envVariables: EnvironmentVariables

      the object of variables

    • environmentSid: string

      the environment the varibales should be set for

    • serviceSid: string

      the service the environment belongs to

    • client: GotClient

      API client

    Returns Promise<void>

triggerBuild

  • Triggers a new build by creating it

    export

    Parameters

    • config: BuildConfig

      build-related information (functions, assets, dependencies)

    • serviceSid: string

      the service to create the build for

    • client: GotClient

      API client

    Returns Promise<BuildResource>

uploadAsset

  • Uploads a given asset by creating a new version and uploading the content there

    export

    Parameters

    • asset: AssetResource

      The asset to upload

    • serviceSid: string

      The service to upload it to

    • client: GotClient

      The API client

    Returns Promise<Sid>

uploadFunction

  • Uploads a given function by creating a new version, reading the content if necessary and uploading the content

    export

    Parameters

    • fn: FunctionResource

      function to be uploaded

    • serviceSid: string

      service that the function is connected to

    • client: GotClient

      API client

    Returns Promise<Sid>

waitForSuccessfulBuild

  • waitForSuccessfulBuild(buildSid: string, serviceSid: string, client: GotClient, eventEmitter: events.EventEmitter, timeout?: number): Promise<void>
  • Resolves only when build has been completed. Will timeout after specified time.

    export

    Parameters

    • buildSid: string

      the build to wait for

    • serviceSid: string

      the service of the build

    • client: GotClient

      API client

    • eventEmitter: events.EventEmitter

      optional event emitter to communicate current build status

    • Default value timeout: number = 5 * 60 * 1000

      optional timeout. default: 5 minutes

    Returns Promise<void>

Generated using TypeDoc