Writer Event Targets
StoreS3ObjectRequest
is the process object that contains the target object parameters and contents, as shown here. This is the input to the event target:
<StoreS3ObjectRequest>
<!-- create S3 object metadata -->
<s3ObjectParameters>
<!-- object key, is required -->
<awsS3Key>test.txt</awsS3Key>
<!-- content type, by default text/plain type is used -->
<contentType>text/plain</contentType>
<!-- content control -->
<contentControl>…</contentControl>
<!-- content disposition which is a default file name (similar to Content-Disposition HTTP header) -->
<contentDisposition>…</contentDisposition>
<!-- content encoding, by default this property is empty -->
<contentEncoding>…</contentEncoding>
<!-- last modified timestamp in milliseconds -->
<lastModified>…</lastModified>
<!-- storage class (STANDARD or REDUCED_REDUNDANCY), can be used to overwrite the same attribute
of the event target -->
<storageClass>…</storageClass>
<!-- canned acl (Private, PublicRead, PublicReadWrite, AuthenticatedRead, LogDeliveryWrite,
BucketOwnerRead, BucketOwnerFullControl). -->
<cannedAcl>…</cannedAcl>
<!-- a well-constructed Amazon S3 Access Control List xml string. -->
<s3Acl>…</s3Acl>
</s3ObjectParameters>
<!-- content format (PlainText|Binary|Attachment|XML|JSON) depending on what format you use the content
should be provided differently -->
<format>PlainText|Binary|Attachment|XML|JSON</format>
<!-- this field can be used only if you set format to PlainText or Binary.
if you use PlainText format this field should contain some textual information that will be written as
is to the bucket; if you use Binary format here you should provide a Base64 encoded string that will be
decoded and written to the target bucket -->
<content>Hello World</content>
<!-- if you chose the XML or JSON format you should use either the object or objects field to provide one or
several process objects that should be converted to XML/JSON content -->
<object>some process object</object>
<objects>a list of process objects</objects>
<!-- optionally you can provide objectName and listName attribute values, details see below this example -->
<objectName>user</objectName>
<listName>users</listName>
</StoreS3ObjectRequest >
The only required parameters are:
You can omit all other parameters. Depending on the format you select, the parameters vary.
StoreS3ObjectResponse
is the process object returned by the Writer event target similar to the following:
<StoreS3ObjectResponse>
<!-- S3 object version (if available) -->
<awsS3VersionId/>
<!-- S3 object ETag -->
<awsS3ETag>b10a8db164e0754105b7a99be72e3fe5</awsS3ETag>
</StoreS3ObjectResponse>
XML/JSON Format
When you use XML/JSON format, the S3 connection expects an
object
(a single process object) or
objects
(a list of process objects). If you pass in a single process object using the objects field, the result is a list with a single item. If you pass in the same object using object fields, the result is a single XML/JSON object (not a list).
You can use the optional parameters,
objectName
and
listName
, to change the generated XML and JSON content as shown below.
XML
: When you serialize a list of
user
process objects to XML format, the output is similar to:
<objects>
<object>
<firstName>Bob</firstName>
<lastName>Smith</lastName>
<phone>111122-222</phone>
</object>
<object>
<firstName>Bob2</firstName>
<lastName>Smith2</lastName>
<phone>111122-222</phone>
</object>
</objects>
The root elements have generic names (object and objects) by default because Process Designer does not have information about any object list or individual object names.
If you need to change the root element names, you can use the
objectName
and
listName
parameters to specify element names.
JSON:
To serialize the same objects list to JSON format, you can use the
objectName
and
listName
parameters to add a wrapper JSON object to the generated result. Without these parameters, the output is a valid JSON array:
[{
"firstName": "Bob",
"lastName": "Smith",
"phone": "1111-222-333"
},
{
"firstName": "Bob2",
"lastName": "Smith",
"phone": "1111-222-333"
}]
You can also serialize the same process objects list as a JSON object as a single array by adding the "users" wrapper in the
listName
parameter:
{
“users”: [{
"firstName": "Bob",
"lastName": "Smith",
"phone": "1111-222-333"
},
{
"firstName": "Bob2",
"lastName": "Smith",
"phone": "1111-222-333"
}]
}
As shown above, the JSON object now contains a single JSON object wrapper with a single field that contains the list
user
objects.
To wrap a single object in the same way, use the
objectName
parameter instead.
Attachment Format
If you use the Attachment format, the approach is different. Instead of providing content as part of the
StoreS3ObjectRequest
object,, you can use a separate
S3Writer
service call parameter,
attachment
.