-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oraclebmcs): Add Oracle BMCS Storage Service provider (#230)
Note that we manually download our SDK and add to classpath in our gradle build script. We did this in clouddriver too. This will be fixed once our SDK is available on Maven central - soon(ish). Also note that due to the Front50 classpath containing Jersey 1 (brought in by kork IIRC?) we've had to not use our SDK's Jersey 2 based storage client and instead create a minimal Jersey 1 implementation. Hopefully this can be improved upon in the future either by bumping kork to use Jersey 2?
- Loading branch information
Showing
8 changed files
with
448 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,6 @@ out/ | |
vendor/ | ||
.bundle/ | ||
*.iml | ||
.idea | ||
.idea | ||
|
||
front50-oracle-bmcs/bmcs-sdk |
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,58 @@ | ||
class DownloadTask extends DefaultTask { | ||
@Input | ||
String sourceUrl | ||
|
||
@OutputFile | ||
File target | ||
|
||
@TaskAction | ||
void download() { | ||
ant.get(src: sourceUrl, dest: target) | ||
} | ||
} | ||
|
||
final File sdkDownloadLocation = project.file('build/sdkdownload') | ||
final File sdkLocation = project.file('build/bmcs-sdk') | ||
|
||
// Oracle BMCS SDK isn't published to any maven repo (yet!), so we manually download, unpack and add to compile deps | ||
task fetchSdk(type: DownloadTask) { | ||
sourceUrl = 'https://github.com/oracle/bmcs-java-sdk/releases/download/v1.2.5/oracle-bmcs-java-sdk.zip' | ||
target = sdkDownloadLocation | ||
} | ||
|
||
task unpackSdk(type: Sync) { | ||
dependsOn('fetchSdk') | ||
from zipTree(tasks.fetchSdk.target) | ||
into sdkLocation | ||
include "**/*.jar" | ||
exclude "**/*-sources.jar" | ||
exclude "**/*-javadoc.jar" | ||
exclude "apidocs/**" | ||
exclude "examples/**" | ||
exclude "**/*jackson*.jar" | ||
exclude "**/*jersey*.jar" | ||
exclude "**/hk2*.jar" | ||
exclude "**/*guava*.jar" | ||
exclude "**/commons*.jar" | ||
exclude "**/aopalliance*.jar" | ||
exclude "**/javassist*.jar" | ||
exclude "**/slf*.jar" | ||
exclude "**/osgi*.jar" | ||
exclude "**/validation*.jar" | ||
exclude "**/jsr305*.jar" | ||
} | ||
|
||
task cleanSdk(type: Delete) { | ||
delete sdkLocation, sdkDownloadLocation | ||
} | ||
|
||
tasks.clean.dependsOn('cleanSdk') | ||
tasks.compileJava.dependsOn('unpackSdk') | ||
|
||
dependencies { | ||
compile project(":front50-core") | ||
|
||
compile fileTree(sdkLocation) | ||
|
||
testCompile project(":front50-test") | ||
} |
39 changes: 39 additions & 0 deletions
39
front50-oracle-bmcs/src/main/java/com/netflix/spinnaker/front50/config/OracleBMCSConfig.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,39 @@ | ||
/* | ||
* Copyright (c) 2017 Oracle America, Inc. | ||
* | ||
* The contents of this file are subject to the Apache License Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* If a copy of the Apache License Version 2.0 was not distributed with this file, | ||
* You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.html | ||
*/ | ||
package com.netflix.spinnaker.front50.config; | ||
|
||
import com.netflix.spinnaker.front50.model.OracleBMCSStorageService; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.io.IOException; | ||
|
||
@Configuration | ||
@ConditionalOnExpression("${spinnaker.oraclebmcs.enabled:false}") | ||
@EnableConfigurationProperties(OracleBMCSProperties.class) | ||
public class OracleBMCSConfig extends CommonStorageServiceDAOConfig { | ||
|
||
@Bean | ||
public OracleBMCSStorageService oracleBMCSStorageService(OracleBMCSProperties oracleBMCSProperties) throws IOException { | ||
OracleBMCSStorageService oracleBMCSStorageService = new OracleBMCSStorageService(oracleBMCSProperties); | ||
oracleBMCSStorageService.ensureBucketExists(); | ||
return oracleBMCSStorageService; | ||
} | ||
|
||
@Bean | ||
@ConditionalOnMissingBean(RestTemplate.class) | ||
public RestTemplate restTemplate() { | ||
return new RestTemplate(); | ||
} | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
...-oracle-bmcs/src/main/java/com/netflix/spinnaker/front50/config/OracleBMCSProperties.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,89 @@ | ||
/* | ||
* Copyright (c) 2017 Oracle America, Inc. | ||
* | ||
* The contents of this file are subject to the Apache License Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* If a copy of the Apache License Version 2.0 was not distributed with this file, | ||
* You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.html | ||
*/ | ||
package com.netflix.spinnaker.front50.config; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties("spinnaker.oraclebmcs") | ||
public class OracleBMCSProperties { | ||
|
||
private String bucketName = "_spinnaker_front50_data"; | ||
private String namespace; | ||
private String compartmentId; | ||
private String region = "us-phoenix-1"; | ||
private String userId; | ||
private String fingerprint; | ||
private String sshPrivateKeyFilePath; | ||
private String tenancyId; | ||
|
||
|
||
public String getBucketName() { | ||
return bucketName; | ||
} | ||
|
||
public void setBucketName(String bucketName) { | ||
this.bucketName = bucketName; | ||
} | ||
|
||
public String getNamespace() { | ||
return namespace; | ||
} | ||
|
||
public void setNamespace(String namespace) { | ||
this.namespace = namespace; | ||
} | ||
|
||
public String getCompartmentId() { | ||
return compartmentId; | ||
} | ||
|
||
public void setCompartmentId(String compartmentId) { | ||
this.compartmentId = compartmentId; | ||
} | ||
|
||
public String getRegion() { | ||
return region; | ||
} | ||
|
||
public void setRegion(String region) { | ||
this.region = region; | ||
} | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(String userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public String getFingerprint() { | ||
return fingerprint; | ||
} | ||
|
||
public void setFingerprint(String fingerprint) { | ||
this.fingerprint = fingerprint; | ||
} | ||
|
||
public String getSshPrivateKeyFilePath() { | ||
return sshPrivateKeyFilePath; | ||
} | ||
|
||
public void setSshPrivateKeyFilePath(String sshPrivateKeyFilePath) { | ||
this.sshPrivateKeyFilePath = sshPrivateKeyFilePath; | ||
} | ||
|
||
public String getTenancyId() { | ||
return tenancyId; | ||
} | ||
|
||
public void setTenancyId(String tenancyId) { | ||
this.tenancyId = tenancyId; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
front50-oracle-bmcs/src/main/java/com/netflix/spinnaker/front50/model/LastModified.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,23 @@ | ||
/* | ||
* Copyright (c) 2017 Oracle America, Inc. | ||
* | ||
* The contents of this file are subject to the Apache License Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* If a copy of the Apache License Version 2.0 was not distributed with this file, | ||
* You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.html | ||
*/ | ||
|
||
package com.netflix.spinnaker.front50.model; | ||
|
||
|
||
public class LastModified { | ||
private Long lastModified = System.currentTimeMillis(); | ||
|
||
public Long getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
public void setLastModified(Long lastModified) { | ||
this.lastModified = lastModified; | ||
} | ||
} |
Oops, something went wrong.