From 2c4fe8bebf11befc26af9dfaa52545280a18f95a Mon Sep 17 00:00:00 2001 From: Alex Woods Date: Tue, 24 Sep 2024 08:22:11 -0700 Subject: [PATCH] Add service identifiers to GlobalConfig's list of identifiers outside of autoload --- .../lib/aws-sdk-code-generator/views/service_module.rb | 6 +++++- .../aws-sdk-code-generator/templates/client_class.mustache | 2 -- .../templates/service_module.mustache | 4 +++- gems/aws-sdk-core/CHANGELOG.md | 2 ++ gems/aws-sdk-core/lib/aws-sdk-core/plugins.rb | 1 + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/service_module.rb b/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/service_module.rb index 733d6a8fdc5..9dcfe8f31a4 100644 --- a/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/service_module.rb +++ b/build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/views/service_module.rb @@ -10,10 +10,14 @@ class ServiceModule < View # @option options [required, String] :prefix def initialize(options) @service = options.fetch(:service) + @service_identifier = @service.identifier @prefix = options.fetch(:prefix) @codegenerated_plugins = options.fetch(:codegenerated_plugins) || [] end + # @return [String] + attr_reader :service_identifier + # @return [String|nil] def generated_src_warning return if @service.protocol == 'api-gateway' @@ -108,7 +112,7 @@ def auto_load(path, class_name, is_plugin = false) } end - def service_identifier + def prefix @prefix end diff --git a/build_tools/aws-sdk-code-generator/templates/client_class.mustache b/build_tools/aws-sdk-code-generator/templates/client_class.mustache index 4145271b124..999190344d8 100644 --- a/build_tools/aws-sdk-code-generator/templates/client_class.mustache +++ b/build_tools/aws-sdk-code-generator/templates/client_class.mustache @@ -7,8 +7,6 @@ require '{{.}}' {{/plugin_requires}} -Aws::Plugins::GlobalConfiguration.add_identifier(:{{service_identifier}}) - module {{module_name}} # An API client for {{service_name}}. To construct a client, you need to configure a `:region` and `:credentials`. # diff --git a/build_tools/aws-sdk-code-generator/templates/service_module.mustache b/build_tools/aws-sdk-code-generator/templates/service_module.mustache index 4f543324d88..35d54703eb5 100644 --- a/build_tools/aws-sdk-code-generator/templates/service_module.mustache +++ b/build_tools/aws-sdk-code-generator/templates/service_module.mustache @@ -17,6 +17,8 @@ require '{{.}}' {{/requires}} {{/require_core_guard?}} +Aws::Plugins::GlobalConfiguration.add_identifier(:{{service_identifier}}) + # This module provides support for {{full_name}}. This module is available in the # `{{gem_name}}` gem. # @@ -63,4 +65,4 @@ module {{module_name}} end -require_relative '{{service_identifier}}/customizations' +require_relative '{{prefix}}/customizations' diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index 0b689772a9e..e44a913c2de 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Issue - Add service identifiers to GlobalConfig's list of identifiers outside of autoload (#3113). + 3.208.0 (2024-09-23) ------------------ diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/plugins.rb b/gems/aws-sdk-core/lib/aws-sdk-core/plugins.rb index 9552af01201..8b65abc34b2 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/plugins.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/plugins.rb @@ -6,5 +6,6 @@ module Aws module Plugins autoload :BearerAuthorization, 'aws-sdk-core/plugins/bearer_authorization' autoload :SignatureV4, 'aws-sdk-core/plugins/signature_v4' + autoload :GlobalConfiguration, 'aws-sdk-core/plugins/global_configuration' end end \ No newline at end of file