Tuesday, August 23, 2022

OIC How to use OCI Object storage from the Oracle Integration Cloud | Put a file to OCI Object storage from Oracle Integration Cloud

UseCase: Here, we will create a OCI object storage bucket. From OIC, read a file and put that file to bucket using Rest connection.

Step 1 : Create a bucket in OCI object storage

In the Oracle console >> Storage >> object storage & Archive storage >> select the required compartment >> create bucket






Step 2 : Create a Object storage Rest connection

To create a Rest connection , we need to collect the following information:

Connection type : REST API Base URL

Connection URL : https://objectstorage.<region>.oraclecloud.com

My case, region is: us-ashburn-1

Securtity: OCI Signature Version 1

Tenancy OCID and Object storage Namespace: get the Tenancy OCID from the OCI console on the Tenancy Details page.

Search Tenancy in the search box


Or from profile >> Tennacy


Here we also got the Object storage namespace.

User OCID : get the user's OCID in the console on the User details page.

Profile >> User Settings




Private Key & FingerPrint: 

Profile >> User settings >> API Keys >> Add API Key >> download private key >> add >> note the fingerprint.






Oracle home >> Integrations >> Connections >> Create >> Rest 




Test and save.

Step 3:  Create the Integration

Integration flow:


Read the file 





Call the rest connection to put the file to object storage

URI: /n/{namespaceName}/b/{bucketName}/o/{objectName}
Verb: PUT
Configure Request Payload as Binary Format.




Map the namespace, bucket name, object name and fileReference to stream reference.

Save, Add Tracking and activate and test

See the below file uploaded to object storage bucket.



Note: Private key downloaded from the Oracle Cloud Infrastructure Console are in PKCS8 format. The OCI Signature version 1 security policy available with the Rest adapter only supports reading of the private key in RSA format(PKCS1) format.

If you receive the following error, you must convert the private key from PKCS8 to RSA(PKC1) format:

oracle.cloud.connector.impl.rest.security.signature.signatureException: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo can not be cast to org.bouncycastle.openssl.PEMKeyPair.

Convert the private key with the following command:

openssl rsa -in private_key_in_pkcs8_format.pem -out new_converted_file.pem

We can also convert it using online availavle site like below:

https://8gwifi.org/pemconvert.jsp

Reference:

https://blogs.oracle.com/integration/post/how-to-use-the-oci-object-storage-from-the-oracle-integration-cloud


No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...