russellcardullo / go-pingdom

No longer maintained: Pingdom API access from Go
MIT License
29 stars 75 forks source link

Add option to create HTTP check with IPV6 #70

Open duffn opened 3 years ago

duffn commented 3 years ago

This adds the ability to create an HTTP check with the IPV6 option checked. This also fixes ip6 -> ipv6 in the CheckResponse struct.

package main

import (
    "fmt"

    "github.com/russellcardullo/go-pingdom/pingdom"
)

func main() {
    client, _ := pingdom.NewClientWithConfig(pingdom.ClientConfig{
        APIToken: "token",
    })

    newCheck := pingdom.HttpCheck{Name: "Test Check", Hostname: "www.google.com", Resolution: 5}
    check, _ := client.Checks.Create(&newCheck)
    fmt.Printf("%+v\n", check)

    ipv6 := true
    newCheck2 := pingdom.HttpCheck{Name: "Test Check 2", Hostname: "www.google.com", Resolution: 5, IPV6: &ipv6}
    check2, _ := client.Checks.Create(&newCheck2)
    fmt.Printf("%+v\n", check2)
}
Screen Shot 2021-10-06 at 2 08 05 PM Screen Shot 2021-10-06 at 2 08 36 PM

Closes #69