@@ -173,18 +173,36 @@ class CloudObjectStorage(object):
173
173
def __init__ (self , sparkcontext , credentials , configuration_name = '' , cos_type = 'classic_cos' , auth_method = 'api_key' , bucket_name = '' ):
174
174
175
175
'''
176
+ This class allows you to connect to a cloud object storage (COS) instance. It also support connecting to a cos instance
177
+ that is being hosted on bluemix.
178
+
176
179
sparkcontext: a SparkContext object.
177
180
178
- credentials: a dictionary with the following required keys:
179
- * endpoint
180
- * access_key
181
- * secret_key
181
+ credentials: a dictionary with the required keys to connect to cos. The required keys differ according
182
+ to the type of cos.
183
+ - for cos type "classic_cos" the following key are required:
184
+ * endpoint
185
+ * access_key
186
+ * secret_key
187
+ - for cos type "bluemix_cos", here are the required/optional key:
188
+ * endpoint [required]
189
+ * service_id [required]
190
+ * api_key OR iam_token depends on the selected authorization method (auth_method) [required]
191
+ * iam_service_endpoint [optional]
192
+ * v2_signer_type [optional]
182
193
183
194
configuration_name [optional]: string that identifies this configuration. You can
184
195
use any string you like. This allows you to create
185
196
multiple configurations to different Object Storage accounts.
186
197
if a configuration name is not passed the default one will be used "service".
187
198
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.
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
204
+ "api_key" or "iam_token". "api_key" will be chosen as default if the value is not set.
205
+
188
206
bucket_name [optional]: string that identifies the defult
189
207
bucket nameyou want to access files from in the COS service instance.
190
208
If this value is not specified, you need to pass it when
@@ -248,8 +266,6 @@ def _get_required_keys(cos_type, auth_method):
248
266
if (key not in credentials ):
249
267
raise ValueError ("Invalid input: credentials. {} is required!" .format (key ))
250
268
251
- return True
252
-
253
269
def url (self , object_name , bucket_name = '' ):
254
270
bucket_name_var = ''
255
271
service_name = DEFAULT_SERVICE_NAME
0 commit comments