https://github.com/gadost/go-lwapi
Leaseweb Dedicated & Virtual Servers V2 JSON-RPC API in Golang
https://github.com/gadost/go-lwapi
api-client golang leaseweb leaseweb-api
Last synced: 6 months ago
JSON representation
Leaseweb Dedicated & Virtual Servers V2 JSON-RPC API in Golang
- Host: GitHub
- URL: https://github.com/gadost/go-lwapi
- Owner: gadost
- License: mit
- Created: 2022-07-17T22:04:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-03T14:49:45.000Z (over 2 years ago)
- Last Synced: 2024-06-21T11:51:11.391Z (about 2 years ago)
- Topics: api-client, golang, leaseweb, leaseweb-api
- Language: Go
- Homepage:
- Size: 91.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-lwapi
Leaseweb Dedicated & Virtual Servers V2 JSON-RPC API in Golang
[](https://travis-ci.org/gadost/go-lwapi) [](https://godoc.org/github.com/gadost/go-lwapi) [](https://codecov.io/gh/gadost/go-lwapi) [](https://goreportcard.com/report/github.com/gadost/go-lwapi)
## Install
```sh
go get -u github.com/gadost/go-lwapi@latest
```
## Example
```go
package main
import (
"github.com/gadost/go-lwapi"
)
func main() {
// Dedicated Server AAPI
api := lwapi.New("testtoken").DedicatedServers()
resp, err := api.ServerReferenceUpdate(12345, &lwapi.Reference{Reference: "test-server"})
...
// Virtual Server API
api := lwapi.New("testtoken").VirtualServers()
resp, err := api.VirtualServer(12345)
...
}
```
## Query params
```go
api := lwapi.New("testtoken").DedicatedServers()
q := make(map[string]interface{})
q["limit"] = 20
q["privateNetworkEnabled"] = "true"
q["ip"] = "127.0.0.1"
resp, err := api.Servers(q)
...
```
## Time helper ISO-8601
```go
to := FormatISO8601(time.Now().Add(60*time.Day))
```
returns time in ISO-8601 format