algairim commented on a change in pull request #1188:
URL: https://github.com/apache/brooklyn-server/pull/1188#discussion_r652432566



##########
File path: 
core/src/main/java/org/apache/brooklyn/util/core/logbook/opensearch/OpenSearchLogStore.java
##########
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+package org.apache.brooklyn.util.core.logbook.opensearch;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import net.minidev.json.JSONObject;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.util.core.logbook.BrooklynLogEntry;
+import org.apache.brooklyn.util.core.logbook.LogBookQueryParams;
+import org.apache.brooklyn.util.core.logbook.LogStore;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.text.Strings;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.ssl.SSLContextBuilder;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static 
org.apache.brooklyn.util.core.logbook.LogbookConfig.BASE_NAME_LOGBOOK;
+
+/**
+ * Implementation for expose log from ElasticSearch to the logbook API.
+ */
+public class OpenSearchLogStore implements LogStore {
+
+    /*
+     # example config for local default implementation
+     brooklyn.logbook.logStore = 
org.apache.brooklyn.util.core.logbook.opensearch.OpenSearchLogStore
+     brooklyn.logbook.openSearchLogStore.host = https://localhost:9200
+     brooklyn.logbook.openSearchLogStore.index = brooklyn8
+     brooklyn.logbook.openSearchLogStore.user = admin
+     brooklyn.logbook.openSearchLogStore.password = admin
+     brooklyn.logbook.openSearchLogStore.verifySSl = false
+     */
+    public final static String BASE_NAME_OPEN_SEARCH_LOG_STORE = 
BASE_NAME_LOGBOOK + ".openSearchLogStore";
+
+    public final static ConfigKey<String> LOGBOOK_LOG_STORE_HOST = 
ConfigKeys.newStringConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".host", "Log store host");
+
+    public final static ConfigKey<String> LOGBOOK_LOG_STORE_INDEX = 
ConfigKeys.newStringConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".index", "Log store index");
+
+    public final static ConfigKey<String> LOGBOOK_LOG_STORE_USER = 
ConfigKeys.newStringConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".user", "User name");
+
+    public final static ConfigKey<String> LOGBOOK_LOG_STORE_PASS = 
ConfigKeys.newStringConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".password", "User password");
+
+    public final static ConfigKey<String> LOGBOOK_LOG_STORE_APIKEY = 
ConfigKeys.newStringConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".apikey", "API key");
+
+    public final static ConfigKey<Boolean> LOGBOOK_LOG_STORE_VERIFY_SSL = 
ConfigKeys.newBooleanConfigKey(
+            BASE_NAME_OPEN_SEARCH_LOG_STORE + ".verifySSl", "Verify SSL", 
true);

Review comment:
       Or a camel-case `Ssl`




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to