Skip to content

Commit

Permalink
feat(kafka create): return appropriate error for no regions (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkpattnaik780 authored Dec 19, 2022
1 parent cf0ebc0 commit 16d1a2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cmd/kafka/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ func promptKafkaPayload(opts *options, constants *remote.DynamicServiceConstants
return nil, err
}

if len(regionIDs) == 0 {
return nil, f.Localizer.MustLocalizeError("kafka.create.error.noRegionSupported")
}

regionPrompt := &survey.Select{
Message: f.Localizer.MustLocalize("kafka.create.input.cloudRegion.message"),
Options: regionIDs,
Expand Down
3 changes: 3 additions & 0 deletions pkg/core/localize/locales/en/cmd/kafka.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ one = '''
provided instance size is not valid. Valid sizes: {{.ValidSizes}}
'''

[kafka.create.error.noRegionSupported]
one = 'all regions in the selected cloud provider are temporarily unavailable'

[kafka.create.error.billing.invalid]
one = '''
provided billing account id and provider are invalid {{.Billing}}
Expand Down

0 comments on commit 16d1a2f

Please sign in to comment.