britzl / aws-sdk-lua Goto Github PK
View Code? Open in Web Editor NEWAuto generated AWS SDK for Lua
License: Apache License 2.0
Auto generated AWS SDK for Lua
License: Apache License 2.0
There's some initial work done, but it's not really tested.
https://github.com/britzl/aws-sdk-lua/blob/master/aws-sdk/core/request_handlers/rest_xml.lua
According to https://docs.aws.amazon.com/general/latest/gr/api-retries.html, every AWS should implement a retry mecanism because basically, "shit happens".
Does the Lua SDK implement this? If not, where can it be implemented in a simple way?
Same as "json"?
I tried to use transcribe, which uses json POST, and it doesn't work, callback is never called. I'm using luasocket and GET requests work, also PUT request with rest-xml protocol (although I get error from amazon). Script hangs on connecting, I can see connection status is SYN_SENT.
The string patterns are more complex than what the built-in Lua pattern matching system can support. Is it worth the time to implement somehow?
xml.parse returns a table where each tag is a table with keys label and xarg, which is not easy to process. For example, rest_xml is not processing correctly parsed xml, and it passes data.Message as error message, but data.Message is nil.
I got this xml returned by AWS:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>...</AWSAccessKeyId>
<StringToSign>...</StringToSign>
<SignatureProvided>...</SignatureProvided>
<StringToSignBytes>...</StringToSignBytes>
<CanonicalRequest>PUT
/bucket/%7BKey%20%7D
host:s3.us-west-1.amazonaws.com
x-amz-content-sha256:...
x-amz-date:20200311T112559Z
host;x-amz-content-sha256;x-amz-date
...</CanonicalRequest>
<CanonicalRequestBytes>...</CanonicalRequestBytes>
<RequestId>C1EA16669B3928D1</RequestId>
<HostId>...</HostId>
</Error>
And it's parsed into this table:
{ '<?xml version="1.0" encoding="UTF-8"?>\n', { { 'SignatureDoesNotMatch',
label = 'Code',
xarg = {}
}, {
[[The request signature we calculated does not match the signature you provided.
Check your key and signing method.]],
label = 'Message',
xarg = {}
}, { '...',
label = 'AWSAccessKeyId',
xarg = {}
}, {
[[...]],
label = 'StringToSign',
xarg = {}
}, { '...',
label = 'SignatureProvided',
xarg = {}
}, {
[[...]],
label = 'StringToSignBytes',
xarg = {}
}, {
[[PUT\n/bucket/%7BKey%20%7D\n\nhost:s3.us-west-1.amazonaws.c
om\nx-amz-content-sha256:...b7852b855\nx-amz-date:20200311T112
024Z\n\nhost;x-amz-content-sha256;x-amz-date\n...]],
label = 'CanonicalRequest',
xarg = {}
}, {
[[...]],
label = 'CanonicalRequestBytes',
xarg = {}
}, { 'CE53FBD4244582FD',
label = 'RequestId',
xarg = {}
}, {
'...',
label = 'HostId',
xarg = {}
},
label = 'Error',
xarg = {}
} }
So rest_xml methods should look for table containing 'Message' label, and return first element, because data.Message is nil.
I have replaced utils/xml.lua with https://github.com/manoelcampos/xml2lua, using xmlhandler.tree and returns this table:
{
Error = {
AWSAccessKeyId = '...',
CanonicalRequest =
[[PUT\n/bucket/%7BKey%20%7D\n\nhost:s3.us-west-1.amazonaws.c
om\nx-amz-content-sha256:...
b7852b855\nx-amz-date:20200311T121331Z\n\nhost;x-amz-content-sha256;x-amz-date\n
...]],
CanonicalRequestBytes = [[...]],
Code = 'SignatureDoesNotMatch',
HostId = '...',
Message =
[[The request signature we calculated does not match the signature you provided.
Check your key and signing method.]],
RequestId = '364792E4C01ACE78',
SignatureProvided = '...',
StringToSign = [[...]],
StringToSignBytes = [[...]]
}
}
I guess this structure is similar to structure returned by json handlers. And rest_xml may pass data.Error.Message.
I don't know what should be second parameter for callback, currently is data.__type which has no value in xml, and I don't know what value is in json handler.
Would you agree replacing current xml parser with xml2lua?
Not sure which ones to test though?
EC2
Elasticsearch
S3
Hey !
is this still a beta version ? or its safe to use it as it ? im looking into it because i need to SQS ..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.