Flux 0.152 (#3741)
* added release notes for Flux 0.150.0 - 0.152.0 * add experimental/iox package (#3737) * Add experimental/http/reqeusts package (#3736) * add experimental/http/reqeusts package * added link to flux release notespull/3750/head
parent
ddc41fa055
commit
094de70674
|
@ -10,6 +10,62 @@ aliases:
|
|||
- /influxdb/cloud/reference/release-notes/flux/
|
||||
---
|
||||
|
||||
## v0.152.0 [2022-01-31]
|
||||
|
||||
### Features
|
||||
- Add the [`experimental/http/requests` package](/flux/v0.x/stdlib/experimental/http/requests/)
|
||||
to support generic HTTP requests.
|
||||
- Add [`experimental/iox` package](/flux/v0.x/stdlib/experimental/iox/) and a
|
||||
placeholder for the `iox.from()` function.
|
||||
- Add dependency hooks to the dependency subsystem.
|
||||
- Remove unneeded feature flags.
|
||||
|
||||
### Bug fixes
|
||||
- Revert update to the dependencies package.
|
||||
- Return false if contains gets invalid value.
|
||||
|
||||
---
|
||||
|
||||
## v0.151.1 [2022-01-24]
|
||||
|
||||
### Features
|
||||
- Update to Rust 1.58.1.
|
||||
|
||||
---
|
||||
|
||||
## v0.151.0 [2022-01-20]
|
||||
|
||||
### Features
|
||||
- Expose `MonoType::parameter` and `MonoType::field`.
|
||||
|
||||
### Bug fixes
|
||||
- Support writing unsigned integers with the `http` provider.
|
||||
|
||||
---
|
||||
|
||||
## v0.150.1 [2022-01-19]
|
||||
|
||||
### Bug fixes
|
||||
- Remove duplicate `die` builtin in the `universe` package.
|
||||
|
||||
---
|
||||
|
||||
## v0.150.0 [2022-01-19]
|
||||
|
||||
### Features
|
||||
- Update inline documentation in the following packages:
|
||||
- date
|
||||
- experimental
|
||||
- testing
|
||||
- timezone
|
||||
- types
|
||||
|
||||
### Bug fixes
|
||||
- Make iterating the hashmap deterministic.
|
||||
- Quote SQL identifiers to mitigate the risk of SQL injection.
|
||||
|
||||
---
|
||||
|
||||
## v0.149.0 [2022-01-12]
|
||||
|
||||
### Features
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
title: Flux experimental http requests package
|
||||
list_title: requests package
|
||||
description: >
|
||||
The Flux experimental HTTP requests package provides functions for transferring data
|
||||
using HTTP protocol.
|
||||
Import the `experimental/http/requests` package.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: requests
|
||||
parent: http-exp
|
||||
weight: 301
|
||||
flux/v0.x/tags: [functions, http, package]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
The Flux experimental HTTP requests package provides functions for transferring data
|
||||
using HTTP protocol.
|
||||
Import the `experimental/http/requests` package:
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
```
|
||||
|
||||
## Options
|
||||
The `experimental/http/requests` package includes the following options:
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
option requests.defaultConfig = {
|
||||
insecureSkipVerify: false,
|
||||
timeout: 0ns,
|
||||
}
|
||||
```
|
||||
|
||||
### defaultConfig
|
||||
Global default for all HTTP requests using the `experimental/http/requests` package.
|
||||
Changing this option affects all other packages using the `experimental/http/requests` package.
|
||||
To change configuration options for a single request, pass a new configuration
|
||||
record directly into the corresponding function.
|
||||
|
||||
The `requests.defaultConfig` record contains the following properties:
|
||||
|
||||
- **insecureSkipVerify**: Skip TLS verification _(boolean)_. Default is `false`.
|
||||
- **timeout**: HTTP request timeout _(duration)_. Default is `0ns` (no timeout).
|
||||
|
||||
_See examples [below](#examples)._
|
||||
|
||||
## Functions
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
||||
|
||||
## Examples
|
||||
|
||||
### Change HTTP configuration options globally
|
||||
Modify the `requests.defaultConfig` option to change all consumers of the
|
||||
`experimental/http/requests` package.
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
option requests.defaultConfig = {
|
||||
// Set a default timeout of 5s for all requests
|
||||
timeout: 0ns,
|
||||
insecureSkipVerify: true,
|
||||
}
|
||||
```
|
||||
|
||||
### Change configuration for a single request
|
||||
To change the configuration for a single request, extending the default
|
||||
configuration with only the configuration values you need to customize.
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
// NOTE: Flux syntax does not yet let you specify anything but an identifier as
|
||||
// the record to extend. As a workaround, this example rebinds the default
|
||||
// configuration to a new name, "config".
|
||||
// See https://github.com/influxdata/flux/issues/3655
|
||||
defaultConfig = requests.defaultConfig
|
||||
config = {defaultConfig with
|
||||
// Change the timeout to 60s for this request
|
||||
// NOTE: We don't have to specify any other properites of the config because we're
|
||||
// extending the default.
|
||||
timeout: 60s,
|
||||
}
|
||||
|
||||
requests.get(url:"http://example.com", config: config)
|
||||
```
|
|
@ -0,0 +1,107 @@
|
|||
---
|
||||
title: requests.do() function
|
||||
description: >
|
||||
`requests.do()` makes an HTTP request using the specified request method.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: requests.do
|
||||
parent: requests
|
||||
weight: 401
|
||||
flux/v0.x/tags: [http, inputs]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
`requests.do()` makes an HTTP request using the specified request method.
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
requests.do(
|
||||
method: "GET",
|
||||
url: "http://example.com",
|
||||
params: [:],
|
||||
headers: [:],
|
||||
body: bytes(v: ""),
|
||||
config: requests.defaultConfig,
|
||||
)
|
||||
```
|
||||
|
||||
`requests.do()` returns a record with the following properties:
|
||||
|
||||
- **statusCode**: HTTP status code of the request.
|
||||
- **body**: Response body. A maximum size of 100MB is read from the response body.
|
||||
- **headers**: Response headers.
|
||||
|
||||
## Parameters
|
||||
|
||||
### method {data-type="string"}
|
||||
HTTP request method.
|
||||
|
||||
**Supported methods**:
|
||||
- DELETE
|
||||
- GET
|
||||
- HEAD
|
||||
- PATCH
|
||||
- POST
|
||||
- PUT
|
||||
|
||||
### url {data-type="string"}
|
||||
URL to send the request to.
|
||||
|
||||
{{% note %}}
|
||||
The URL should not include any query parameters.
|
||||
Use [`params`](#params) to specify query parameters.
|
||||
{{% /note %}}
|
||||
|
||||
### params {data-type="dict"}
|
||||
Set of key-value pairs to add to the URL as query parameters.
|
||||
Query parameters are URL-encoded.
|
||||
All values for a key are appended to the query.
|
||||
|
||||
### headers {data-type="dict"}
|
||||
Set of key values pairs to include as request headers.
|
||||
|
||||
### body {data-type="bytes"}
|
||||
Data to send with the request.
|
||||
|
||||
### config {data-type="record"}
|
||||
Set of request configuration options.
|
||||
|
||||
## Examples
|
||||
|
||||
- [Make a GET request](#make-a-get-request)
|
||||
- [Make a GET request with authorization](#make-a-get-request-with-authorization)
|
||||
- [Make a GET request with query parameters](#make-a-get-request-with-query-parameters)
|
||||
|
||||
### Make a GET request
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
requests.do(url:"http://example.com", method: "GET")
|
||||
```
|
||||
|
||||
### Make a GET request with authorization
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
import "influxdata/influxdb/secrets"
|
||||
|
||||
token = secrets.get(key:"TOKEN")
|
||||
|
||||
requests.do(
|
||||
method: "GET",
|
||||
url: "http://example.com",
|
||||
headers: ["Authorization": "Token ${token}"],
|
||||
)
|
||||
```
|
||||
|
||||
### Make a GET request with query parameters
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
resp = requests.do(
|
||||
method: "GET",
|
||||
url: "http://example.com",
|
||||
params: ["start": ["100"]],
|
||||
)
|
||||
```
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
title: requests.get() function
|
||||
description: >
|
||||
`requests.get()` makes an HTTP request using the GET request method.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: requests.get
|
||||
parent: requests
|
||||
weight: 401
|
||||
flux/v0.x/tags: [http, inputs]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
`requests.get()` makes an HTTP request using the GET request method.
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
requests.get(
|
||||
url: "http://example.com",
|
||||
params: [:],
|
||||
headers: [:],
|
||||
body: bytes(v: ""),
|
||||
config: requests.defaultConfig,
|
||||
)
|
||||
```
|
||||
|
||||
`requests.get()` returns a record with the following properties:
|
||||
|
||||
- **statusCode**: HTTP status code of the request.
|
||||
- **body**: Response body. A maximum size of 100MB is read from the response body.
|
||||
- **headers**: Response headers.
|
||||
|
||||
## Parameters
|
||||
|
||||
### url {data-type="string"}
|
||||
URL to send the request to.
|
||||
|
||||
{{% note %}}
|
||||
The URL should not include any query parameters.
|
||||
Use [`params`](#params) to specify query parameters.
|
||||
{{% /note %}}
|
||||
|
||||
### params {data-type="dict"}
|
||||
Set of key-value pairs to add to the URL as query parameters.
|
||||
Query parameters are URL-encoded.
|
||||
All values for a key are appended to the query.
|
||||
|
||||
### headers {data-type="dict"}
|
||||
Set of key values pairs to include as request headers.
|
||||
|
||||
### body {data-type="bytes"}
|
||||
Data to send with the request.
|
||||
|
||||
### config {data-type="record"}
|
||||
Set of request configuration options.
|
||||
|
||||
## Examples
|
||||
|
||||
### Make a GET request
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
requests.get(url:"http://example.com")
|
||||
```
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
title: requests.post() function
|
||||
description: >
|
||||
`requests.post()` makes an HTTP request using the POST request method.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: requests.post
|
||||
parent: requests
|
||||
weight: 401
|
||||
flux/v0.x/tags: [http, inputs]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
`requests.post()` makes an HTTP request using the POST request method.
|
||||
|
||||
```js
|
||||
import "experimental/http/requests"
|
||||
|
||||
requests.post(
|
||||
url: "http://example.com",
|
||||
params: [:],
|
||||
headers: [:],
|
||||
body: bytes(v: ""),
|
||||
config: requests.defaultConfig,
|
||||
)
|
||||
```
|
||||
|
||||
`requests.post()` returns a record with the following properties:
|
||||
|
||||
- **statusCode**: HTTP status code of the request.
|
||||
- **body**: Response body. A maximum size of 100MB is read from the response body.
|
||||
- **headers**: Response headers.
|
||||
|
||||
## Parameters
|
||||
|
||||
### url {data-type="string"}
|
||||
URL to send the request to.
|
||||
|
||||
{{% note %}}
|
||||
The URL should not include any query parameters.
|
||||
Use [`params`](#params) to specify query parameters.
|
||||
{{% /note %}}
|
||||
|
||||
### params {data-type="dict"}
|
||||
Set of key-value pairs to add to the URL as query parameters.
|
||||
Query parameters are URL-encoded.
|
||||
All values for a key are appended to the query.
|
||||
|
||||
### headers {data-type="dict"}
|
||||
Set of key values pairs to include as request headers.
|
||||
|
||||
### body {data-type="bytes"}
|
||||
Data to send with the request.
|
||||
|
||||
### config {data-type="record"}
|
||||
Set of request configuration options.
|
||||
|
||||
## Examples
|
||||
|
||||
### Make a POST request
|
||||
```js
|
||||
import "json"
|
||||
import "experimental/http/requests"
|
||||
|
||||
resp = requests.post(url:"http://example.com", body: json.encode(v: {data: {x:1, y: 2, z:3}))
|
||||
```
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: Flux Experimental IOx package
|
||||
list_title: iox package
|
||||
description: >
|
||||
The Flux experimental `iox` package provides functions for querying data from IOx.
|
||||
Import the `experimental/iox` package.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: iox
|
||||
parent: experimental
|
||||
weight: 301
|
||||
flux/v0.x/tags: [functions, iox, package]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
The experimental `iox` package provides functions for querying data from [IOx](https://github.com/influxdata/influxdb_iox).
|
||||
Import the `experimental/iox` package:
|
||||
|
||||
```js
|
||||
import 'experimental/iox';
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: iox.from() function
|
||||
description: >
|
||||
`iox.from()` queries data from the specified bucket and measurement in an IOx
|
||||
storage node.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: iox.from
|
||||
parent: iox
|
||||
weight: 401
|
||||
flux/v0.x/tags: [iox, inputs]
|
||||
introduced: 0.152.0
|
||||
---
|
||||
|
||||
{{% warn %}}
|
||||
`iox.from()` is in active development and has not been fully implemented.
|
||||
This function acts as a placeholder as the implementation is completed.
|
||||
{{% /warn %}}
|
||||
|
||||
`iox.from()` queries data from the specified bucket and measurement in an
|
||||
[IOx](https://github.com/influxdata/influxdb_iox) storage node.
|
||||
|
||||
```js
|
||||
import "experimental/iox"
|
||||
|
||||
iox.from(
|
||||
bucket: "example-bucket",
|
||||
measurement: "example-measurement",
|
||||
)
|
||||
```
|
||||
|
||||
Output data is "pivoted" on the time column and includes columns for each
|
||||
returned tag and field per time value.
|
||||
|
||||
## Parameters
|
||||
|
||||
### bucket {data-type="string"}
|
||||
IOx bucket to read data from.
|
||||
|
||||
### measurement {data-type="string"}
|
||||
Measurement to read data from.
|
||||
|
Loading…
Reference in New Issue