Skip to content

Commit

Permalink
Merge pull request #345 from superfly:codepope/issue344
Browse files Browse the repository at this point in the history
Add support to * regions with gateways
  • Loading branch information
codepope committed Dec 17, 2020
2 parents 18d75de + 450fb5d commit 2fabdcf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions api/resource_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ func (c *Client) PlatformRegions() ([]Region, error) {
regions {
name
code
gatewayAvailable
}
}
}
Expand All @@ -31,6 +32,7 @@ func (c *Client) PlatformRegionsAll() ([]Region, error) {
code
latitude
longitude
gatewayAvailable
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,10 +611,11 @@ type CheckState struct {
}

type Region struct {
Code string
Name string
Latitude float32
Longitude float32
Code string
Name string
Latitude float32
Longitude float32
GatewayAvailable bool
}

type AutoscalingConfig struct {
Expand Down
11 changes: 8 additions & 3 deletions cmd/presenters/regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ func (p *Regions) APIStruct() interface{} {
}

func (p *Regions) FieldNames() []string {
return []string{"Code", "Name"}
return []string{"Code", "Name", "Gateway"}
}

func (p *Regions) Records() []map[string]string {
out := []map[string]string{}

for _, region := range p.Regions {
gateway := ""
if region.GatewayAvailable {
gateway = "✓"
}
out = append(out, map[string]string{
"Code": region.Code,
"Name": region.Name,
"Code": region.Code,
"Name": region.Name,
"Gateway": gateway,
})
}

Expand Down

0 comments on commit 2fabdcf

Please sign in to comment.