| 1 |
package client_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
"io/ioutil" |
| 6 |
"testing" |
| 7 |
|
| 8 |
"github.com/influxdb/enterprise-client/v1" |
| 9 |
"github.com/stretchr/testify/require" |
| 10 |
) |
| 11 |
|
| 12 |
func Test_Server_Implements_Saveable(t *testing.T) { |
| 13 |
r := require.New(t) |
| 14 |
r.Implements((*client.Saveable)(nil), client.Server{}) |
| 15 |
} |
| 16 |
|
| 17 |
// Example of saving a server to Enterprise |
| 18 |
func Example_saveServer() { |
| 19 |
c := client.New("token-goes-here") |
| 20 |
// override the URL for testing |
| 21 |
c.URL = "https://enterprise.staging.influxdata.com" |
| 22 |
|
| 23 |
s := client.Server{ |
| 24 |
ClusterID: "clus1", |
| 25 |
Host: "example.com", |
| 26 |
Product: "jambox", |
| 27 |
Version: "1.0", |
| 28 |
ServerID: "serv1", |
| 29 |
} |
| 30 |
|
| 31 |
res, err := c.Save(s) |
| 32 |
fmt.Printf("err: %s\n", err) |
| 33 |
b, _ := ioutil.ReadAll(res.Body) |
| 34 |
fmt.Printf("b: %s\n", b) |
| 35 |
} |