Refine search
public byte[] convertToXmlByteArray(ServerSideEncryptionConfiguration sseConfig) { XmlWriter xml = new XmlWriter(); xml.start("ServerSideEncryptionConfiguration", "xmlns", Constants.XML_NAMESPACE); for (ServerSideEncryptionRule rule : sseConfig.getRules()) { xml.start("Rule"); writeServerSideEncryptionByDefault(xml, rule.getApplyServerSideEncryptionByDefault()); xml.end(); } xml.end(); return xml.getBytes(); }
/** * Converts the specified accelerate configuration into an XML byte array. * * @param accelerateConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketAccelerateConfiguration accelerateConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("AccelerateConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(accelerateConfiguration.getStatus()).end(); xml.end(); return xml.getBytes(); }
public byte[] convertToXmlByteArray(ObjectTagging tagging) { XmlWriter writer = new XmlWriter(); writer.start("Tagging").start("TagSet"); for (Tag tag : tagging.getTagSet()) { writer.start("Tag"); writer.start("Key").value(tag.getKey()).end(); writer.start("Value").value(tag.getValue()).end(); writer.end(); // </Tag> } writer.end(); // </TagSet> writer.end(); // </Tagging> return writer.getBytes(); } }
public byte[] convertToXmlByteArray(ObjectLockConfiguration config) { XmlWriter writer = new XmlWriter(); writer.start("ObjectLockConfiguration", "xmlns", Constants.XML_NAMESPACE); addIfNotNull(writer, "ObjectLockEnabled", config.getObjectLockEnabled()); addRuleIfNotNull(writer, config.getRule()); writer.end(); return writer.getBytes(); }
/** * Converts the specified {@link BucketCrossOriginConfiguration} object to an XML fragment that * can be sent to Amazon S3. * * @param config * The {@link BucketCrossOriginConfiguration} */ /* * <CORSConfiguration> <CORSRule> <AllowedOrigin>http://www.foobar.com</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSec> <ExposeHeader>x-amz-server-side-encryption</ExposeHeader> </CORSRule> </CORSConfiguration> */ public byte[] convertToXmlByteArray(BucketCrossOriginConfiguration config) throws SdkClientException { XmlWriter xml = new XmlWriter(); xml.start("CORSConfiguration", "xmlns", Constants.XML_NAMESPACE); for (CORSRule rule : config.getRules()) { writeRule(xml, rule); } xml.end(); return xml.getBytes(); }
public byte[] convertToXmlByteArray(ObjectLockRetention retention) { XmlWriter writer = new XmlWriter(); writer.start("Retention", "xmlns", Constants.XML_NAMESPACE); addIfNotNull(writer, "Mode", retention.getMode()); addDateIfNotNull(writer, "RetainUntilDate", retention.getRetainUntilDate()); writer.end(); return writer.getBytes(); }
/** * 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 SdkClientException { XmlWriter xml = new XmlWriter(); xml.start("Tagging"); for (TagSet tagset : config.getAllTagSets()) { writeRule(xml, tagset); } xml.end(); return xml.getBytes(); }
XmlWriter xml = new XmlWriter(); xml.start("CompleteMultipartUpload"); if (partETags != null) { List<PartETag> sortedPartETags = new ArrayList<PartETag>(partETags); xml.start("Part"); xml.start("PartNumber").value(Integer.toString(partEtag.getPartNumber())).end(); xml.start("ETag").value(partEtag.getETag()).end(); xml.end(); xml.end(); return xml.getBytes();
/** * Converts the specified versioning configuration into an XML byte array. * * @param versioningConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketVersioningConfiguration versioningConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("VersioningConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(versioningConfiguration.getStatus()).end(); Boolean mfaDeleteEnabled = versioningConfiguration.isMfaDeleteEnabled(); if (mfaDeleteEnabled != null) { if (mfaDeleteEnabled) { xml.start("MfaDelete").value("Enabled").end(); } else { xml.start("MfaDelete").value("Disabled").end(); } } xml.end(); return xml.getBytes(); }
/** * Converts the specified request payment configuration into an XML byte * array to send to Amazon S3. * * Sample XML: * <RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> * <Payer>Requester</Payer> * </RequestPaymentConfiguration> * * @param requestPaymentConfiguration * The request payment configuration request to convert.. * @return The XML byte array representation. */ public byte[] convertToXmlByteArray( RequestPaymentConfiguration requestPaymentConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("RequestPaymentConfiguration", "xmlns", Constants.XML_NAMESPACE); Payer payer = requestPaymentConfiguration.getPayer(); if (payer != null) { XmlWriter payerDocumentElement = xml.start("Payer"); payerDocumentElement.value(payer.toString()); payerDocumentElement.end(); } xml.end(); return xml.getBytes(); } }
/** * Converts the specified {@link DeleteObjectsRequest} object to an XML fragment that * can be sent to Amazon S3. * * @param rq * The {@link DeleteObjectsRequest} */ public byte[] convertToXmlByteArray(DeleteObjectsRequest rq) throws SdkClientException { XmlWriter xml = new XmlWriter(); xml.start("Delete"); if ( rq.getQuiet() ) { xml.start("Quiet").value("true").end(); } for (KeyVersion keyVersion : rq.getKeys()) { writeKeyVersion(xml, keyVersion); } xml.end(); return xml.getBytes(); }
/** * Converts the specified logging configuration into an XML byte array. * * @param loggingConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketLoggingConfiguration loggingConfiguration) { // Default log file prefix to the empty string if none is specified String logFilePrefix = loggingConfiguration.getLogFilePrefix(); if (logFilePrefix == null) logFilePrefix = ""; XmlWriter xml = new XmlWriter(); xml.start("BucketLoggingStatus", "xmlns", Constants.XML_NAMESPACE); if (loggingConfiguration.isLoggingEnabled()) { xml.start("LoggingEnabled"); xml.start("TargetBucket").value(loggingConfiguration.getDestinationBucketName()).end(); xml.start("TargetPrefix").value(loggingConfiguration.getLogFilePrefix()).end(); xml.end(); } xml.end(); return xml.getBytes(); }
public byte[] convertToXmlByteArray(PublicAccessBlockConfiguration config) { XmlWriter xml = new XmlWriter(); xml.start("PublicAccessBlockConfiguration", "xmlns", Constants.XML_NAMESPACE); addBooleanParameterIfNotNull(xml, "BlockPublicAcls", config.getBlockPublicAcls()); addBooleanParameterIfNotNull(xml, "IgnorePublicAcls", config.getIgnorePublicAcls()); addBooleanParameterIfNotNull(xml, "BlockPublicPolicy", config.getBlockPublicPolicy()); addBooleanParameterIfNotNull(xml, "RestrictPublicBuckets", config.getRestrictPublicBuckets()); xml.end(); return xml.getBytes(); }
XmlWriter xml = new XmlWriter(); xml.start("NotificationConfiguration", "xmlns", Constants.XML_NAMESPACE); Map<String, NotificationConfiguration> configurations = notificationConfiguration .getConfigurations(); NotificationConfiguration config = entry.getValue(); if (config instanceof TopicConfiguration) { xml.start("TopicConfiguration"); xml.start("Id").value(configName).end(); xml.start("Topic") .value(((TopicConfiguration) config).getTopicARN()) .end(); addEventsAndFilterCriteria(xml, config); xml.end(); } else if (config instanceof QueueConfiguration) { xml.start("QueueConfiguration"); xml.end(); return xml.getBytes();
XmlWriter xml = new XmlWriter(); xml.start("AccessControlPolicy", "xmlns", Constants.XML_NAMESPACE); xml.start("Owner"); if (owner.getId() != null) { xml.start("ID").value(owner.getId()).end(); xml.start("DisplayName").value(owner.getDisplayName()).end(); xml.end(); xml.start("AccessControlList"); for (Grant grant : acl.getGrantsAsList()) { xml.end(); return xml.getBytes();
/** * Converts the SelectObjectContentRequest to an XML fragment that can be sent to * the SelectObjectContent operation of Amazon S3. */ public static byte[] convertToXmlByteArray(SelectObjectContentRequest selectRequest) { XmlWriter xml = new XmlWriter(); xml.start("SelectObjectContentRequest"); addIfNotNull(xml, "Expression", selectRequest.getExpression()); addIfNotNull(xml, "ExpressionType", selectRequest.getExpressionType()); addRequestProgressIfNotNull(xml, selectRequest.getRequestProgress()); addInputSerializationIfNotNull(xml, selectRequest.getInputSerialization()); addOutputSerializationIfNotNull(xml, selectRequest.getOutputSerialization()); xml.end(); return xml.getBytes(); }
XmlWriter xml = new XmlWriter(); xml.start("WebsiteConfiguration", "xmlns", Constants.XML_NAMESPACE); XmlWriter indexDocumentElement = xml.start("IndexDocument"); indexDocumentElement.start("Suffix").value(websiteConfiguration.getIndexDocumentSuffix()).end(); indexDocumentElement.end(); XmlWriter errorDocumentElement = xml.start("ErrorDocument"); errorDocumentElement.start("Key").value(websiteConfiguration.getErrorDocument()).end(); errorDocumentElement.end(); xml.end(); return xml.getBytes();