diff --git a/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/service.rb b/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/service.rb index b2261e733cd..9354dd43b6b 100644 --- a/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/service.rb +++ b/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/service.rb @@ -148,6 +148,20 @@ def included_in_core? # @return [Boolean] true if any operation requires endpoint_discovery attr_reader :require_endpoint_discovery + # @return [String] the service_id + def service_id + metadata = @api['metadata'] + return metadata['serviceId'] if metadata['serviceId'] + + name = metadata['serviceAbbreviation'] || metadata['serviceFullName'] + name = name.gsub(/AWS/, '').gsub(/Amazon/, '') + name = name.gsub(/[^a-zA-Z0-9 ]+/, '') + name = name.gsub(/^[0-9]+/, '') + name = name.strip + + name + end + # @return [Boolean] true if the service is deprecated def deprecated? @deprecated diff --git a/build_tools/services.rb b/build_tools/services.rb index 4c04fbd4a15..50ba551306f 100644 --- a/build_tools/services.rb +++ b/build_tools/services.rb @@ -32,6 +32,12 @@ def [](identifier) end alias service [] + def for_service_id(service_id) + services.values.find do |service| + service.service_id == service_id + end + end + def each(&block) services.values.each(&block) end