diff --git a/datasources/src/main/java/org/opensearch/sql/datasources/utils/XContentParserUtils.java b/datasources/src/main/java/org/opensearch/sql/datasources/utils/XContentParserUtils.java index aeaeaf8b97..1df8a069f7 100644 --- a/datasources/src/main/java/org/opensearch/sql/datasources/utils/XContentParserUtils.java +++ b/datasources/src/main/java/org/opensearch/sql/datasources/utils/XContentParserUtils.java @@ -186,38 +186,4 @@ public static XContentBuilder convertToXContent(DataSourceMetadata metadata) thr builder.endObject(); return builder; } - - /** - * Converts Map (partial DataSourceMetadata) to XContentBuilder. - * - * @param dataSourceData - * @return XContentBuilder {@link XContentBuilder} - * @throws Exception Exception. - */ - public static XContentBuilder convertMapToXContent(Map dataSourceData) - throws Exception { - - XContentBuilder builder = XContentFactory.jsonBuilder(); - builder.startObject(); - if (dataSourceData.containsKey(DESCRIPTION_FIELD)) { - builder.field(DESCRIPTION_FIELD, dataSourceData.get(DESCRIPTION_FIELD)); - } - if (dataSourceData.containsKey(ALLOWED_ROLES_FIELD)) { - builder.field( - ALLOWED_ROLES_FIELD, ((List) dataSourceData.get(ALLOWED_ROLES_FIELD)).toArray()); - } - if (dataSourceData.containsKey(PROPERTIES_FIELD)) { - builder.startObject(PROPERTIES_FIELD); - for (Map.Entry entry : - ((Map) dataSourceData.get(PROPERTIES_FIELD)).entrySet()) { - builder.field(entry.getKey(), entry.getValue()); - } - builder.endObject(); - } - if (dataSourceData.containsKey(RESULT_INDEX_FIELD)) { - builder.field(RESULT_INDEX_FIELD, dataSourceData.get(RESULT_INDEX_FIELD)); - } - builder.endObject(); - return builder; - } }