Paws XXIII (Bad Paws!! Bad Paws!!)
So I have been happily plugging away at the Paws 'S3' actions and my little Boto fix of
/{Bucket}?action
/{Bucket}?action&id={Id}
I was able to get all of these 'Actions' to work;
- DeleteBucketAnalyticsConfiguration
- DeleteBucketInventoryConfiguration
- DeleteBucketMetricsConfiguration
- GetBucketAnalyticsConfiguration
- GetBucketInventoryConfiguration
- GetBucketMetricsConfiguration
- ListBucketInventoryConfiguration
- ListBucketMetricsConfiguration
- PutBucketInventoryConfiguration
- PutBucketMetricsConfiguration
Also my 'Flatten' fix seem to clean up at least five or six others so a good day. Then I ran into this one; 'GetBucketPolicy' and on reading the ASW API doc I saw;
HTTP/1.1 200 OK x-amz-id-2: Uuag1LuByru9pO4SAMPLEAtRPfTaOFg== x-amz-request-id: 656c76696e67SAMPLE57374 Date: Tue, 04 Apr 2010 20:34:56 GMT Connection: keep-alive Server: AmazonS3{
"Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{
"Effect":"Deny",
"Sid":"1",
"Principal" : {
...
For the response.
What the F...!!!???
So suddenly an API, that so far has been spewing out 100% XML, changes spots and dumps out some a JSON response?
Oh well with AWS being so big I guess they can get away with that. But Shame anyway, at least it is documented.
The fix was very simple; We have the response back from the server and I just check the resposne headers to see what the 'content-type' is in RestXMLResponse.pm
$unserialized_struct = {};
+ } elsif (exists($headers->{'content-type'})
+ and $headers->{'content-type'} eq 'application/json'
+ and $ret_class->can('_payload')){
+ $unserialized_struct->{$ret_class->_payload} = $content;
} else {
and then just make the content the response the classes payload and I get
= bless( {
'Policy' => '{"Version":"2012-10-17","Id":"Policy1572795613217","Statement":
[{"Sid":"Stmt1572795608272","Effect":"Allow","Principal":
{"AWS":"arn:aws:iam::985173205561:user/cgtscoles"},"Action":"*",
"Resource":"arn:aws:s3:::dev.cargotel.paws"}]}',
Now the last one for to day was the 'PutBucketLifecycleConfiguration' I found that is was missing a 'ContentMD5' in the boto and I just added that in and it worked fine and jsut as I had finished a checking in a days work I had this pop into my inbox;
re: [pplu/aws-sdk-perl] Stabilisation to tests and minor fixes (#265)@castaway pushed 250 commits.
ed4c21e CloudFormation API update
b034d55 KinesisVideoMedia docu update
f81dea2 MarketplaceMetering API update
fdc7702 KinesisVideo API update
...
a02ed0c S3 API update
76b1446 Point botocore to version used to generate SDK
f9e4246 Changes from https://github.com/pplu/aws-sdk-perl/issues
...
- Hmm Have I been doing all this codeing for naught?
- Have I just stomped on someones toes?
- Have a I realy messed up here??
- Maybe I woke up some dragons??
Leave a comment