From 2b8c89829419284294ce819199324ae27b737705 Mon Sep 17 00:00:00 2001 From: Rakeshkumar More Date: Sun, 24 Jul 2022 01:54:11 +0530 Subject: [PATCH] ZCS-11427 new SOAP api for configuring S3 bucket --- .gitignore | 2 + .../zimbra/common/soap/AdminConstants.java | 20 ++ .../GlobalExternalStoreConfigConstants.java | 17 ++ soap/src/java/com/zimbra/soap/JaxbUtil.java | 8 +- .../message/CreateS3BucketConfigRequest.java | 39 ++++ .../message/CreateS3BucketConfigResponse.java | 34 ++++ .../message/DeleteS3BucketConfigRequest.java | 39 ++++ .../message/DeleteS3BucketConfigResponse.java | 34 ++++ .../message/GetS3BucketConfigRequest.java | 39 ++++ .../message/GetS3BucketConfigResponse.java | 57 ++++++ .../type/GlobalS3BucketConfiguration.java | 179 ++++++++++++++++++ 11 files changed, 467 insertions(+), 1 deletion(-) create mode 100644 common/src/java/com/zimbra/common/soap/GlobalExternalStoreConfigConstants.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigRequest.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigResponse.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigRequest.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigResponse.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigRequest.java create mode 100644 soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigResponse.java create mode 100644 soap/src/java/com/zimbra/soap/type/GlobalS3BucketConfiguration.java diff --git a/.gitignore b/.gitignore index f0779e6424e..c50eeea3f38 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ .project .settings/ .idea/ +*.iml +.java-version build/ bin/ .DS_Store diff --git a/common/src/java/com/zimbra/common/soap/AdminConstants.java b/common/src/java/com/zimbra/common/soap/AdminConstants.java index 5d97088559b..624236aa8c8 100644 --- a/common/src/java/com/zimbra/common/soap/AdminConstants.java +++ b/common/src/java/com/zimbra/common/soap/AdminConstants.java @@ -1582,4 +1582,24 @@ public final class AdminConstants { public static final String A_ZULIP_DOMAIN = "zulipDomain"; public static final String E_DEVICES = "devices"; + + // Global External Store Config + public static final String E_GET_S3_BUCKET_CONFIG_REQUEST = "GetS3BucketConfigRequest"; + public static final String E_GET_S3_BUCKET_CONFIG_RESPONSE = "GetS3BucketConfigResponse"; + public static final String E_CREATE_S3_BUCKET_CONFIG_REQUEST = "CreateS3BucketConfigRequest"; + public static final String E_CREATE_S3_BUCKET_CONFIG_RESPONSE = "CreateS3BucketConfigResponse"; + public static final String E_DELETE_S3_BUCKET_CONFIG_REQUEST = "DeleteS3BucketConfigRequest"; + public static final String E_DELETE_S3_BUCKET_CONFIG_RESPONSE = "DeleteS3BucketConfigResponse"; + public static final QName GET_S3_BUCKET_CONFIG_REQUEST = QName.get(E_GET_S3_BUCKET_CONFIG_REQUEST, NAMESPACE); + public static final QName GET_S3_BUCKET_CONFIG_RESPONSE = QName.get(E_GET_S3_BUCKET_CONFIG_RESPONSE, NAMESPACE); + public static final QName CREATE_S3_BUCKET_CONFIG_REQUEST = QName.get(E_CREATE_S3_BUCKET_CONFIG_REQUEST, NAMESPACE); + public static final QName CREATE_S3_BUCKET_CONFIG_RESPONSE = QName.get(E_CREATE_S3_BUCKET_CONFIG_RESPONSE, NAMESPACE); + public static final QName DELETE_S3_BUCKET_CONFIG_REQUEST = QName.get(E_DELETE_S3_BUCKET_CONFIG_REQUEST, NAMESPACE); + public static final QName DELETE_S3_BUCKET_CONFIG_RESPONSE = QName.get(E_DELETE_S3_BUCKET_CONFIG_RESPONSE, NAMESPACE); + + // Validate External Config + public static final String E_VALIDATE_S3_BUCKET_REACHABLE_REQUEST = "ValidateS3BucketReachableRequest"; + public static final String E_VALIDATE_S3_BUCKET_REACHABLE_RESPONSE = "ValidateS3BucketReachableResponse"; + public static final QName VALIDATE_S3_BUCKET_REACHABLE_REQUEST = QName.get(E_VALIDATE_S3_BUCKET_REACHABLE_REQUEST, NAMESPACE); + public static final QName VALIDATE_S3_BUCKET_REACHABLE_RESPONSE = QName.get(E_VALIDATE_S3_BUCKET_REACHABLE_RESPONSE, NAMESPACE); } diff --git a/common/src/java/com/zimbra/common/soap/GlobalExternalStoreConfigConstants.java b/common/src/java/com/zimbra/common/soap/GlobalExternalStoreConfigConstants.java new file mode 100644 index 00000000000..b5b4ac9f7c1 --- /dev/null +++ b/common/src/java/com/zimbra/common/soap/GlobalExternalStoreConfigConstants.java @@ -0,0 +1,17 @@ +package com.zimbra.common.soap; + +public final class GlobalExternalStoreConfigConstants { + + public static final String E_GLOBAL_S3_BUCKET_CONFIGURATIONS = "global/s3BucketConfigurations"; + public static final String A_S3_GLOBAL_BUCKET_UUID = "globalBucketUUID"; + public static final String A_S3_BUCKET_NAME = "bucketName"; + public static final String A_S3_STORE_PROVIDER = "storeProvider"; + public static final String A_S3_PROTOCOL = "protocol"; + public static final String A_S3_ACCESS_KEY = "accessKey"; + public static final String A_S3_SECRET_KEY = "secretKey"; + public static final String A_S3_REGION = "region"; + public static final String A_S3_DESTINATION_PATH = "destinationPath"; + public static final String A_S3_URL = "url"; + public static final String A_S3_BUCKET_STATUS = "bucketStatus"; + +} diff --git a/soap/src/java/com/zimbra/soap/JaxbUtil.java b/soap/src/java/com/zimbra/soap/JaxbUtil.java index 1537ae427ff..4a7dc736396 100644 --- a/soap/src/java/com/zimbra/soap/JaxbUtil.java +++ b/soap/src/java/com/zimbra/soap/JaxbUtil.java @@ -1157,7 +1157,13 @@ public final class JaxbUtil { com.zimbra.soap.admin.message.ScheduleSMPolicyRequest.class, com.zimbra.soap.admin.message.ScheduleSMPolicyResponse.class, com.zimbra.soap.admin.message.GetScheduleSMPolicyRequest.class, - com.zimbra.soap.admin.message.GetScheduleSMPolicyResponse.class + com.zimbra.soap.admin.message.GetScheduleSMPolicyResponse.class, + com.zimbra.soap.admin.message.GetS3BucketConfigRequest.class, + com.zimbra.soap.admin.message.GetS3BucketConfigResponse.class, + com.zimbra.soap.admin.message.CreateS3BucketConfigRequest.class, + com.zimbra.soap.admin.message.CreateS3BucketConfigResponse.class, + com.zimbra.soap.admin.message.DeleteS3BucketConfigRequest.class, + com.zimbra.soap.admin.message.DeleteS3BucketConfigResponse.class }; try { diff --git a/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigRequest.java b/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigRequest.java new file mode 100644 index 00000000000..42f7c809434 --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigRequest.java @@ -0,0 +1,39 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.admin.type.AdminAttrsImpl; + +/** + * @zm-api-command-auth-required true + * @zm-api-command-admin-auth-required true + * @zm-api-command-description Create S3 Bucket Config
+ */ +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_CREATE_S3_BUCKET_CONFIG_REQUEST) +public class CreateS3BucketConfigRequest extends AdminAttrsImpl { + + public CreateS3BucketConfigRequest() { + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigResponse.java b/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigResponse.java new file mode 100644 index 00000000000..389b7a16ce6 --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/CreateS3BucketConfigResponse.java @@ -0,0 +1,34 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.admin.type.AdminAttrsImpl; + +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_CREATE_S3_BUCKET_CONFIG_RESPONSE) +public class CreateS3BucketConfigResponse extends AdminAttrsImpl { + + public CreateS3BucketConfigResponse() { + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigRequest.java b/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigRequest.java new file mode 100644 index 00000000000..124262fa3ba --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigRequest.java @@ -0,0 +1,39 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.admin.type.AdminAttrsImpl; + +/** + * @zm-api-command-auth-required true + * @zm-api-command-admin-auth-required true + * @zm-api-command-description Delete S3 Bucket Config
+ */ +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_DELETE_S3_BUCKET_CONFIG_REQUEST) +public class DeleteS3BucketConfigRequest extends AdminAttrsImpl { + + public DeleteS3BucketConfigRequest() { + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigResponse.java b/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigResponse.java new file mode 100644 index 00000000000..50349722f3c --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/DeleteS3BucketConfigResponse.java @@ -0,0 +1,34 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.admin.type.AdminAttrsImpl; + +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_DELETE_S3_BUCKET_CONFIG_RESPONSE) +public class DeleteS3BucketConfigResponse extends AdminAttrsImpl { + + public DeleteS3BucketConfigResponse() { + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigRequest.java b/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigRequest.java new file mode 100644 index 00000000000..c6262e20158 --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigRequest.java @@ -0,0 +1,39 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2012 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.admin.type.AdminAttrsImpl; + +/** + * @zm-api-command-auth-required true + * @zm-api-command-admin-auth-required true + * @zm-api-command-description Get S3 Bucket Config + */ +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_GET_S3_BUCKET_CONFIG_REQUEST) +public class GetS3BucketConfigRequest extends AdminAttrsImpl { + + public GetS3BucketConfigRequest() { + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigResponse.java b/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigResponse.java new file mode 100644 index 00000000000..bb125d17e8e --- /dev/null +++ b/soap/src/java/com/zimbra/soap/admin/message/GetS3BucketConfigResponse.java @@ -0,0 +1,57 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.admin.message; + +import java.util.Collection; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.google.common.collect.Lists; +import com.zimbra.common.soap.AdminConstants; +import com.zimbra.soap.type.GlobalS3BucketConfiguration; + +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement(name = AdminConstants.E_GET_S3_BUCKET_CONFIG_RESPONSE) +public final class GetS3BucketConfigResponse { + + /** + * @zm-api-field-description Information about globalS3BucketConfigs + */ + @XmlElement(name = "globalS3BucketConfigurations", required = true) + private final List globalS3BucketConfigurations = Lists.newArrayList(); + + public void setGlobalS3BucketConfigurations(Collection list) { + globalS3BucketConfigurations.clear(); + if (list != null && !list.isEmpty()) { + globalS3BucketConfigurations.addAll(list); + } + } + + public List getGlobalS3BucketConfigurations() { + return globalS3BucketConfigurations; + } + + public void addGlobalS3BucketConfiguration(GlobalS3BucketConfiguration globalS3BucketConfig) { + globalS3BucketConfigurations.add(globalS3BucketConfig); + } + +} \ No newline at end of file diff --git a/soap/src/java/com/zimbra/soap/type/GlobalS3BucketConfiguration.java b/soap/src/java/com/zimbra/soap/type/GlobalS3BucketConfiguration.java new file mode 100644 index 00000000000..ba4c3929d2e --- /dev/null +++ b/soap/src/java/com/zimbra/soap/type/GlobalS3BucketConfiguration.java @@ -0,0 +1,179 @@ +/* + * ***** BEGIN LICENSE BLOCK ***** + * Zimbra Collaboration Suite Server + * Copyright (C) 2022 Synacor, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . + * ***** END LICENSE BLOCK ***** + */ + +package com.zimbra.soap.type; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.zimbra.common.soap.GlobalExternalStoreConfigConstants; + +@XmlAccessorType(XmlAccessType.NONE) +public final class GlobalS3BucketConfiguration { + + /** + * @zm-api-field-tag globalBucketUUID + * @zm-api-field-description Global Bucket UUID + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_GLOBAL_BUCKET_UUID, /* globalBucketUUID */ required=false) + private String globalBucketUUID; + + /** + * @zm-api-field-tag bucketName + * @zm-api-field-description Global Bucket Name + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_BUCKET_NAME, /* bucketName */ required=false) + private String bucketName; + + /** + * @zm-api-field-tag storeProvider + * @zm-api-field-description Global Store Provider + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_STORE_PROVIDER, /* storeProvider */ required=false) + private String storeProvider; + + /** + * @zm-api-field-tag protocol + * @zm-api-field-description Global Protocol + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_PROTOCOL, /* protocol */ required=false) + private String protocol; + + /** + * @zm-api-field-tag accessKey + * @zm-api-field-description Global Access Key + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_ACCESS_KEY, /* accessKey */ required=false) + private String accessKey; + + /** + * @zm-api-field-tag secret + * @zm-api-field-description Global Secret + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_SECRET_KEY, /* secret */ required=false) + private String secretKey; + + /** + * @zm-api-field-tag region + * @zm-api-field-description Global Region + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_REGION, /* region */ required=false) + private String region; + + /** + * @zm-api-field-tag destinationPath + * @zm-api-field-description Global Destination Path + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_DESTINATION_PATH, /* destinationPath */ required=false) + private String destinationPath; + + /** + * @zm-api-field-tag url + * @zm-api-field-description Global Url + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_URL, /* url */ required=false) + private String url; + + /** + * @zm-api-field-tag bucketStatus + * @zm-api-field-description Global Bucket Status + */ + @XmlAttribute(name=GlobalExternalStoreConfigConstants.A_S3_BUCKET_STATUS, /* bucketStatus */ required=false) + private String bucketStatus; + + public String getGlobalBucketUUID() { + return globalBucketUUID; + } + + public void setGlobalBucketUUID(String globalBucketUUID) { + this.globalBucketUUID = globalBucketUUID; + } + + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public String getStoreProvider() { + return storeProvider; + } + + public void setStoreProvider(String storeProvider) { + this.storeProvider = storeProvider; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getDestinationPath() { + return destinationPath; + } + + public void setDestinationPath(String destinationPath) { + this.destinationPath = destinationPath; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getBucketStatus() { + return bucketStatus; + } + + public void setBucketStatus(String bucketStatus) { + this.bucketStatus = bucketStatus; + } + +} \ No newline at end of file