Skip to content

Commit f1fcb00

Browse files
author
Andy
authored
Merge pull request #875 from segmentio/functions-rewrite
Rewrite docs for Functions
2 parents 1414aca + 0eda5b8 commit f1fcb00

36 files changed

+912
-301
lines changed

src/_data/sidenav/main.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ sections:
144144
title: All about Cloud Sources
145145
- path: /connections/sources/custom-domains
146146
title: Set up a custom domain proxy in Segment
147-
- path: /connections/sources/source-functions
148-
title: Source Functions
149147
- path: /connections/sources/visual-tagger
150148
title: Visual Tagger
151149
- section_title: Destinations
@@ -158,8 +156,19 @@ sections:
158156
menu_icon: read-more
159157
- path: /connections/destinations/destination-filters
160158
title: Destination Filters
161-
- path: /connections/destinations/destination-functions
159+
- section_title: Functions
160+
slug: connections/functions
161+
section:
162+
- path: /connections/functions
163+
title: Functions Overview
164+
- path: /connections/functions/source-functions
165+
title: Source Functions
166+
- path: /connections/functions/destination-functions
162167
title: Destination Functions
168+
- path: /connections/functions/environment
169+
title: Functions environment
170+
- path: /connections/functions/usage
171+
title: Functions usage limits
163172
- section_title: Data Storage
164173
slug: connections/storage
165174
section:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Functions have specific roles which can be used for [access management](/docs/segment-app/iam/) in your Segment workspace.
2+
3+
Access to functions is controlled by two permissions [roles](/docs/segment-app/iam/roles/):
4+
5+
- **Functions Admin:** Create, edit and delete all functions, or a subset of specified functions.
6+
- **Functions Read-only:** View all functions, or a subset of specified functions.
7+
8+
You also need additional **Source Admin** permissions to enable source functions, connect destination functions to a source, or to deploy changes to existing functions.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Functions use Node.js 10.x.
2+
3+
Functions do not currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/) to request that one be added.
4+
5+
The following dependencies are installed in the function environment by default.
6+
7+
- [`atob v2.1.2`](https://www.npmjs.com/package/atob) exposed as `atob`
8+
- [`aws-sdk v2.488.0`](https://www.npmjs.com/package/aws-sdk) exposed as `AWS`
9+
- [`btoa v1.2.1`](https://www.npmjs.com/package/btoa) exposed as `btoa`
10+
- [`form-data v2.4.0`](https://www.npmjs.com/package/form-data) exposed as `FormData`
11+
- [`lodash v4.17.15`](https://www.npmjs.com/package/lodash) exposed as `_`
12+
- [`node-fetch v2.6.0`](https://www.npmjs.com/package/node-fetch) exposed as `fetch`
13+
- [`oauth v0.9.15`](https://www.npmjs.com/package/oauth) exposed as `OAuth`
14+
- [`xml v1.0.1`](https://www.npmjs.com/package/lodash) exposed as `xml`
15+
16+
Only the [`crypto` Node.js module](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html ) is included (exposed as `crypto`). [Other built-in Node.js modules](https://nodejs.org/api/modules.html) are not available.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- usually placed under a heading called "Settings and Secrets" -->
2+
3+
Settings allow you to pass configurable variables to your function, which is the best way to pass sensitive information such as security tokens. For example, you might use `settings` as placeholders to use information such as an API endpoint and API key. This way, you can use the same code with different settings for different purposes. When you deploy a function in your workspace, you are prompted to fill out these settings to configure the function.
4+
5+
First, add a setting in **Settings** tab in the code editor:
6+
7+
![Settings Tab](/docs/connections/functions/images/settings-tab-empty.jpg){:width="500"}
8+
9+
Click **Add Setting** to add your new setting.
10+
11+
![Add Setting Dialog](/docs/connections/functions/images/add-setting-dialog.jpg)
12+
13+
You can configure the details about this setting, which change how it's displayed to anyone using your function:
14+
15+
- **Label** - Name of the setting, which users see when configuring the function.
16+
- **Name** - Auto-generated name of the setting to use in function's source code.
17+
- **Type** - Type of the setting's value.
18+
- **Description** - Optional description, which appears below the setting name.
19+
- **Required** - Enable this to ensure that the setting cannot be saved without a value.
20+
- **Encrypted** - Enable to encrypt the value of this setting. Use this setting for sensitive data, like API keys.
21+
22+
As you change the values, a preview to the right updates to show how your setting will look and work.
23+
24+
Click **Add Setting** to save the new setting.
25+
26+
Once you save a setting, it appears in the **Settings** tab for the function. You can edit or delete settings from this tab.
27+
28+
![Settings Tab](/docs/connections/functions/images/settings-tab-non-empty.jpg){:width="500"}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)