Flux v0.125.0 (#3023)

* added flux 0.125.0 release notes

* add webex teams package

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>

* Update content/influxdb/v2.0/reference/flux/stdlib/contrib/webexteams/endpoint.md

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
pull/3036/head
Scott Anderson 2021-08-18 09:04:56 -06:00 committed by GitHub
parent c6015ed787
commit 8e0becbef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 249 additions and 0 deletions

View File

@ -0,0 +1,15 @@
---
title: Flux Webex Teams package
list_title: Webex Teams package
description: >
The Flux Webex Teams package provides functions that send messages to
[Webex Teams](https://www.webex.com/team-collaboration.html).
menu:
influxdb_cloud_ref:
name: Webex Teams
parent: Contributed
weight: 202
influxdb/v2.0/tags: [functions, webex, package]
---
{{< duplicate-oss >}}

View File

@ -0,0 +1,13 @@
---
title: webexteams.endpoint() function
description: >
The `webexteams.endpoint()` function sends a single message to Webex using the
[Webex messages API](https://developer.webex.com/docs/api/v1/messages/create-a-message).
menu:
influxdb_cloud_ref:
name: webexteams.endpoint
parent: Webex Teams
weight: 202
---
{{< duplicate-oss >}}

View File

@ -0,0 +1,13 @@
---
title: webexteams.message() function
description: >
The `webexteams.message()` function sends a single message to Webex using the
[Webex messages API](https://developer.webex.com/docs/api/v1/messages/create-a-message).
menu:
influxdb_cloud_ref:
name: webexteams.message
parent: Webex Teams
weight: 202
---
{{< duplicate-oss >}}

View File

@ -0,0 +1,32 @@
---
title: Flux Webex Teams package
list_title: Webex Teams package
description: >
The Flux Webex Teams package provides functions that send messages to
[Webex Teams](https://www.webex.com/team-collaboration.html).
menu:
influxdb_2_0_ref:
name: Webex Teams
parent: Contributed
weight: 202
influxdb/v2.0/tags: [functions, webex, package]
---
The Flux Webex Teams package provides functions that send messages to
[Webex Teams](https://www.webex.com/team-collaboration.html).
Import the `contrib/sranka/webexteams` package:
```js
import "contrib/sranka/webexteams"
```
## Functions
{{< children type="functions" show="pages" >}}
{{% note %}}
#### Package author and maintainer
**Github:** [@sranka](https://github.com/sranka)
**InfluxDB Slack:** [@sranka](https://influxdata.com/slack)
{{% /note %}}

View File

@ -0,0 +1,77 @@
---
title: webexteams.endpoint() function
description: >
The `webexteams.endpoint()` function sends a single message to Webex using the
[Webex messages API](https://developer.webex.com/docs/api/v1/messages/create-a-message).
menu:
influxdb_2_0_ref:
name: webexteams.endpoint
parent: Webex Teams
weight: 202
---
The `webexteams.endpoint()` function returns a function that sends a message that
includes data from input rows to a Webex room.
```js
import "contrib/sranka/webexteams"
webexteams.endpoint(
url: "https://webexapis.com",
token: "token"
)
```
## Parameters
### url {data-type="string"}
Base URL of Webex API endpoint _(without a trailing slash)_.
Default is `https://webexapis.com`.
_**Data type**: String_
### token {data-type="string"}
({{< req >}})
[Webex API access token](https://developer.webex.com/docs/api/getting-started).
_**Data type**: String_
## Usage
`webexteams.endpoint` is a factory function that outputs another function.
The output function requires a `mapFn` parameter.
### mapFn
A function that builds the object used to generate the POST request.
Requires an `r` parameter.
_**Data type:** Function_
`mapFn` accepts a table row (`r`) and returns an object that must include the
following fields:
- `roomId`
- `text`
- `markdown`
_For more information, see [`webexteams.message()` parameters](/influxdb/v2.0/reference/flux/stdlib/contrib/webexteams/message/#parameters)._
## Examples
##### Send the last reported status to Webex Teams
```js
import "contrib/sranka/webexteams"
import "influxdata/influxdb/secrets"
token = secrets.get(key: "WEBEX_API_KEY")
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) => r._measurement == "statuses")
|> last()
|> tableFind(fn: (key) => true)
|> webexteams.endpoint(token: token)(mapFn: (r) => ({
roomId: "Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0",
text: "",
markdown: "Disk usage is **${r.status}**.",
})
```

View File

@ -0,0 +1,82 @@
---
title: webexteams.message() function
description: >
The `webexteams.message()` function sends a single message to Webex using the
[Webex messages API](https://developer.webex.com/docs/api/v1/messages/create-a-message).
menu:
influxdb_2_0_ref:
name: webexteams.message
parent: Webex Teams
weight: 202
---
The `webexteams.message()` function sends a single message to Webex using the
[Webex messages API](https://developer.webex.com/docs/api/v1/messages/create-a-message).
```js
import "contrib/sranka/webexteams"
webexteams.message(,
url: "https://webexapis.com"
token: "My5uP3rs3cRe7T0k3n",
roomId: "Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0",
text: "Example plain text message",
markdown: "Example [markdown message](https://developer.webex.com/docs/api/basics)."
)
```
## Parameters
### url {data-type="string"}
Base URL of Webex API endpoint _(without a trailing slash)_.
Default is `https://webexapis.com`.
_**Data type**: String_
### token {data-type="string"}
({{< req >}})
[Webex API access token](https://developer.webex.com/docs/api/getting-started).
_**Data type**: String_
### roomId {data-type="string"}
({{< req >}})
Room ID to send the message to.
_**Data type**: String_
### text {data-type="string"}
({{< req >}})
Plain text message.
_**Data type**: String_
### markdown {data-type="string"}
({{< req >}})
[Markdown formatted message](https://developer.webex.com/docs/api/basics#formatting-messages).
_**Data type**: String_
## Examples
##### Send the last reported status to Webex Teams
```js
import "contrib/sranka/webexteams"
import "influxdata/influxdb/secrets"
apiToken = secrets.get(key: "WEBEX_API_TOKEN")
lastReported =
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) => r._measurement == "statuses")
|> last()
|> findRecord(fn: (key) => true, idx: 0)
webexteams.message(
token: apiToken,
roomId: "Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0",
text: "Disk usage is ${lastReported.status}.",
markdown: "Disk usage is **${lastReported.status}**."
)
```

View File

@ -8,6 +8,23 @@ menu:
name: Flux
---
## v0.125.0 [2021-08-11]
### Features
- Add feature flag library as an internal package.
- Add narrow transformation transport.
- Add transport-aware dataset.
- Simplify the transport interface and add a transformation adapter.
- Add [`contrib/sranka/webexteams` package](/influxdb/v2.0/reference/flux/stdlib/contrib/webexteams/).
- Add optimized repeat function for arrow arrays.
- Add two additional internal message types.
### Bug fixes
- Update transformation adapter to return an error when receiving a flush key
for a table that is not present.
- Fix pivot operations when no data is left to operate on.
- Update `join()` to produce columns of equivalent length when combining mismatched schemas.
## v0.124.0 [2021-08-03]
### Features