Skip to content

Commit

Permalink
Revert "Reduce memory usage from aws-partitions (#3122)"
Browse files Browse the repository at this point in the history
This reverts commit 76412b0.
  • Loading branch information
alextwoods committed Oct 17, 2024
1 parent 76412b0 commit c1c38b4
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require_relative 'aws-sdk-code-generator/client_response_structure_example'
require_relative 'aws-sdk-code-generator/crosslink'
require_relative 'aws-sdk-code-generator/docstring'
require_relative 'aws-sdk-code-generator/endpoint_parameter'
require_relative 'aws-sdk-code-generator/hash_formatter'
require_relative 'aws-sdk-code-generator/helper'
require_relative 'aws-sdk-code-generator/plugin_list'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ def initialize(options)
@service = options.fetch(:service)
if (parameters = @service.endpoint_rules&.fetch('parameters'))
@parameters = parameters.map do |k,p|
EndpointParameter.new(k, p, @service)
EndpointParameter.new(k, p)
end
end
end

# @return [Array<EndpointParameter>]
attr_reader :parameters

# @return [Array<EndpointParameter>]
def config_parameters
parameters.select { |p| p.source == 'config' }
end

# @return [String|nil]
def generated_src_warning
return if @service.protocol == 'api-gateway'
Expand All @@ -31,6 +26,58 @@ def generated_src_warning
def module_name
@service.module_name
end

class EndpointParameter
def initialize(name, definition={})
@name = name
@type = definition['type']
@built_in = definition['builtIn']
@default = definition['default']
@required = definition['required']
@documentation = "# @!attribute #{underscore_name}\n"
if definition['documentation']
@documentation += " # #{definition['documentation']}\n"
end
if deprecated = definition['deprecated']
@documentation += " #\n # @deprecated\n"
if deprecated['message']
@documentation += " # #{deprecated['message']}\n"
end
if deprecated['since']
@documentation += " # Since: #{deprecated['since']}\n"
end
end
@documentation += " #\n # @return [#{@type}]\n #"
end

# @return [String]
attr_reader :name

# @return [String]
attr_reader :documentation

# @return [Boolean]
attr_reader :required

# @return [String,Boolean,Array]
def default
case @default
when String
"\"#{@default}\""
else
@default.to_s
end
end

def default?
!@default.nil?
end

def underscore_name
Underscore.underscore(name)
end
end

end
end
end
Loading

0 comments on commit c1c38b4

Please sign in to comment.