use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.
the class RequestXmlFactory method convertToXmlByteArray.
/**
* Converts the RestoreObjectRequest to an XML fragment that can be sent to
* the RestoreObject operation of Amazon S3.
*
* @param restoreObjectRequest The container which provides options for
* restoring an object, which was transitioned to the Glacier
* from S3 when it was expired, into S3 again.
* @return A byte array containing the data
* @throws AmazonClientException
*/
public static byte[] convertToXmlByteArray(RestoreObjectRequest restoreObjectRequest) throws AmazonClientException {
XmlWriter xml = new XmlWriter();
xml.start("RestoreRequest");
xml.start("Days").value(Integer.toString(restoreObjectRequest.getExpirationInDays())).end();
xml.end();
return xml.getBytes();
}
use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.
the class BucketConfigurationXmlFactory method writeAnalyticsExportDestination.
private void writeAnalyticsExportDestination(XmlWriter xml, AnalyticsExportDestination destination) {
if (destination == null) {
return;
}
xml.start("Destination");
if (destination.getS3BucketDestination() != null) {
xml.start("S3BucketDestination");
final AnalyticsS3BucketDestination s3BucketDestination = destination.getS3BucketDestination();
addParameterIfNotNull(xml, "Format", s3BucketDestination.getFormat());
addParameterIfNotNull(xml, "BucketAccountId", s3BucketDestination.getBucketAccountId());
addParameterIfNotNull(xml, "Bucket", s3BucketDestination.getBucketArn());
addParameterIfNotNull(xml, "Prefix", s3BucketDestination.getPrefix());
// </S3BucketDestination>
xml.end();
}
// </Destination>
xml.end();
}
use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.
the class BucketConfigurationXmlFactory method convertToXmlByteArray.
/**
* Converts the specified {@link InventoryConfiguration} object to an XML
* fragment that can be sent to Amazon S3.
*
* @param config The {@link InventoryConfiguration}
*/
/*
* <?xml version="1.0" encoding="UTF-8"?> <InventoryConfiguration
* xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Destination>
* <S3BucketDestination> <AccountId>A2OCNCIEQW9MSG</AccountId>
* <Bucket>s3-object-inventory-list-gamma-us-east-1</Bucket>
* <Format>CSV</Format> <Prefix>string</Prefix> </S3BucketDestination>
* </Destination> <IsEnabled>true</IsEnabled> <Filter>
* <Prefix>string</Prefix> </Filter> <Id>configId</Id>
* <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields>
* <Field>Size</Field> <Field>LastModifiedDate</Field>
* <Field>StorageClass</Field> <Field>ETag</Field>
* <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field>
* </OptionalFields> <Schedule> <Frequency>Daily</Frequency> </Schedule>
* </InventoryConfiguration>
*/
public byte[] convertToXmlByteArray(InventoryConfiguration config) throws AmazonClientException {
final XmlWriter xml = new XmlWriter();
xml.start("InventoryConfiguration", "xmlns", Constants.XML_NAMESPACE);
xml.start("Id").value(config.getId()).end();
xml.start("IsEnabled").value(String.valueOf(config.isEnabled())).end();
xml.start("IncludedObjectVersions").value(config.getIncludedObjectVersions()).end();
writeInventoryDestination(xml, config.getDestination());
writeInventoryFilter(xml, config.getInventoryFilter());
addInventorySchedule(xml, config.getSchedule());
addInventoryOptionalFields(xml, config.getOptionalFields());
// </InventoryConfiguration>
xml.end();
return xml.getBytes();
}
use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.
the class BucketConfigurationXmlFactory method convertToXmlByteArray.
/**
* Converts the specified {@link BucketTaggingConfiguration} object to an
* XML fragment that can be sent to Amazon S3.
*
* @param config The {@link BucketTaggingConfiguration}
*/
/*
* <Tagging> <TagSet> <Tag> <Key>Project</Key> <Value>Foo</Value> </Tag>
* <Tag> <Key>User</Key> <Value>nschnarr</Value> </Tag> </TagSet> </Tagging>
*/
public byte[] convertToXmlByteArray(BucketTaggingConfiguration config) throws AmazonClientException {
final XmlWriter xml = new XmlWriter();
xml.start("Tagging");
for (final TagSet tagset : config.getAllTagSets()) {
writeRule(xml, tagset);
}
xml.end();
return xml.getBytes();
}
use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.
the class BucketConfigurationXmlFactory method writeInventoryDestination.
private void writeInventoryDestination(XmlWriter xml, InventoryDestination destination) {
if (destination == null) {
return;
}
xml.start("Destination");
final InventoryS3BucketDestination s3BucketDestination = destination.getS3BucketDestination();
if (s3BucketDestination != null) {
xml.start("S3BucketDestination");
addParameterIfNotNull(xml, "AccountId", s3BucketDestination.getAccountId());
addParameterIfNotNull(xml, "Bucket", s3BucketDestination.getBucketArn());
addParameterIfNotNull(xml, "Prefix", s3BucketDestination.getPrefix());
addParameterIfNotNull(xml, "Format", s3BucketDestination.getFormat());
// </S3BucketDestination>
xml.end();
}
// </Destination>
xml.end();
}
Aggregations