...
Code Block |
---|
|
use module a41x174 alias AWSS3
with AWSKeys = keys:aws() |
...
Code Block |
---|
|
key aws {
"AWSAccessKey": "YOURACCESSKEYHERE",
"AWSSecretKey": "YOURSECRETKEYHERE"
} |
...
Code Block |
---|
|
rule getValue is active {
select when pageview ".*" setting ()
pre {
image = <<data<<
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4iVBORw0KGgoAAAANSUhEUgAAAA
UAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJgggw38GIAXDIB
KE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
>>;
base64EncodedData = AWSS3:getValue(image);
// Evaluates to iVBORw0KGgoAAAA...
}
noop();
} |
getType function
...
Code Block |
---|
|
rule getType is active {
select when pageview ".*" setting ()
pre {
image = <<data <<
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4iVBORw0KGgoAAAANSUhEUgAAAA
UAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJgggw38GIAXDIB
KE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
>>;
mimetype = AWSS3:getType(image);
// Evaluates to image/png
}
noop();
} |
upload action
The upload action is currently the only action available in the Amazon S3 Module. It takes three parameters, the bucket, the object_name and the object_value.
...
Code Block |
---|
|
rule upload is active {
select when pageview ".*" setting ()
pre {
text = "This is a test upload";
}
{
AWSS3:upload("kynetx_example", "kynetx_example_upload.txt", text);
}
} |
Example Ruleset
Code Block |
---|
|
ruleset a41x175 {
meta {
name "TestAmazonS3Module"
description <<
TestAmazonS3Module
>>
author "Jessie A. Morris"
// Uncomment this line to require Marketplace purchase to use this app.
// authz require user
logging on
key aws {
"AWSAccessKey": "YOURACCESSKEYHERE",
"AWSSecretKey": "YOURSECRETKEYHERE"
}
use module a41x174 alias AWSS3
with AWSKeys = keys:aws()
}
dispatch {
// Some example dispatch domains
// domain "example.com"
// domain "other.example.com"
}
global {
image = <<
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQ
VQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
>>;
}
rule getValue is active {
select when pageview ".*" setting ()
pre {
base64EncodedData = AWSS3:getValue(image);
}
noop();
}
rule getType is active {
select when pageview ".*" setting ()
pre {
mimetype = AWSS3:getType(image);
}
noop();
}
rule upload is active {
select when pageview ".*" setting ()
pre {
text = "This is a test upload";
}
{
AWSS3:upload("kynetx_example", "kynetx_example_upload.txt", text);
}
}
}
|