Skip to content

Instantly share code, notes, and snippets.

@arukoh
Last active March 17, 2019 12:17
Show Gist options
  • Save arukoh/1ee1e14accfb3502a897287bdddc31cc to your computer and use it in GitHub Desktop.
Save arukoh/1ee1e14accfb3502a897287bdddc31cc to your computer and use it in GitHub Desktop.
aws-sdk-s3
{
"version":"2.0",
"metadata":{
"apiVersion":"2006-03-01",
"checksumFormat":"md5",
"endpointPrefix":"s3",
"globalEndpoint":"s3.amazonaws.com",
"protocol":"rest-xml",
"serviceAbbreviation":"Amazon S3",
"serviceFullName":"Amazon Simple Storage Service",
"serviceId":"S3",
"signatureVersion":"s3",
"uid":"s3-2006-03-01"
},
"operations":{
"PutObject":{
"name":"PutObject",
"http":{
"method":"PUT",
"requestUri":"/{Path+}"
},
"input":{"shape":"PutObjectRequest"},
"output":{"shape":"PutObjectResponse"},
"errors":[
{"shape":"ContainerNotFoundException"},
{"shape":"InternalServerError"}
],
"authtype":"v4-unsigned-body"
}
},
"shapes":{
"PutObjectRequest":{
"type":"structure",
"required":[
"Body",
"Path"
],
"members":{
"Body":{"shape":"PayloadBlob"},
"Path":{
"shape":"PathNaming",
"location":"uri",
"locationName":"Path"
},
"ContentType":{
"shape":"ContentType",
"location":"header",
"locationName":"Content-Type"
},
"CacheControl":{
"shape":"StringPrimitive",
"location":"header",
"locationName":"Cache-Control"
},
"StorageClass":{
"shape":"StorageClass",
"location":"header",
"locationName":"x-amz-storage-class"
}
},
"payload":"Body"
},
"PutObjectResponse":{
"type":"structure",
"members":{
"ContentSHA256":{"shape":"SHA256Hash"},
"ETag":{"shape":"ETag"},
"StorageClass":{"shape":"StorageClass"}
}
}
}
}
module Aws::S3
class Client < Seahorse::Client::Base
set_api(ClientApi::API)
def put_object(params = {}, options = {})
req = build_request(:put_object, params)
req.send_request(options)
end
private
def build_request(operation_name, params = {})
handlers = @handlers.for(operation_name)
context = Seahorse::Client::RequestContext.new( ... )
context[:gem_name] = 'aws-sdk-s3'
context[:gem_version] = '1.32.0'
Seahorse::Client::Request.new(handlers, context)
end
end
end
module Aws::S3
module ClientApi
include Seahorse::Model
API = Seahorse::Model::Api.new.tap do |api|
api.version = "2006-03-01"
api.add_operation(:put_object, Seahorse::Model::Operation.new.tap do |o|
o.name = "PutObject"
o.http_method = "PUT"
o.http_request_uri = "/{Bucket}/{Key+}"
o.input = Shapes::ShapeRef.new(shape: PutObjectRequest)
o.output = Shapes::ShapeRef.new(shape: PutObjectOutput)
end)
end
end
end
"operations":{
"PutObject":{
"name":"PutObject",
"http":{
"method":"PUT",
"requestUri":"/{Path+}"
},
"input":{"shape":"PutObjectRequest"},
"output":{"shape":"PutObjectResponse"},
"errors":[
{"shape":"ContainerNotFoundException"},
{"shape":"InternalServerError"}
],
"authtype":"v4-unsigned-body"
}
}
"shapes":{
"PutObjectRequest":{
"type":"structure",
"required":[
"Body",
"Path"
],
"members":{
"Body":{"shape":"PayloadBlob"},
"Path":{
"shape":"PathNaming",
"location":"uri",
"locationName":"Path"
},
"ContentType":{
"shape":"ContentType",
"location":"header",
"locationName":"Content-Type"
},
"CacheControl":{
"shape":"StringPrimitive",
"location":"header",
"locationName":"Cache-Control"
},
"StorageClass":{
"shape":"StorageClass",
"location":"header",
"locationName":"x-amz-storage-class"
}
},
"payload":"Body"
}
}
module Seahorse
module Client
class Base
attr_reader :handlers
def initialize(plugins, options)
@config = build_config(plugins, options)
@handlers = build_handler_list(plugins)
after_initialize(plugins)
end
def build_handler_list(plugins)
plugins.inject(HandlerList.new) do |handlers, plugin|
if plugin.respond_to?(:add_handlers)
plugin.add_handlers(handlers, @config)
end
handlers
end
end
module Seahorse
module Client
class Handler
def initialize(handler = nil)
@handler = handler
end
attr_accessor :handler
def call(context)
@handler.call(context)
end
end
end
end
module Seahorse
module Client
class Request
def send_request(options = {}, &block)
@context[:response_target] = options[:target] || block
@handlers.to_stack.call(@context)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment