Skip to content

Commit

Permalink
Merge pull request #532 from AlexanderZagaynov/BZ-1705565_new_regions…
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare authored and simaishi committed Jul 22, 2019
1 parent e7e8b44 commit 7ff93bc
Show file tree
Hide file tree
Showing 8 changed files with 2,017 additions and 307 deletions.
12 changes: 12 additions & 0 deletions app/models/manageiq/providers/amazon/regions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ module Regions
ManageIQ::Providers::Amazon::Engine.root.join('db/fixtures/aws_regions.yml')
).each_value(&:freeze).freeze

# https://github.com/aws/aws-sdk-ruby/blob/5fe5795e8910bb667996dfc75e4f16b7e69e3980/gems/aws-partitions/partitions.json#L11
ORDINARY_REGIONS_REGEXP = /^(us|eu|ap|sa|ca)\-\w+\-\d+$/

# https://docs.aws.amazon.com/general/latest/gr/rande.html - see quotes below
SPECIAL_REGIONS = begin
atypical_regions = [
'ap-northeast-3', # "To request access to the Asia Pacific (Osaka-Local) Region, contact..."
'ap-east-1', # "you must manually enable before you can use..."
].freeze
REGIONS.keys.select { |name| atypical_regions.include?(name) || name !~ ORDINARY_REGIONS_REGEXP }
end.freeze

def self.regions
additional_regions = Hash(Settings.ems.ems_amazon.try!(:additional_regions)).stringify_keys
disabled_regions = Array(Settings.ems.ems_amazon.try!(:disabled_regions))
Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
- cn-northwest-1
- us-gov-east-1
- us-gov-west-1
- ap-northeast-3
- ap-east-1

# add additional regions as found in app/models/manageiq/providers/amazon/regions.rb
# :spec-region-1:
Expand Down
Loading

0 comments on commit 7ff93bc

Please sign in to comment.