Skip to content

Commit

Permalink
Add ZoneName type usage
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com>
  • Loading branch information
pierre-emmanuelJ committed Feb 6, 2024
1 parent dbbb3dc commit b75e990
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions v3/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions v3/generator/client/client.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func (c Client) GetZoneName(ctx context.Context, endpoint Endpoint) (ZoneName, e
return "", fmt.Errorf("get zone name: no matching zone for %s", endpoint)
}

func (c Client) GetZoneAPIEndpoint(ctx context.Context, zoneName string) (Endpoint, error) {
func (c Client) GetZoneAPIEndpoint(ctx context.Context, zoneName ZoneName) (Endpoint, error) {
resp, err := c.ListZones(ctx)
if err != nil {
return "", fmt.Errorf("get zone api endpoint: %w", err)
}
for _, zone := range resp.Zones {
if zone.Name == ZoneName(zoneName) {
if zone.Name == zoneName {
return zone.APIEndpoint, nil
}
}
Expand Down

0 comments on commit b75e990

Please # to comment.