in ebcli/operations/solution_stack_ops.py [0:0]
def find_solution_stack_from_string(solution_string, find_newer=False):
"""
Method returns a SolutionStack object representing the given `solution_string`.
If the `solution_string` matches ARNs and complete names of solution stacks, the exact
match is returned. In the event when there are multiple matches, the latest version is
returned.
:param solution_string: A string in one of the following (case-insensitive) forms:
- PlatformArn:
- EB-managed: 'arn:aws:elasticbeanstalk:us-west-2::platform/Multi-container
Docker running on 64bit Amazon Linux/2.8.0'
- Custom: arn:aws:elasticbeanstalk:us-west-2:123412341234:platform/
custom_platform/1.0.0
- complete name: '64bit Amazon Linux 2017.03 v2.7.5 running Multi-container Docker
17.03.2-ce (Generic)'
- shorthand: 'Multi-container Docker 17.03.2-ce (Generic)'
- language name: 'Multi-container Docker'
- pythonified shorthand: 'multi-container-docker-17.03.2-ce-(generic)'
:param find_newer: If solution_string is a complete name or a PlatformArn that uniquely
matches a solution stack or platform, find the newest version of the
solution stack.
:return: A SolutionStack object representing the latest version of the `solution_string`.
In case of a custom platform, the return value is a PlatformVersion object.
"""
# Compare input with PlatformARNs
match = None
if PlatformVersion.is_eb_managed_platform_arn(solution_string):
if find_newer:
match = platform_version_ops.get_latest_eb_managed_platform(solution_string)
else:
match = platform_arn_to_solution_stack(solution_string)
elif PlatformVersion.is_custom_platform_arn(solution_string):
if find_newer:
match = platform_version_ops.get_latest_custom_platform_version(solution_string)
else:
match = platform_version_ops.find_custom_platform_version_from_string(solution_string)
# Compare input with complete SolutionStack name and retrieve latest SolutionStack
# in the series if `find_newer` is set to True
if not match:
available_solution_stacks = elasticbeanstalk.get_available_solution_stacks()
match = SolutionStack.match_with_complete_solution_string(available_solution_stacks, solution_string)
if match and find_newer:
language_name = SolutionStack(solution_string).language_name
match = SolutionStack.match_with_solution_string_language_name(
available_solution_stacks,
language_name
)
# Compare input with other forms
for solution_string_matcher in [
SolutionStack.match_with_solution_string_shorthand,
SolutionStack.match_with_solution_string_language_name,
SolutionStack.match_with_pythonified_solution_string,
SolutionStack.match_with_windows_server_version_string,
]:
if not match:
match = solution_string_matcher(available_solution_stacks, solution_string)
# Compare input with custom platform names
if not match:
match = platform_version_ops.find_custom_platform_version_from_string(solution_string)
if not match:
raise NotFoundError(alerts['platform.invalidstring'].format(solution_string))
return match