Skip to content

Commit 7a563e1

Browse files
committed
Update class description
1 parent d883a5e commit 7a563e1

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

python/ibmos2spark/osconfig.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,36 @@ class CloudObjectStorage(object):
173173
def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='classic_cos', auth_method='api_key', bucket_name=''):
174174

175175
'''
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+
176179
sparkcontext: a SparkContext object.
177180
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]
182193
183194
configuration_name [optional]: string that identifies this configuration. You can
184195
use any string you like. This allows you to create
185196
multiple configurations to different Object Storage accounts.
186197
if a configuration name is not passed the default one will be used "service".
187198
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+
188206
bucket_name [optional]: string that identifies the defult
189207
bucket nameyou want to access files from in the COS service instance.
190208
If this value is not specified, you need to pass it when
@@ -248,8 +266,6 @@ def _get_required_keys(cos_type, auth_method):
248266
if (key not in credentials):
249267
raise ValueError("Invalid input: credentials. {} is required!".format(key))
250268

251-
return True
252-
253269
def url(self, object_name, bucket_name=''):
254270
bucket_name_var = ''
255271
service_name = DEFAULT_SERVICE_NAME

0 commit comments

Comments
 (0)