Skip to content

Commit

Permalink
api for getting nearest wireguard gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldwan committed May 5, 2021
1 parent 1d9b462 commit 331368b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions api/resource_wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,22 @@ query($slug: String!) {

return *data.Organization.DelegatedWireGuardTokens.Nodes, nil
}

func (c *Client) ClosestWireguardGatewayRegion() (*Region, error) {
req := c.NewRequest(`
query {
nearestRegion(wireguardGateway: true) {
code
name
gatewayAvailable
}
}
`)

data, err := c.Run(req)
if err != nil {
return nil, err
}

return data.NearestRegion, nil
}
2 changes: 2 additions & 0 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type Query struct {
VMSizes []VMSize
}

NearestRegion *Region

// aliases & nodes

TemplateDeploymentNode *TemplateDeployment
Expand Down

0 comments on commit 331368b

Please sign in to comment.