Skip to content

Commit 91eab22

Browse files
committed
finish implementing get_required_key_array
1 parent 185d5f7 commit 91eab22

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

r/sparkr/R/osconfig.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,26 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
173173

174174
},
175175

176+
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"]
180+
181+
if (cosType == "bluemix_cos") {
182+
if (authMethod == "api_key") {
183+
return required_key_list_iam_api_key
184+
} else if (authMethod == "iam_token") {
185+
return required_key_list_iam_token
186+
} else {
187+
stop("Invalid input: authMethod. authMethod is optional but if set, it should have one of the following values: api_key, iam_token")
188+
}
189+
} else if (cosType == "softlayer_cos") {
190+
return required_key_softlayer_cos
191+
} else {
192+
stop("Invalid input: cosType. cosType is optional but if set, it should have one of the following values: softlayer_cos, bluemix_cos")
193+
}
194+
},
195+
176196
url = function(bucketName, objectName) {
177197
serviceName = getConfigName()
178198
return (paste("cos://", bucketName, ".", serviceName, "/", objectName, sep = ""))

0 commit comments

Comments
 (0)