/** * 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 versioning configuration into an XML byte array. * * @param versioningConfiguration The configuration to convert. * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketVersioningConfiguration versioningConfiguration) { final XmlWriter xml = new XmlWriter(); xml.start("VersioningConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(versioningConfiguration.getStatus()).end(); final 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(); }
/** * Instantiates a new bucket VH. * * @param bucket the bucket * @param location the location * @param versionConfig the version config * @param tags the tags */ public BucketVH(Bucket bucket,String location,BucketVersioningConfiguration versionConfig, List<Tag> tags){ this.bucket = bucket; this.location = location; this.versionStatus = versionConfig==null?"":versionConfig.getStatus(); this.mfaDelete = versionConfig==null?null:versionConfig.isMfaDeleteEnabled(); this.tags = tags; } }
public static boolean checkBucketIsVersioned(String bucketName, AWSClientFactory awsClientFactory) { final BucketVersioningConfiguration bucketVersioningConfig = awsClientFactory.getS3Client().getBucketVersioningConfiguration(bucketName); return bucketVersioningConfig.getStatus().equals(BucketVersioningConfiguration.ENABLED); }
String status = s3.getBucketVersioningConfiguration(bucketName).getStatus(); if (!BucketVersioningConfiguration.ENABLED.equals(status)) { try {
bucketHasVersions = versionedStates.contains(versioningConfig.getStatus());
/** * 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) { final XmlWriter xml = new XmlWriter(); xml.start("VersioningConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(versioningConfiguration.getStatus()).end(); final 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 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(); }