def get_region(region_argument, interactive, force_non_interactive=False, platform=None): # Get region from command line arguments region = get_region_from_inputs(region_argument) # Ask for region if (not region) and force_non_interactive: if platform: region = PlatformVersion.get_region_from_platform_arn(platform) if not region: # Choose defaults region_list = get_all_regions() region = region_list[2].name if not region or (interactive and not region_argument): io.echo() io.echo('Select a default region') region_list = get_all_regions() result = utils.prompt_for_item_in_list(region_list, default=3) region = result.name return region
def test_get_region_from_platform_arn__language_name(self): language_name = 'node.js' self.assertIsNone( PlatformVersion.get_region_from_platform_arn(language_name))
def test_get_region_from_platform_arn__solution_stack_shorthand(self): solution_stack_shorthand = 'test-dev' self.assertIsNone( PlatformVersion.get_region_from_platform_arn( solution_stack_shorthand))
def test_get_region_from_platform_arn__valid_solution_stack(self): solution_stack = 'Multi-container Docker running on 64bit Amazon Linux/2.7.5' self.assertIsNone( PlatformVersion.get_region_from_platform_arn(solution_stack))
def test_get_region_from_platform_arn__custom_platform(self): custom_platform = 'arn:aws:elasticbeanstalk:us-east-1:00000000000:platform/Name/0.0.0' self.assertIsNone( PlatformVersion.get_region_from_platform_arn(custom_platform))
def test_get_region_from_platform_arn__valid_eb_managed_arn(self): arn = 'arn:aws:elasticbeanstalk:us-west-2::platform/Multi-container Docker running on 64bit Amazon Linux/2.7.5' self.assertEqual('us-west-2', PlatformVersion.get_region_from_platform_arn(arn))