Skip to content

Commit

Permalink
ZCS-11427 new SOAP api for configuring S3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakeshkumar More authored and silentsakky committed Aug 9, 2022
1 parent 5170f22 commit 2b8c898
Show file tree
Hide file tree
Showing 11 changed files with 467 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.project
.settings/
.idea/
*.iml
.java-version
build/
bin/
.DS_Store
Expand Down
20 changes: 20 additions & 0 deletions common/src/java/com/zimbra/common/soap/AdminConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
@@ -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";

}
8 changes: 7 additions & 1 deletion soap/src/java/com/zimbra/soap/JaxbUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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 <br />
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = AdminConstants.E_CREATE_S3_BUCKET_CONFIG_REQUEST)
public class CreateS3BucketConfigRequest extends AdminAttrsImpl {

public CreateS3BucketConfigRequest() {
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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() {
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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 <br />
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = AdminConstants.E_DELETE_S3_BUCKET_CONFIG_REQUEST)
public class DeleteS3BucketConfigRequest extends AdminAttrsImpl {

public DeleteS3BucketConfigRequest() {
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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() {
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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() {
}

}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
* ***** 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<GlobalS3BucketConfiguration> globalS3BucketConfigurations = Lists.newArrayList();

public void setGlobalS3BucketConfigurations(Collection<GlobalS3BucketConfiguration> list) {
globalS3BucketConfigurations.clear();
if (list != null && !list.isEmpty()) {
globalS3BucketConfigurations.addAll(list);
}
}

public List<GlobalS3BucketConfiguration> getGlobalS3BucketConfigurations() {
return globalS3BucketConfigurations;
}

public void addGlobalS3BucketConfiguration(GlobalS3BucketConfiguration globalS3BucketConfig) {
globalS3BucketConfigurations.add(globalS3BucketConfig);
}

}
Loading

0 comments on commit 2b8c898

Please sign in to comment.