@@ -170,7 +170,7 @@ def url(self, container_name, object_name):
170
170
171
171
class CloudObjectStorage (object ):
172
172
173
- def __init__ (self , sparkcontext , credentials , configuration_name = '' , cos_type = 'classic_cos ' , auth_method = 'api_key' , bucket_name = '' ):
173
+ def __init__ (self , sparkcontext , credentials , configuration_name = '' , cos_type = 'softlayer_cos ' , auth_method = 'api_key' , bucket_name = '' ):
174
174
175
175
'''
176
176
This class allows you to connect to a cloud object storage (COS) instance. It also support connecting to a cos instance
@@ -180,7 +180,7 @@ def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='c
180
180
181
181
credentials: a dictionary with the required keys to connect to cos. The required keys differ according
182
182
to the type of cos.
183
- - for cos type "classic_cos " the following key are required:
183
+ - for cos type "softlayer_cos " the following key are required:
184
184
* endpoint
185
185
* access_key
186
186
* secret_key
@@ -197,10 +197,10 @@ def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='c
197
197
if a configuration name is not passed the default one will be used "service".
198
198
199
199
cos_type [optional]: string that identifies the type of cos to connect to. The supported types of cos
200
- are "classic_cos " and "bluemix_cos". "classic_cos " will be chosen as default if no cos_type is passed.
200
+ are "softlayer_cos " and "bluemix_cos". "softlayer_cos " will be chosen as default if no cos_type is passed.
201
201
202
- auth_method [optional]: string that identifies the type of authorization to use when connecting to cos. This param
203
- is not reqired for classic_cos but only needed for bluemix_cos. Two options can be chosen for this params
202
+ auth_method [optional]: string that identifies the type of authorization to use when connecting to cos. This parameter
203
+ is not reqired for softlayer_cos but only needed for bluemix_cos. Two options can be chosen for this params
204
204
"api_key" or "iam_token". "api_key" will be chosen as default if the value is not set.
205
205
206
206
bucket_name [optional]: string that identifies the defult
@@ -227,7 +227,7 @@ def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='c
227
227
hconf .set (prefix + ".endpoint" , credentials ['endpoint' ])
228
228
229
229
# softlayer cos case
230
- if (cos_type == "classic_cos " ):
230
+ if (cos_type == "softlayer_cos " ):
231
231
hconf .set (prefix + ".access.key" , credentials ['access_key' ])
232
232
hconf .set (prefix + ".secret.key" , credentials ['secret_key' ])
233
233
@@ -246,7 +246,7 @@ def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='c
246
246
hconf .set (prefix + ".v2.signer.type" , credentials ['v2_signer_type' ])
247
247
248
248
def _validate_input (self , credentials , cos_type , auth_method ):
249
- required_key_classic_cos = ["endpoint" , "access_key" , "secret_key" ]
249
+ required_key_softlayer_cos = ["endpoint" , "access_key" , "secret_key" ]
250
250
required_key_list_iam_api_key = ["endpoint" , "api_key" , "service_id" ]
251
251
required_key_list_iam_token = ["endpoint" , "iam_token" , "service_id" ]
252
252
@@ -258,10 +258,10 @@ def _get_required_keys(cos_type, auth_method):
258
258
return required_key_list_iam_token
259
259
else :
260
260
raise ValueError ("Invalid input: auth_method. auth_method is optional but if set, it should have one of the following values: api_key, iam_token" )
261
- elif (cos_type == "classic_cos " ):
262
- return required_key_classic_cos
261
+ elif (cos_type == "softlayer_cos " ):
262
+ return required_key_softlayer_cos
263
263
else :
264
- raise ValueError ("Invalid input: cos_type. cos_type is optional but if set, it should have one of the following values: classic_cos , bluemix_cos" )
264
+ raise ValueError ("Invalid input: cos_type. cos_type is optional but if set, it should have one of the following values: softlayer_cos , bluemix_cos" )
265
265
266
266
# check keys
267
267
required_key_list = _get_required_keys (cos_type , auth_method )
0 commit comments