-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johannes Hiemer
committed
Jun 1, 2018
1 parent
214b8d2
commit 03cec57
Showing
14 changed files
with
84 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule osb-backup-core
updated
2 files
+10 −6 | src/main/java/de/evoila/cf/model/DatabaseCredential.java | |
+1 −1 | src/main/java/de/evoila/cf/model/enums/DatabaseType.java |
Submodule osb-core
updated
from c6233d to 01e5bb
Submodule osb-deployment
updated
from d8c7a2 to 1bc81a
Submodule osb-persistence
updated
from 152808 to cc937f
45 changes: 45 additions & 0 deletions
45
osb-service/src/main/java/de/evoila/cf/broker/backup/BackupCustomServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package de.evoila.cf.broker.backup; | ||
|
||
import de.evoila.cf.broker.bean.BackupTypeConfiguration; | ||
import de.evoila.cf.broker.custom.mysql.MySQLUtils; | ||
import de.evoila.cf.broker.exception.ServiceInstanceDoesNotExistException; | ||
import de.evoila.cf.broker.model.ServiceInstance; | ||
import de.evoila.cf.broker.repository.ServiceInstanceRepository; | ||
import de.evoila.cf.broker.service.BackupCustomService; | ||
import de.evoila.cf.model.DatabaseCredential; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@ConditionalOnBean(BackupTypeConfiguration.class) | ||
public class BackupCustomServiceImpl implements BackupCustomService { | ||
|
||
BackupTypeConfiguration backupTypeConfiguration; | ||
|
||
ServiceInstanceRepository serviceInstanceRepository; | ||
|
||
public BackupCustomServiceImpl(BackupTypeConfiguration backupTypeConfiguration, | ||
ServiceInstanceRepository serviceInstanceRepository) { | ||
this.backupTypeConfiguration = backupTypeConfiguration; | ||
this.serviceInstanceRepository = serviceInstanceRepository; | ||
} | ||
|
||
public DatabaseCredential getCredentialsForInstanceId(String serviceInstanceId) throws ServiceInstanceDoesNotExistException { | ||
ServiceInstance instance = serviceInstanceRepository.getServiceInstance(serviceInstanceId); | ||
|
||
if(instance == null || instance.getHosts().size() <= 0) { | ||
throw new ServiceInstanceDoesNotExistException(serviceInstanceId); | ||
} | ||
|
||
DatabaseCredential credential = new DatabaseCredential(); | ||
credential.setContext(MySQLUtils.dbName(instance.getId())); | ||
credential.setUsername(instance.getUsername()); | ||
credential.setPassword(instance.getPassword()); | ||
credential.setHostname(instance.getHosts().get(0).getIp()); | ||
credential.setPort(instance.getHosts().get(0).getPort()); | ||
credential.setType(backupTypeConfiguration.getType()); | ||
|
||
return credential; | ||
} | ||
|
||
} |
15 changes: 0 additions & 15 deletions
15
osb-service/src/main/java/de/evoila/cf/broker/custom/mysql/MySQLBackupTypeService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
osb-service/src/main/java/de/evoila/cf/broker/custom/mysql/MySQLUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package de.evoila.cf.broker.custom.mysql; | ||
|
||
public class MySQLUtils { | ||
|
||
public static String dbName(String uuid) { | ||
if (uuid != null && uuid.length() > 15) | ||
return "d" + uuid.replace("-", "").substring(0, 15); | ||
else | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters