@@ -138,7 +138,6 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
138
138
validateInput(credentials , cosType , authMethod )
139
139
140
140
# set up hadoop config
141
-
142
141
if (is.null(credentials [" endpoint" ][[1 ]])) {
143
142
stop(" Attribute endpoint in credentials is missing!" )
144
143
}
@@ -173,8 +172,10 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
173
172
requiredKeys = get_required_key_array(cosType , authMethod )
174
173
175
174
# check the existence of all required values in credentials
176
- for (name in names(requiredKeys )) {
177
-
175
+ for (key in requiredKeys ) {
176
+ if (! key %in% credentials ) {
177
+ stop(" Invalid input: missing required input [" + key + " ]!" )
178
+ }
178
179
}
179
180
180
181
},
@@ -186,14 +187,14 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
186
187
187
188
if (cosType == " bluemix_cos" ) {
188
189
if (authMethod == " api_key" ) {
189
- return requiredKeyListIamApiKey
190
+ return ( requiredKeyListIamApiKey )
190
191
} else if (authMethod == " iam_token" ) {
191
- return requiredKeyListIamToken
192
+ return ( requiredKeyListIamToken )
192
193
} else {
193
194
stop(" Invalid input: authMethod. authMethod is optional but if set, it should have one of the following values: api_key, iam_token" )
194
195
}
195
196
} else if (cosType == " softlayer_cos" ) {
196
- return requiredKeySoftlayerCos
197
+ return ( requiredKeySoftlayerCos )
197
198
} else {
198
199
stop(" Invalid input: cosType. cosType is optional but if set, it should have one of the following values: softlayer_cos, bluemix_cos" )
199
200
}
0 commit comments