aboutsummaryrefslogtreecommitdiff
path: root/clients/netbox/gql_dns_servers.go
blob: 67b4ad69b1da89fe63fdba9bde9347026e2f6145 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package netbox

const dnsServerGQLQuery = `fragment VMHostDetails on VMInterfaceType{
	virtual_machine {
    site {
      name
    }
  }
}

fragment HostDetails on InterfaceType {
  device {
    site {
      name
    }
  }
}

query {
  ip_address_list(tag:"dns-server") {
    address
    assigned_object{
      ...VMHostDetails
      ...HostDetails
    }
  }
}`

type dnsServerGQLResponse struct {
	Data struct {
		AddressList []struct {
			Address        string `json:"address"`
			AssignedObject struct {
				VirtualMachine struct {
					Site struct {
						Name string `json:"name"`
					} `json:"site"`
				} `json:"virtual_machine"`
				Device struct {
					Site struct {
						Name string `json:"name"`
					} `json:"site"`
				} `json:"device"`
			} `json:"assigned_object"`
		} `json:"ip_address_list"`
	} `json:"data"`
}