module Aws module Api module Customizations @apis = {} @docs = {} @plugins = {} class << self def api(prefix, &block) @apis[prefix] = block end def doc(prefix, &block) @docs[prefix] = block end def plugins(prefix, options) @plugins[prefix] = { add: options[:add] || [], remove: options[:remove] || [], } end def apply_api_customizations(api) metadata = api['metadata'] || {} prefix = metadata['endpointPrefix'] @apis[prefix].call(api) if @apis[prefix] end def apply_doc_customizations(api, docs) prefix = api.metadata['endpointPrefix'] @docs[prefix].call(docs) if @docs[prefix] end def apply_plugins(client_class) prefix = client_class.api.metadata['endpointPrefix'] if @plugins[prefix] @plugins[prefix][:add].each { |p| client_class.add_plugin(p) } @plugins[prefix][:remove].each { |p| client_class.remove_plugin(p) } end end end plugins('apigateway', add: %w(Aws::Plugins::APIGatewayHeader), ) api('cloudfront') do |api| api['shapes'].each do |_, shape| if shape['members'] && shape['members']['MaxItems'] shape['members']['MaxItems']['shape'] = 'integer' end end api['operations'].keys.each do |name| symbolized = name.sub(/\d{4}_\d{2}_\d{2}$/, '') api['operations'][symbolized] = api['operations'].delete(name) end end plugins('cloudsearchdomain', add: %w(Aws::Plugins::CSDConditionalSigning Aws::Plugins::CSDSwitchToPost), remove: %w(Aws::Plugins::RegionalEndpoint), ) plugins('dynamodb', add: %w( Aws::Plugins::DynamoDBExtendedRetries Aws::Plugins::DynamoDBSimpleAttributes Aws::Plugins::DynamoDBCRC32Validation )) api('ec2') do |api| if ENV['DOCSTRINGS'] members = api['shapes']['CopySnapshotRequest']['members'] members.delete('DestinationRegion') members.delete('PresignedUrl') end end plugins('ec2', add: %w( Aws::Plugins::EC2CopyEncryptedSnapshot Aws::Plugins::EC2RegionValidation )) api('glacier') do |api| api['shapes']['Timestamp'] = { 'type' => 'timestamp', 'timestampFormat' => 'iso8601', } api['shapes'].each do |_, shape| if shape['members'] shape['members'].each do |name, ref| case name when /date/i then ref['shape'] = 'Timestamp' when 'limit' then ref['shape'] = 'Size' when 'partSize' then ref['shape'] = 'Size' when 'archiveSize' then ref['shape'] = 'Size' end end end end end plugins('glacier', add: %w( Aws::Plugins::GlacierAccountId Aws::Plugins::GlacierApiVersion Aws::Plugins::GlacierChecksums )) api('importexport') do |api| api['operations'].each do |_, operation| operation['http']['requestUri'] = '/' end end api('data.iot') do |api| api['metadata'].delete('endpointPrefix') end api('lambda') do |api| api['shapes']['Timestamp']['type'] = 'timestamp' end doc('lambda') do |docs| docs['shapes']['Blob']['refs']['UpdateFunctionCodeRequest$ZipFile'] = "
.zip file containing your packaged source code.
" end plugins('machinelearning', add: %w( Aws::Plugins::MachineLearningPredictEndpoint )) api('route53') do |api| api['shapes']['PageMaxItems']['type'] = 'integer' end plugins('route53', add: %w( Aws::Plugins::Route53IdFix )) plugins('rds', add: %w( Aws::Plugins::RDSCrossRegionCopying )) api('rds') do |api| api['shapes']['CopyDBSnapshotMessage']['members']['DestinationRegion'] = {"shape" => "String"} api['shapes']['CreateDBInstanceReadReplicaMessage']['members']['DestinationRegion'] = {"shape" => "String"} api['shapes']['CopyDBClusterSnapshotMessage']['members']['DestinationRegion'] = {"shape" => "String"} api['shapes']['CreateDBClusterMessage']['members']['DestinationRegion'] = {"shape" => "String"} api['shapes']['CopyDBSnapshotMessage']['members']['SourceRegion'] = {"shape" => "String"} api['shapes']['CreateDBInstanceReadReplicaMessage']['members']['SourceRegion'] = {"shape" => "String"} api['shapes']['CopyDBClusterSnapshotMessage']['members']['SourceRegion'] = {"shape" => "String"} api['shapes']['CreateDBClusterMessage']['members']['SourceRegion'] = {"shape" => "String"} end doc('rds') do |docs| docs['shapes']['String']['refs']['CopyDBSnapshotMessage$SourceRegion'] = "The region which you are copying an encrypted snapshot from.
" + "This is a required paramter that allows SDK to compute a pre-signed Url and" +
" populate PreSignedURL
parameter on your behalf.
The region which you are copying an encrypted snapshot from.
" + "This is a required paramter that allows SDK to compute a pre-signed Url and" +
" populate PreSignedURL
parameter on your behalf.
The region which you are copying an encrypted snapshot from.
" + "This is a required paramter that allows SDK to compute a pre-signed Url and" +
" populate PreSignedURL
parameter on your behalf.
The region which you are copying an encrypted snapshot from.
" + "This is a required paramter that allows SDK to compute a pre-signed Url and" +
" populate PreSignedURL
parameter on your behalf.