Class: App::AWSValidator
- Inherits:
-
Object
- Object
- App::AWSValidator
- Defined in:
- lib/aws/aws_validator.rb
Class Method Summary collapse
-
.get_and_validate_regions(region_given) ⇒ Object
Helper method to get + validate regions.
-
.validate_region(region) ⇒ Object
Validates AWS region.
Class Method Details
.get_and_validate_regions(region_given) ⇒ Object
Helper method to get + validate regions. Probably going to be used in all AWS Cli calls.
7 8 9 10 11 12 13 14 15 |
# File 'lib/aws/aws_validator.rb', line 7 def self.get_and_validate_regions(region_given) regions = App::AWSCli::get_regions if region_given Blufin::Terminal::error("Invalid AWS region \xe2\x86\x92 #{Blufin::Terminal::format_invalid(region_given)}. Valid regions are:", regions) unless App::AWSValidator::validate_region(region_given) @regions << region_given else @regions = regions end end |
.validate_region(region) ⇒ Object
Validates AWS region.
19 20 21 22 23 24 25 26 |
# File 'lib/aws/aws_validator.rb', line 19 def self.validate_region(region) if App::Cache::exists?(App::CacheKey::ARRAY_AWS_REGIONS) valid_regions = App::Cache::get(App::CacheKey::ARRAY_AWS_REGIONS) else valid_regions = App::AWSCli::get_regions end valid_regions.include?(region) end |