Examples

IBMStreams com.ibm.streamsx.objectstorage Toolkit > com.ibm.streamsx.objectstorage 2.2.5 > com.ibm.streamsx.objectstorage.s3 > S3ObjectStorageScan > Examples

This example use the S3ObjectStorageScan operator and S3ObjectStorageSource operator.

As endpoint is the public us-geo (CROSS REGION) the default value of the endpoint submission parameter.

composite Main {
    param
        expression<rstring> $accessKeyID : getSubmissionTimeValue("os-access-key-id");
        expression<rstring> $secretAccessKey : getSubmissionTimeValue("os-secret-access-key");
        expression<rstring> $bucket: getSubmissionTimeValue("os-bucket");
        expression<rstring> $endpoint: getSubmissionTimeValue("os-endpoint", "s3.us.cloud-object-storage.appdomain.cloud");
    graph
        // S3ObjectStorageScan operator with directory and pattern
        stream<rstring name> Scanned = com.ibm.streamsx.objectstorage.s3::S3ObjectStorageScan() {
            param

                accessKeyID : $accessKeyID;
                secretAccessKey : $secretAccessKey;
                bucket : $bucket;
                endpoint: $endpoint;
                directory: "/sample";
                pattern: ".*";
        }

        // use a S3ObjectStorageSource operator to process the object names
        stream<rstring line> Data = com.ibm.streamsx.objectstorage.s3::S3ObjectStorageSource(Scanned) {
            param
                accessKeyID : $accessKeyID;
                secretAccessKey : $secretAccessKey;
                bucket : $bucket;
                endpoint: $endpoint;
        }
}