Skip to content

Commit

Permalink
Merge pull request #127 from catenax-ng/support_minio_storage
Browse files Browse the repository at this point in the history
Support minio storage
  • Loading branch information
adkumar1 authored Oct 27, 2023
2 parents d45dc77 + fe6946d commit 289cd17
Show file tree
Hide file tree
Showing 30 changed files with 961 additions and 179 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
- The customer already gets an email from Portal and the third-Party-provider after the successful deployment that the SDE-Service is ready to use. If the connector End2End test is unsuccessful (this might be based on the cloud communication issue), the customer will be informed about the failing connectivity. This behavior might need to be clarified for the customer. We will change this behavior in the next release.

## [1.5.2] - 2023-10-27

### Added
- Minio support working version
- Email send refactor
- Refactor s3 policy template use


## [1.5.1] - 2023-10-16

### Changed
Expand Down
21 changes: 20 additions & 1 deletion DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
maven/mavencentral/ch.qos.logback/logback-classic/1.4.7, EPL-1.0 OR LGPL-2.1-only, approved, #3435
maven/mavencentral/ch.qos.logback/logback-core/1.4.7, EPL-1.0 OR LGPL-2.1-only, approved, #3373
maven/mavencentral/com.carrotsearch.thirdparty/simple-xml-safe/2.7.1, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.0, Apache-2.0, approved, #7947
maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.0, MIT AND Apache-2.0, approved, #7932
maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.0, Apache-2.0, approved, #7934
Expand All @@ -10,12 +11,20 @@ maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.0
maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.0, Apache-2.0, approved, #8803
maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949
maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0, approved, #20
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, CQ22654
maven/mavencentral/com.google.guava/guava/32.0.1-jre, Apache-2.0 AND CC0-1.0 AND CC-PDDC, approved, #8772
maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657
maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.h2database/h2/2.1.214, (EPL-1.0 AND MPL-2.0) AND (EPL-1.0 AND MPL-2.0 AND LGPL-3.0-or-later) AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, #2713
maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/content-type/2.2, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/lang-tag/1.7, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.31, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/oauth2-oidc-sdk/9.43.2, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.squareup.okhttp3/okhttp/4.10.0, Apache-2.0 AND MPL-2.0, approved, #3057
maven/mavencentral/com.squareup.okio/okio-jvm/3.0.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.sun.activation/jakarta.activation/2.0.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf
maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590
maven/mavencentral/com.sun.mail/javax.mail/1.6.2, CDDL-1.0 AND Apache-2.0, approved, CQ18739
Expand All @@ -30,6 +39,8 @@ maven/mavencentral/io.github.openfeign/feign-core/12.3, Apache-2.0, approved, cl
maven/mavencentral/io.github.openfeign/feign-slf4j/12.3, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.micrometer/micrometer-commons/1.11.0, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #9243
maven/mavencentral/io.micrometer/micrometer-observation/1.11.0, Apache-2.0, approved, #9242
maven/mavencentral/io.minio/minio-admin/8.5.6, , restricted, clearlydefined
maven/mavencentral/io.minio/minio/8.5.6, Apache-2.0, approved, #9097
maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined
maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.7, Apache-2.0, approved, #5947
maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.7, Apache-2.0, approved, #5929
Expand All @@ -39,14 +50,15 @@ maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR G
maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined
maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696
maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697
maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined
maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, ee4j.validation
maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb
maven/mavencentral/javax.activation/activation/1.1, CDDL-1.0, approved, CQ134
maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.4, Apache-2.0, approved, #7164
maven/mavencentral/net.bytebuddy/byte-buddy/1.14.4, Apache-2.0 AND BSD-3-Clause, approved, #7163
maven/mavencentral/net.minidev/accessors-smart/2.4.9, Apache-2.0, approved, #7515
maven/mavencentral/net.minidev/json-smart/2.4.9, Apache-2.0, approved, #3288
maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065
maven/mavencentral/org.apache.commons/commons-compress/1.24.0, Apache-2.0 AND BSD-3-Clause AND bzip2-1.0.6 AND LicenseRef-Public-Domain, approved, #10368
maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.apache.commons/commons-text/1.10.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.apache.logging.log4j/log4j-api/2.17.1, Apache-2.0, approved, clearlydefined
Expand All @@ -59,6 +71,7 @@ maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.as
maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161
maven/mavencentral/org.bouncycastle/bcpkix-jdk15on/1.70, MIT, approved, clearlydefined
maven/mavencentral/org.bouncycastle/bcprov-jdk15on/1.70, MIT, approved, #1712
maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.74, MIT AND CC0-1.0, approved, #9091
maven/mavencentral/org.bouncycastle/bcutil-jdk15on/1.70, MIT, approved, clearlydefined
maven/mavencentral/org.checkerframework/checker-qual/3.31.0, MIT, approved, clearlydefined
maven/mavencentral/org.eclipse.persistence/eclipselink/3.0.3, EPL-2.0 OR BSD-3-Clause, approved, ee4j.eclipselink
Expand All @@ -72,6 +85,11 @@ maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Fina
maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.2.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121
maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-common/1.8.21, Apache-2.0, approved, #8910
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.8.21, Apache-2.0, approved, #8807
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.8.21, Apache-2.0, approved, #8919
maven/mavencentral/org.jetbrains.kotlin/kotlin-stdlib/1.8.21, Apache-2.0, approved, #8865
maven/mavencentral/org.jetbrains/annotations/13.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.3, EPL-2.0, approved, #3133
maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.3, EPL-2.0, approved, #3125
maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.3, EPL-2.0, approved, #3134
Expand Down Expand Up @@ -145,5 +163,6 @@ maven/mavencentral/org.springframework/spring-web/6.0.9, Apache-2.0, approved, #
maven/mavencentral/org.springframework/spring-webmvc/6.0.9, Apache-2.0, approved, #5944
maven/mavencentral/org.webjars/swagger-ui/4.15.5, Apache-2.0 AND MIT, approved, #5921
maven/mavencentral/org.webjars/webjars-locator-core/0.52, MIT, approved, clearlydefined
maven/mavencentral/org.xerial.snappy/snappy-java/1.1.10.1, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #9098
maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272
maven/mavencentral/org.yaml/snakeyaml/2.0, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #7275
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This service will help service provider to set up DFT/SDE with EDC and EDC as se
### Software Version

