File: helpers.go

package info (click to toggle)
golang-github-nesv-go-dynect 0.6.0%2Bgit20190806.63e11f6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 220 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dynect

import "fmt"

func GetAllDSFServicesDetailed(c *Client) (error, []DSFService) {
	var dsfsResponse AllDSFDetailedResponse
	requestData := struct {
		Detail string `json:"detail"`
	}{Detail: "Y"}

	if err := c.Do("GET", "DSF", requestData, &dsfsResponse); err != nil {
		return err, nil
	}

	return nil, dsfsResponse.Data
}

func GetDSFServiceDetailed(c *Client, id string) (error, DSFService) {
	var dsfsResponse DSFResponse
	requestData := struct {
		Detail string `json:"detail"`
	}{Detail: "Y"}

	loc := fmt.Sprintf("DSF/%s", id)

	if err := c.Do("GET", loc, requestData, &dsfsResponse); err != nil {
		return err, DSFService{}
	}
	return nil, dsfsResponse.Data
}