tpodowd commented on code in PR #9748:
URL: https://github.com/apache/cloudstack/pull/9748#discussion_r1805934147


##########
plugins/storage/object/cloudian/src/main/java/org/apache/cloudstack/storage/datastore/util/CloudianHyperStoreUtil.java:
##########
@@ -0,0 +1,218 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+// SPDX-License-Identifier: Apache-2.0
+package org.apache.cloudstack.storage.datastore.util;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.cloudstack.cloudian.client.CloudianClient;
+import org.apache.commons.lang3.StringUtils;
+
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.client.builder.AwsClientBuilder;
+import com.amazonaws.services.identitymanagement.AmazonIdentityManagement;
+import 
com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class CloudianHyperStoreUtil {
+
+    /** The name of our Object Store Provider */
+    public static final String OBJECT_STORE_PROVIDER_NAME = "Cloudian 
HyperStore";
+
+    public static final String STORE_KEY_PROVIDER_NAME = "providerName";
+    public static final String STORE_KEY_URL           = "url";
+    public static final String STORE_KEY_NAME          = "name";
+    public static final String STORE_KEY_DETAILS       = "details";
+
+    // Store Details Map key names - managed outside of plugin
+    public static final String STORE_DETAILS_KEY_USER_NAME    = "accesskey";   
// admin user name
+    public static final String STORE_DETAILS_KEY_PASSWORD     = "secretkey";   
// admin password
+    public static final String STORE_DETAILS_KEY_VALIDATE_SSL = "validateSSL";
+    public static final String STORE_DETAILS_KEY_S3_URL       = "s3Url";
+    public static final String STORE_DETAILS_KEY_IAM_URL      = "iamUrl";
+
+    // Account Detail Map key names
+    public static final String KEY_ROOT_ACCESS_KEY    = "hs_AccessKey";
+    public static final String KEY_ROOT_SECRET_KEY    = "hs_SecretKey";
+    public static final String KEY_IAM_ACCESS_KEY     = "hs_IAMAccessKey";
+    public static final String KEY_IAM_SECRET_KEY     = "hs_IAMSecretKey";
+
+    public static final int DEFAULT_ADMIN_PORT = 19443;
+    public static final int DEFAULT_ADMIN_TIMEOUT_SECONDS = 10;
+
+    public static final String IAM_USER_USERNAME = "CloudStack";
+    public static final String IAM_USER_POLICY_NAME = "CloudStackPolicy";
+    public static final String IAM_USER_POLICY;
+    static {
+        StringBuilder sb = new StringBuilder();
+        sb.append("{\n");
+        sb.append("  \"Version\": \"2012-10-17\",\n");
+        sb.append("  \"Statement\": [\n");
+        sb.append("    {\n");
+        sb.append("      \"Sid\": \"AllowFullS3Access\",\n");
+        sb.append("      \"Effect\": \"Allow\",\n");
+        sb.append("      \"Action\": [\n");
+        sb.append("        \"s3:*\"\n");
+        sb.append("      ],\n");
+        sb.append("      \"Resource\": \"*\"\n");
+        sb.append("    },\n");
+        sb.append("    {\n");
+        sb.append("      \"Sid\": \"ExceptBucketCreationOrDeletion\",\n");
+        sb.append("      \"Effect\": \"Deny\",\n");
+        sb.append("      \"Action\": [\n");
+        sb.append("        \"s3:createBucket\",\n");
+        sb.append("        \"s3:deleteBucket\"\n");
+        sb.append("      ],\n");
+        sb.append("      \"Resource\": \"*\"\n");
+        sb.append("    }\n");
+        sb.append("  ]\n");
+        sb.append("}\n");
+        IAM_USER_POLICY = sb.toString();
+    }

Review Comment:
   There is no strong reason except that I was frustrated there was no """ in 
Java11 :-) I can rework it into a standard string and remove the static 
initialization I guess.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to