```shell
Application version: 1.5.1
Helm release version: 1.5.1
Application version: 1.5.2
Helm release version: 1.5.2
```

# Container images
Expand Down
4 changes: 2 additions & 2 deletions charts/orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ sources:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.5.1
version: 1.5.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.5.1"
appVersion: "1.5.2"

dependencies:
- condition: postgresql.enabled
Expand Down
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>managed-service-orchestrator</artifactId>
<version>1.5.1</version>
<version>1.5.2</version>
<name>managed-service-orchestrator</name>
<description>managed-service-orchestrator</description>
<properties>
Expand Down Expand Up @@ -296,6 +296,16 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.6</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio-admin</artifactId>
<version>8.5.6</version>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package org.eclipse.tractusx.autosetup.apiproxy;

import java.io.InputStream;
import java.net.URI;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand All @@ -29,13 +28,10 @@
import java.util.Map;
import java.util.UUID;

import org.apache.commons.text.StringSubstitutor;
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.utility.ValueReplacerUtility;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

Expand All @@ -50,6 +46,7 @@ public class EDCProxyService {
private static final String DATE_FORMATTER = "dd/MM/yyyy HH:mm:ss";

private final EDCApiProxy eDCApiProxy;
private final ValueReplacerUtility valueReplacerUtility;

private Map<String, String> requestHeader(Map<String, String> inputData) {
Map<String, String> header = new HashMap<>();
Expand All @@ -60,7 +57,7 @@ private Map<String, String> requestHeader(Map<String, String> inputData) {
@SneakyThrows
public List<Object> getAssets(Customer customerDetails, Map<String, String> inputData) {
String dataURL = inputData.get(CONTROL_PLANE_DATA_ENDPOINT);
String readValueAsTree = getSchemaFromFile("/edc-request-template/asset-request-filter.json");
String readValueAsTree = valueReplacerUtility.getRequestFile("/request-template/asset-request-filter.json");
ObjectNode requestBody = (ObjectNode) new ObjectMapper().readTree(readValueAsTree);
return eDCApiProxy.getAssets(new URI(dataURL), requestHeader(inputData), requestBody);
}
Expand All @@ -75,8 +72,7 @@ public String createAsset(Customer customerDetails, Map<String, String> inputDat
String date = localdate.format(DateTimeFormatter.ofPattern(DATE_FORMATTER));
inputData.put("createdDate", date);
inputData.put("updateDate", date);
String readValueAsTree = getSchemaFromFile("/edc-request-template/asset.json");
String jsonString = valueReplacer(readValueAsTree, inputData);
String jsonString = valueReplacerUtility.valueReplacer("/request-template/asset.json", inputData);
ObjectNode json = (ObjectNode) new ObjectMapper().readTree(jsonString);
eDCApiProxy.createAsset(new URI(dataURL), requestHeader(inputData), json);

Expand All @@ -88,8 +84,7 @@ public String createPolicy(Customer customerDetails, Map<String, String> inputDa
String uId = UUID.randomUUID().toString();
inputData.put("policyId", uId);
String dataURL = inputData.get(CONTROL_PLANE_DATA_ENDPOINT);
String readValueAsTree = getSchemaFromFile("/edc-request-template/policy.json");
String jsonString = valueReplacer(readValueAsTree, inputData);
String jsonString = valueReplacerUtility.valueReplacer("/request-template/policy.json", inputData);
ObjectNode json = (ObjectNode) new ObjectMapper().readTree(jsonString);
eDCApiProxy.createPolicy(new URI(dataURL), requestHeader(inputData), json);
return uId;
Expand All @@ -99,42 +94,12 @@ public String createPolicy(Customer customerDetails, Map<String, String> inputDa
public String createContractDefination(Customer customerDetails, Map<String, String> inputData) {
String uId = UUID.randomUUID().toString();
inputData.put("contractPolicyId", uId);
String readValueAsTree = getSchemaFromFile("/edc-request-template/contract-defination.json");
String jsonString = valueReplacer(readValueAsTree, inputData);
String jsonString = valueReplacerUtility.valueReplacer("/request-template/contract-defination.json", inputData);
String dataURL = inputData.get(CONTROL_PLANE_DATA_ENDPOINT);
ObjectNode json = (ObjectNode) new ObjectMapper().readTree(jsonString);
eDCApiProxy.createContractDefination(new URI(dataURL), requestHeader(inputData), json);
return uId;
}

@SneakyThrows
private String getSchemaFromFile(String schemaFile) {
JsonParser createParser = null;
String schema = null;
try {
MappingJsonFactory jf = new MappingJsonFactory();
InputStream jsonFile = this.getClass().getResourceAsStream(schemaFile);

if (jsonFile == null) {
// this is how we load file within editor (eg eclipse)
jsonFile = this.getClass().getClassLoader().getResourceAsStream(schemaFile);
}
createParser = jf.createParser(jsonFile);
schema = createParser.readValueAsTree().toString();
if (schema == null) {
throw new ServiceException("The schema for EDC asset creation is null " + schemaFile);
}

return schema;
} finally {
if (createParser != null)
createParser.close();
}
}

private String valueReplacer(String requestTemplate, Map<String, String> inputData) {
StringSubstitutor stringSubstitutor1 = new StringSubstitutor(inputData);
return stringSubstitutor1.replace(requestTemplate);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,30 @@
package org.eclipse.tractusx.autosetup.config;

import java.util.Properties;

import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.internet.MimeMessage;
import org.springframework.beans.factory.annotation.Value;

import org.eclipse.tractusx.autosetup.constant.EmailConfigurationProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import lombok.RequiredArgsConstructor;

@Configuration
@RequiredArgsConstructor
public class EmailConfiguration {

@Value("${mail.smtp.host}")
private String host;

@Value("${mail.smtp.port}")
private String port;

@Value("${mail.from.address}")
private String fromAddress;

@Value("${mail.smtp.starttls.enable}")
private Boolean startTlsEnable;

@Value("${mail.smtp.username}")
private String username;

@Value("${mail.smtp.password}")
private String password;

@Value("${mail.smtp.auth}")
private Boolean auth;
private final EmailConfigurationProperty emailConfigurationProperty;

@Bean
public MimeMessage mimeMessage() {

Session session = Session.getInstance(properties(), new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
return new PasswordAuthentication(emailConfigurationProperty.getUsername(), emailConfigurationProperty.getPassword());
}
});
return new MimeMessage(session);
Expand All @@ -66,11 +52,11 @@ protected PasswordAuthentication getPasswordAuthentication() {
@Bean
public Properties properties() {
Properties props = new Properties();
props.put("mail.smtp.user", username);
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
props.put("mail.smtp.starttls.enable", startTlsEnable);
props.put("mail.smtp.auth", auth);
props.put("mail.smtp.user", emailConfigurationProperty.getUsername());
props.put("mail.smtp.host", emailConfigurationProperty.getHost());
props.put("mail.smtp.port", emailConfigurationProperty.getPort());
props.put("mail.smtp.starttls.enable", emailConfigurationProperty.getStartTlsEnable());
props.put("mail.smtp.auth", emailConfigurationProperty.getAuth());
return props;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/********************************************************************************
* Copyright (c) 2023 T-Systems International GmbH
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://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.eclipse.tractusx.autosetup.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import lombok.Data;

@Configuration
@Data
public class EmailConfigurationProperty {

@Value("${mail.smtp.host}")
private String host;

@Value("${mail.smtp.port}")
private String port;

@Value("${mail.from.address}")
private String fromAddress;

@Value("${mail.smtp.starttls.enable}")
private Boolean startTlsEnable;

@Value("${mail.smtp.username}")
private String username;

@Value("${mail.smtp.password}")
private String password;

@Value("${mail.smtp.auth}")
private Boolean auth;

@Value("${mail.replyto.address}")
private String replytoAddress;

}
Loading

0 comments on commit 289cd17

Please sign in to comment.