added cloud-only url replacement

pull/1197/head
Scott Anderson 2020-07-11 22:25:25 -06:00
parent 59c810712e
commit ed272f713b
6 changed files with 41 additions and 16 deletions

View File

@ -625,6 +625,19 @@ http://localhost:9999
``` ```
~~~ ~~~
### Code examples only supported in InfluxDB Cloud
Some functionality is only supported in InfluxDB Cloud and code examples should
only use InfluxDB Cloud URLs. In these cases, use `https://cloud2.influxdata.com`
as the placeholder in the code block. It will get updated on page load and when
users select a Cloud region in the URL select modal.
~~~
```sh
# This URL will get updated
https://cloud2.influxdata.com
```
~~~
## New Versions of InfluxDB ## New Versions of InfluxDB
Version bumps occur regularly in the documentation. Version bumps occur regularly in the documentation.
Each minor version has its own directory with unique content. Each minor version has its own directory with unique content.

View File

@ -1,4 +1,6 @@
var defaultUrl = "http://localhost:9999" var defaultUrl = "http://localhost:9999"
var placeholderCloudUrl = "https://cloud2.influxdata.com"
var defaultCloudUrl = "https://us-west-2-1.aws.cloud2.influxdata.com"
var elementSelector = ".article--content pre:not(.preserve)" var elementSelector = ".article--content pre:not(.preserve)"
// Retrieve the selected URL from the influxdb_url session cookie // Retrieve the selected URL from the influxdb_url session cookie
@ -99,6 +101,16 @@ updateUrls(defaultUrl, getUrl())
// Append URL selector buttons to code blocks // Append URL selector buttons to code blocks
appendUrlSelector(getUrl()) appendUrlSelector(getUrl())
// Append URL selector buttons to cloud-only code blocks
appendUrlSelector(placeholderCloudUrl)
// Update cloud-only URLs on load
if (cloudUrls.includes(getUrl())) {
updateUrls(placeholderCloudUrl, getUrl())
} else {
updateUrls(placeholderCloudUrl, defaultCloudUrl)
}
// Update URLs whenever you focus on the browser tab // Update URLs whenever you focus on the browser tab
$(window).focus(function() { $(window).focus(function() {
updateUrls(getPrevUrl(), getUrl()) updateUrls(getPrevUrl(), getUrl())

View File

@ -34,7 +34,7 @@ Provide the following:
{{% /note %}} {{% /note %}}
```sh ```sh
curl -G http://localhost:9999/query?db=db&rp=rp \ curl -G https://cloud2.influxdata.com/query?db=db&rp=rp \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1" --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
``` ```

View File

@ -84,7 +84,7 @@ manually create and manage DBRP mappings.
<!-- --> <!-- -->
```sh ```sh
curl -XPOST http://localhost:9999/api/v2/dbrps \ curl -XPOST https://cloud2.influxdata.com/api/v2/dbrps \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
-H 'Content-type: application/json' \ -H 'Content-type: application/json' \
-d '{ -d '{

View File

@ -12,7 +12,7 @@ v2.0/tags: [influxql, query]
products: [cloud] products: [cloud]
list_code_example: | list_code_example: |
<pre> <pre>
<span class="api get">GET</span> http://localhost:9999/query <span class="api get">GET</span> https://cloud2.influxdata.com/query
</pre> </pre>
related: related:
- /v2.0/query-data/influxql - /v2.0/query-data/influxql
@ -22,7 +22,7 @@ The `/query` 1.x compatibility endpoint queries InfluxDB 2.0 using **InfluxQL**.
Use the `GET` request method to query data from the `/query` endpoint. Use the `GET` request method to query data from the `/query` endpoint.
<pre> <pre>
<span class="api get">GET</span> `http://localhost:9999/query` <span class="api get">GET</span> https://cloud2.influxdata.com/query
</pre> </pre>
The `/query` compatibility endpoint use the **database** and **retention policy** The `/query` compatibility endpoint use the **database** and **retention policy**
@ -82,7 +82,7 @@ The following precisions are available:
##### Query using basic authentication ##### Query using basic authentication
```sh ```sh
curl -G http://localhost:9999/query \ curl -G https://cloud2.influxdata.com/query \
-u username:YourAuthToken \ -u username:YourAuthToken \
--data-urlencode "db=mydb" \ --data-urlencode "db=mydb" \
--data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1" --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
@ -90,7 +90,7 @@ curl -G http://localhost:9999/query \
##### Query a non-default retention policy ##### Query a non-default retention policy
```sh ```sh
curl -G http://localhost:9999/query \ curl -G https://cloud2.influxdata.com/query \
-H "Authorization: Basic username:YourAuthToken" \ -H "Authorization: Basic username:YourAuthToken" \
--data-urlencode "db=mydb" \ --data-urlencode "db=mydb" \
--data-urlencode "rp=customrp" \ --data-urlencode "rp=customrp" \
@ -99,7 +99,7 @@ curl -G http://localhost:9999/query \
##### Execute multiple queries ##### Execute multiple queries
```sh ```sh
curl -G http://localhost:9999/query \ curl -G https://cloud2.influxdata.com/query \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-urlencode "db=mydb" \ --data-urlencode "db=mydb" \
--data-urlencode "q=SELECT * FROM mem WHERE host=host1;SELECT mean(used_percent) FROM mem WHERE host=host1 GROUP BY time(10m)" --data-urlencode "q=SELECT * FROM mem WHERE host=host1;SELECT mean(used_percent) FROM mem WHERE host=host1 GROUP BY time(10m)"
@ -107,7 +107,7 @@ curl -G http://localhost:9999/query \
##### Return query results with millisecond Unix timestamps ##### Return query results with millisecond Unix timestamps
```sh ```sh
curl -G http://localhost:9999/query \ curl -G https://cloud2.influxdata.com/query \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-urlencode "db=mydb" \ --data-urlencode "db=mydb" \
--data-urlencode "rp=myrp" \ --data-urlencode "rp=myrp" \
@ -117,7 +117,7 @@ curl -G http://localhost:9999/query \
##### Use curl to execute InfluxQL queries from a file ##### Use curl to execute InfluxQL queries from a file
```sh ```sh
curl -G http://localhost:9999/query \ curl -G https://cloud2.influxdata.com/query \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-urlencode "db=mydb" \ --data-urlencode "db=mydb" \
-F "q=@path/to/influxql.txt" -F "q=@path/to/influxql.txt"

View File

@ -13,7 +13,7 @@ v2.0/tags: [write]
products: [cloud] products: [cloud]
list_code_example: | list_code_example: |
<pre> <pre>
<span class="api post">POST</span> http://localhost:9999/write <span class="api post">POST</span> https://cloud2.influxdata.com/write
</pre> </pre>
related: related:
- /v2.0/reference/syntax/line-protocol - /v2.0/reference/syntax/line-protocol
@ -25,7 +25,7 @@ Use the `POST` request method to write [line protocol](/v2.0/reference/syntax/li
to the `/write` endpoint. to the `/write` endpoint.
<pre> <pre>
<span class="api post">POST</span> http://localhost:9999/write <span class="api post">POST</span> https://cloud2.influxdata.com/write
</pre> </pre>
## Authentication ## Authentication
@ -72,21 +72,21 @@ The following precisions are available:
##### Write data using basic authentication ##### Write data using basic authentication
```sh ```sh
curl -XPOST http://localhost:9999/write?db=mydb \ curl -XPOST https://cloud2.influxdata.com/write?db=mydb \
-H "Authorization: Basic username:YourAuthToken" \ -H "Authorization: Basic username:YourAuthToken" \
--data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000"
``` ```
##### Write data to a non-default retention policy ##### Write data to a non-default retention policy
```sh ```sh
curl -XPOST http://localhost:9999/write?db=mydb&rp=customrp \ curl -XPOST https://cloud2.influxdata.com/write?db=mydb&rp=customrp \
-H "Authorization: Basic username:YourAuthToken" \ -H "Authorization: Basic username:YourAuthToken" \
--data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000"
``` ```
##### Write multiple lines of line protocol ##### Write multiple lines of line protocol
```sh ```sh
curl -XPOST http://localhost:9999/write?db=mydb \ curl -XPOST https://cloud2.influxdata.com/write?db=mydb \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000 --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000
measurement,host=host2 field1=14i,field2=12.7 1577836800000000000 measurement,host=host2 field1=14i,field2=12.7 1577836800000000000
@ -95,14 +95,14 @@ measurement,host=host3 field1=5i,field2=6.8 1577836800000000000"
##### Write data with millisecond Unix timestamps ##### Write data with millisecond Unix timestamps
```sh ```sh
curl -XPOST http://localhost:9999/write?db=mydb&precision=ms \ curl -XPOST https://cloud2.influxdata.com/write?db=mydb&precision=ms \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000"
``` ```
##### Use curl to write data from a file ##### Use curl to write data from a file
```sh ```sh
curl -XPOST http://localhost:9999/write?db=mydb \ curl -XPOST https://cloud2.influxdata.com/write?db=mydb \
-H "Authorization: Token YourAuthToken" \ -H "Authorization: Token YourAuthToken" \
--data-binary @path/to/line-protocol.txt --data-binary @path/to/line-protocol.txt
``` ```