@@ -170,24 +170,30 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
170
170
},
171
171
172
172
validateInput = function (credentials , cosType , authMethod ) {
173
+ requiredKeys = get_required_key_array(cosType , authMethod )
174
+
175
+ # check the existence of all required values in credentials
176
+ for (name in names(requiredKeys )) {
177
+
178
+ }
173
179
174
180
},
175
181
176
182
get_required_key_array = function (cosType , authMethod ) {
177
- required_key_softlayer_cos = [ " endpoint" , " accessKey" , " secretKey" ]
178
- required_key_list_iam_api_key = [ " endpoint" , " apiKey" , " serviceId" ]
179
- required_key_list_iam_token = [ " endpoint" , " iamToken" , " serviceId" ]
183
+ requiredKeySoftlayerCos = list ( " endpoint" , " accessKey" , " secretKey" )
184
+ requiredKeyListIamApiKey = list ( " endpoint" , " apiKey" , " serviceId" )
185
+ requiredKeyListIamToken = list ( " endpoint" , " iamToken" , " serviceId" )
180
186
181
187
if (cosType == " bluemix_cos" ) {
182
188
if (authMethod == " api_key" ) {
183
- return required_key_list_iam_api_key
189
+ return requiredKeyListIamApiKey
184
190
} else if (authMethod == " iam_token" ) {
185
- return required_key_list_iam_token
191
+ return requiredKeyListIamToken
186
192
} else {
187
193
stop(" Invalid input: authMethod. authMethod is optional but if set, it should have one of the following values: api_key, iam_token" )
188
194
}
189
195
} else if (cosType == " softlayer_cos" ) {
190
- return required_key_softlayer_cos
196
+ return requiredKeySoftlayerCos
191
197
} else {
192
198
stop(" Invalid input: cosType. cosType is optional but if set, it should have one of the following values: softlayer_cos, bluemix_cos" )
193
199
}
0 commit comments