Managing Mambu Functions
  • 25 Sep 2023
  • 3 Minutes To Read
  • Dark
    Light
  • PDF

Managing Mambu Functions

  • Dark
    Light
  • PDF

Article Summary

Once you have deployed your Mambu Functions you can manage them by deleting or updating them using the following commands. In most cases you will first need to list your deployed Functions to execute your commands on the right Function.

Listing deployed Mambu Functions

To see the Functions that you have already deployed to Mambu, run the command:

mambu functions list [-p=PROFILE_NAME][ANOTHER_MAMBU_TENANT.mambu.com]

This will return a list of Functions that have been deployed, but they may not necessarily be bound to a product yet. See the Confirm that the Function has been deployed section for more on the flags and arguments that you can use in this command.

Updating a Mambu Function

To make an update to an already deployed Function you need to add the --update or -u flag to the standard deploy command.

Linux and macOS

[MAMBU_API_TOKEN="ANOTHER_MAMBU_API_KEY"] mambu functions deploy . FUNCTION-NAME [-v=4] [-u] [-p="PROFILE_NAME"]  [ANOTHER_MAMBU_TENANT.mambu.com]

Windows Powershell

[$env:MAMBU_API_TOKEN="ANOTHER_MAMBU_API_KEY";] mambu functions deploy . FUNCTION-NAME [-v=4] [-u] [-p="PROFILE_NAME"] [ANOTHER_MAMBU_TENANT.mambu.com]

See the Deploy your Mambu Function section for more on the flags and arguments that you can use in this command.

Please note

Version control for Mambu Functions that you create needs to be managed separately in your own systems (such as Git). It is not possible to pull deployed Functions from Mambu in order to update and redeploy them.

Deleting a Mambu Function

First list the Functions deployed to your Mambu environment to find the name of the Function you would like to delete. Functions that have already been bound to a product and are in use cannot be deleted.

The command to delete a Function from your Mambu environment is:

Linux and macOS

[MAMBU_API_TOKEN="ANOTHER_MAMBU_API_KEY"] mambu functions delete FUNCTION-NAME [-p="PROFILE_NAME"] [ANOTHER_MAMBU_TENANT.mambu.com]

Windows Powershell

[$env:MAMBU_API_TOKEN="ANOTHER_MAMBU_API_KEY";] mambu functions delete FUNCTION-NAME [-p="PROFILE_NAME"] [ANOTHER_MAMBU_TENANT.mambu.com]
ExampleDescriptionRequired
MAMBU_API_TOKEN="a1b2c3d4e5f6g7"If you would like to override the API key stored in your credentials file, you can add a different API key to the command as an argument.NO
mambu functions deleteThis part of the command is always required.YES
my-new-functionThe name of the Function you want to delete.YES
-p or --profileThe profile flag allows you to use a different credentials profile, with a different Mambu API key and Mambu environment URL, for this command. You can also change the current credentials profile by running the command EXPORT MAMBU_PROFILE="PROFILE_NAME" before this command to switch profiles. For more information, see Using credentials profiles.NO
MAMBU_TENANT.mambu.comIf you would like to override the Mambu environment URL stored in your credentials file, you can add a different Mambu environment URL to the command as an argument.NO

A confirmation prompt will ask you to confirm that you would like to delete the Function. Type in Y to complete the action. After a 24-hour period the Function is fully deleted.

Creating multiple credentials profiles

In some cases you may want to use different credentials with a Mambu API key and Mambu environment URL that is different from the one you set when installing the Mambu CLI.

You can pass in credentials as parameters to individual commands, for example:

MAMBU_API_TOKEN="ANOTHER_MAMBU_API_KEY" mambu functions deploy . my-function ANOTHER_MAMBU_TENANT.mambu.com

A more durable solution for credentials that you may use repeatedly is to create credentials profiles that store the API key and environment URL. In this way you can call up these details using a flag or by calling the profile, instead of having to repeatedly add an API key and an environment URL to your commands.

To create a credentials profile run the following command:

mambu configure --profile="PROFILE_NAME" --apiKey="7g6f5e4d3c2b1a" --url=ANOTHER_MAMBU_TENANT.mambu.com

or, using the shortened flags:

mambu configure -p="PROFILE_NAME" -k="7g6f5e4d3c2b1a" -u=ANOTHER_MAMBU_TENANT.mambu.com
ExampleDescriptionRequired
mambu configureThis part of the command is always required and can be used without the profile flags below. Using it without the flags sets the default credentials.YES
-p or --profileThe name of the profile. This is used to call the profile when using its credentials in individual commands. If the profile name contains spaces or special characters, it should be bracketed by quotation marks. For example: -p="This is a profile name!".NO
-k or --apiKeyThe Mambu API key attached to the named profile.NO
-u or --urlThe URL of the Mambu environment attached to the named profile.NO

Using credentials profiles

There are two ways to use a credentials profile:

You can switch profiles so that any commands that follow use the profile that you have switched to.

export MAMBU_PROFILE="PROFILE_NAME"

Or, you can use the -p or --profile flag to define the credentials profile to use for that particular command.

mambu functions deploy . my-function -p="PROFILE_NAME"

Was this article helpful?