Skip to content

How can we map identifier (service) against their associated class names? #3148

Answered by alextwoods
stonefield asked this question in Q&A
Discussion options

You must be logged in to vote

Rather than use Seahorse::Client::Base.descendants you can use the Aws namespace - something like:

def load_services
  Aws.constants.each do |c|
    m = Aws.const_get(c)
    if m.is_a?(Module) && m.const_defined?(:Client) && m.const_get(:Client).respond_to?(:identifier)
      klass = m.const_get(:Client)
      services[klass.identifier] = klass
    end
  end
end

This works with the autoload (though of course, it does trigger the loading).

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by stonefield
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants