@@ -140,12 +140,33 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
140
140
# bind config name
141
141
.self $ configName = configurationName
142
142
143
- # set prefix for hadoop config
143
+ # set up hadoop config
144
144
prefix = paste(" fs.cos" , getConfigName(), sep = ' .' )
145
145
hConf = SparkR ::: callJMethod(sparkContext , " hadoopConfiguration" )
146
+
146
147
SparkR ::: callJMethod(hConf , " set" , paste(prefix , " endpoint" , sep = ' .' ), credentials [' endpoint' ][[1 ]])
147
- SparkR ::: callJMethod(hConf , " set" , paste(prefix , " access.key" , sep = ' .' ), credentials [' accessKey' ][[1 ]])
148
- SparkR ::: callJMethod(hConf , " set" , paste(prefix , " secret.key" , sep = ' .' ), credentials [' secretKey' ][[1 ]])
148
+
149
+ if (cosType == " softlayer_cos" ) {
150
+ # softlayer COS case
151
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " access.key" , sep = ' .' ), credentials [' accessKey' ][[1 ]])
152
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " secret.key" , sep = ' .' ), credentials [' secretKey' ][[1 ]])
153
+ } else if (cosType == " bluemix_cos" ) {
154
+ # bluemix COS case
155
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " iam.service.id" , sep = ' .' ), credentials [' serviceId' ][[1 ]])
156
+ if (authMethod == " api_key" ) {
157
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " iam.api.key" , sep = ' .' ), credentials [' apiKey' ][[1 ]])
158
+ } else if (authMethod == " iam_token" ) {
159
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " iam.token" , sep = ' .' ), credentials [' iamToken' ][[1 ]])
160
+ }
161
+
162
+ if (" iamServiceEndpoint" %in% credentials {
163
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " iam.endpoint" , sep = ' .' ), credentials [' iamServiceEndpoint' ][[1 ]])
164
+ }
165
+
166
+ if (" v2SignerType" %in% credentials ) {
167
+ SparkR ::: callJMethod(hConf , " set" , paste(prefix , " v2.signer.type" , sep = ' .' ), credentials [' v2SignerType' ][[1 ]])
168
+ }
169
+ }
149
170
},
150
171
151
172
getConfigName = function () {
@@ -164,7 +185,6 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
164
185
stop(" Invalid input: missing required input [" + key + " ]!" )
165
186
}
166
187
}
167
-
168
188
},
169
189
170
190
get_required_key_array = function (cosType , authMethod ) {
0 commit comments