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
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
Step 3: Create the Integration
Integration flow:
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:
No comments:
Post a Comment