Skip to content

Commit 40f0c9b

Browse files
committed
setup hadoop config according to the new options
1 parent 807f12b commit 40f0c9b

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

scala/src/main/scala/Osconfig.scala

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,28 @@ class CloudObjectStorage(sc: SparkContext, credentials: HashMap[String, String],
161161
val prefix = "fs.cos." + _getConfigurationName()
162162

163163
hadoopConf.set(prefix + ".endpoint", credentials("endPoint"))
164-
hadoopConf.set(prefix + ".access.key", credentials("accessKey"))
165-
hadoopConf.set(prefix + ".secret.key", credentials("secretKey"))
164+
165+
if (cos_type == "softlayer_cos") {
166+
// softlayer cos case
167+
hadoopConf.set(prefix + ".access.key", credentials("accessKey"))
168+
hadoopConf.set(prefix + ".secret.key", credentials("secretKey"))
169+
} else if (cos_type == "bluemix_cos") {
170+
// bluemix cos case
171+
hadoopConf.set(prefix + ".iam.service.id", credentials("serviceId"))
172+
if (authMethod == "api_key") {
173+
hadoopConf.set(prefix + ".iam.api.key", credentials("apiKey"))
174+
} else if (authMethod == "iam_token") {
175+
hadoopConf.set(prefix + ".iam.token", credentials("iamToken"))
176+
}
177+
178+
if (credentials.contains("iamServiceEndpoint")) {
179+
hadoopConf.set(prefix + ".iam.endpoint", credentials("iamServiceEndpoint"))
180+
}
181+
182+
if (credentials.contains("v2SignerType")) {
183+
hadoopConf.set(prefix + ".v2.signer.type", credentials("v2SignerType"))
184+
}
185+
}
166186

167187
private def _getConfigurationName() : String = {
168188
if (configurationName != "") {

0 commit comments

Comments
 (0)