IBMStreams com.ibm.streamsx.objectstorage Toolkit > com.ibm.streamsx.objectstorage 2.2.5 > com.ibm.streamsx.objectstorage > ObjectStorageScan > Examples
These examples use the ObjectStorageScan operator.
a) Sample using bucket as submission parameter and cos application configuration with property cos.creds to specify the IBM COS credentials:
As endpoint is the public us-geo (CROSS REGION) the default value of the os-endpoint submission parameter.
composite Main { param expression<rstring> $bucket: getSubmissionTimeValue("os-bucket"); expression<rstring> $endpoint: getSubmissionTimeValue("os-endpoint", "s3.us.cloud-object-storage.appdomain.cloud"); graph // ObjectStorageScan operator with directory and pattern stream<rstring name> Scanned = com.ibm.streamsx.objectstorage::ObjectStorageScan() { param objectStorageURI: com.ibm.streamsx.objectstorage.s3::getObjectStorageURI($bucket); endpoint: $endpoint; directory: "/sample"; pattern: ".*"; } // use a ObjectStorageSource operator to process the object names stream<rstring line> Data = com.ibm.streamsx.objectstorage::ObjectStorageSource(Scanned) { param objectStorageURI: com.ibm.streamsx.objectstorage.s3::getObjectStorageURI($bucket); endpoint: $endpoint; } }
b) Sample using the credentials parameter to specify the IBM COS credentials:
Set the objectStorageURI either in format "cos://<bucket-name>/" or "s3a://<bucket-name>/".
composite Main { param expression<rstring> $credentials: getSubmissionTimeValue("os-credentials"); expression<rstring> $objectStorageURI: getSubmissionTimeValue("os-uri"); expression<rstring> $endpoint: getSubmissionTimeValue("os-endpoint", "s3.us.cloud-object-storage.appdomain.cloud"); graph // ObjectStorageScan operator with directory and pattern stream<rstring name> Scanned = com.ibm.streamsx.objectstorage::ObjectStorageScan() { param credentials: $credentials; objectStorageURI: $objectStorageURI; endpoint: $endpoint; directory: "/sample"; pattern: ".*"; } // use a ObjectStorageSource operator to process the object names stream<rstring line> Data = com.ibm.streamsx.objectstorage::ObjectStorageSource(Scanned) { param credentials: $credentials; objectStorageURI: $objectStorageURI; endpoint: $endpoint; } }