Getting started
In this tutorial, you’ll learn to create and deploy a snap-in. Additionally, you’ll learn to create a snap-in version, installing from a version, deploying, deleting and upgrading the snap-in.
Background context
Snap-ins are collections of objects that extend DevRev’s core platform value. These objects include automation, event sources, keyrings, custom types, and vistas. Snap-ins are packaged and installed separately from the DevRev core platform. To create your very own snap-in, create a dev org where you will be installing your snap-in.
Initializing a snap-in template
To initialize a snap-in template, run the following command:
After the command runs, a new folder devrev-snaps-typescript-template
is
created in the filesystem.
The command creates a folder devrev-snaps-typescript-template
. This contains a manifest.yaml
file and a code
folder.
manifest
file defines the resources to be created on the DevRev platform. For detailed information on the various components of a manifest file, see Snap-in Manifest.code
folder consists of sample starter code for snap-ins. For detailed information on how to get started, see starter example repo.
Creating a snap-in package
To create a snap-in package, run the following command:
- The slug is globally unique. If the slug provided is already taken, a conflict error occurs. This can be resolved by provided a different slug.
- On successful creation, the CLI automatically stores the package ID in its context corresponding to the slug. For more information, refer to the Snap-in Context.
Creating a snap-in version
To create a snap-in version, run the following command:
Output:
The CLI automatically stores the version ID in its context. Refer to the Snap-in Context section for more information.
In a package that’s not published to the marketplace, you can have only one snap-in version. If you have an existing snap-in version in the package, the following error message is shown:
To list snap-in versions under the package, run the following command:
To delete the snap-in version, run the following command:
Installing a snap-in from a snap-in version
To create a snap-in from a snap-in version, run the following command:
To install the snap-in, you must be a member of the Admins group in the dev org.
The CLI automatically stores the snap-in ID in its context. Refer to the Snap-in Context section for more information.
Configuring the snap-in
The snap-in is installed in draft state. It may require some configuration before it can be deployed.
You can access snap-in configuration by using the URL generated by the draft command, or by navigating to the snap-ins page in the DevRev app.
Follow the configuration steps for the snap-in to setup keyrings and inputs if any.
Private keyrings from other creators aren’t listed.
To make a connection available to other members in your organisation, create it with the visible to dev org option set to true while creating the connection in the DevRev app.
Deploying the snap-in
Once you have provided the required configuration, the Deploy snap-in button is enabled on the UI. Click on it to deploy the snap-in. That’s it, the snap-in should now be active and ready to use.
Deleting the snap-in
The snap-in can be deleted from the UI or run the following command:
If any deactivate hook is specified, it’s invoked with is_deletion=true
.
Upgrading the snap-in
Once you deploy and test your snap-in, you may want to make changes to it. The changes can be done using a single command.
The above expects the manifest file to be present in the current directory by the name manifest.yaml
and the code to be present in the code
directory.
Refer to upgrade command for more information.