rough out protocol plan

This commit is contained in:
Emil Lerch 2021-06-12 13:39:26 -07:00
parent 01aa8c8d1a
commit fe7e37b71a
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -44,12 +44,29 @@ pub const Aws = struct {
const service = meta_info.service; const service = meta_info.service;
const action = meta_info.action; const action = meta_info.action;
const R = Response(request); const R = Response(request);
const FullR = FullResponse(request);
log.debug("service endpoint {s}", .{service.endpoint_prefix}); log.debug("call: prefix {s}, sigv4 {s}, version {s}, action {s}", .{
log.debug("service sigv4 name {s}", .{service.sigv4_name}); service.endpoint_prefix,
log.debug("version {s}", .{service.version}); service.sigv4_name,
log.debug("action {s}", .{action.action_name}); service.version,
action.action_name,
});
log.debug("proto: {s}", .{service.aws_protocol});
switch (service.aws_protocol) {
.query => return self.callQuery(request, service, action, options),
.ec2_query => @compileError("EC2 Query protocol not yet supported"),
.rest_json_1 => @compileError("REST Json 1 protocol not yet supported"),
.json_1_0 => @compileError("Json 1.0 protocol not yet supported"),
.json_1_1 => @compileError("Json 1.1 protocol not yet supported"),
.rest_xml => @compileError("REST XML protocol not yet supported"),
}
}
// Call using query protocol. This is documented as an XML protocol, but
// throwing a JSON accept header seems to work
fn callQuery(self: Self, comptime request: anytype, service: anytype, action: anytype, options: Options) !FullResponse(request) {
const FullR = FullResponse(request);
const response = try self.aws_http.callApi( const response = try self.aws_http.callApi(
service.endpoint_prefix, service.endpoint_prefix,
service.version, service.version,