Tuesday, July 28, 2026

OIC - Oracle Integration Cloud (OIC): Automatically Create Folder Structures in OCI Object Storage | use of ends-with() function

 Introduction

When working with OCI Object Storage, we often need to create multiple folders and subfolders before uploading files. Although this can be done manually through the OCI Console, repeatedly logging in and creating folders becomes time-consuming, especially during project setup or migration activities.

In this blog, we'll build a reusable Oracle Integration Cloud (OIC) service that automatically creates the required folder hierarchy in an OCI Object Storage bucket.

Business Requirement

Create an OIC REST service that accepts:

  • Object Storage Namespace
  • Bucket Name
  • An array of folder and subfolder paths

The integration will iterate through each folder path and create an empty placeholder object so that the folder structure is visible in Object Storage.

This eliminates the need to manually log in to OCI and create folders one by one.

Sample Request

{
  "namespace": "my_namespace",
  "bucketName": "integration-bucket",
  "folders": [
    "Inbound",
    "Outbound",
    "Archive",
    "Archive/Success",
    "Archive/Error",
    "Logs",
    "Reports/Daily",
    "Reports/Monthly"
  ]
}

Solution Design

The integration performs the following steps:

  1. Expose a REST endpoint.
  2. Read the Namespace, Bucket Name, and folder array.
  3. Use a For-Each action to iterate through every folder path.
  4. For each folder:
    • Append a trailing / if required.
    • Create a dummy empty object (0-byte file) using the OCI Object Storage Adapter.
  5. Return a success response once all folders have been created.

Integration Flow

REST Trigger
      │
      ▼
Read Request Payload
      │
      ▼
For Each Folder
      │
      ▼
Create Empty Object in OCI Object Storage
      │
      ▼
Next Folder
      │
      ▼
Return Success Response

Why Create an Empty File?

OCI Object Storage does not actually store folders. Instead, folders are represented by object names containing /.

By creating an empty object (0-byte placeholder) for each folder path, the OCI Console displays the folder hierarchy, making it easier for users and integrations to organize files.

Benefits

  • No manual login to the OCI Console.
  • Quickly create complete folder hierarchies.
  • Reusable across multiple projects and environments.
  • Accepts any number of folders through a single request.
  • Ideal for deployment automation and project onboarding.
  • Reduces manual effort and configuration errors.

Sample Response

{
  "status": "SUCCESS",
  "message": "Folder structure created successfully."
}

Use Cases

  • Initial Object Storage bucket setup.
  • Environment provisioning.
  • Automated deployment pipelines.
  • Project onboarding.
  • Creating standard folder templates across multiple buckets.















Conclusion

This reusable OIC service simplifies the creation of folder structures in OCI Object Storage by accepting a bucket name, namespace, and list of folder paths. Instead of manually navigating the OCI Console, users can create an entire folder hierarchy with a single API request, saving time and ensuring consistency across environments.

This lightweight utility is particularly useful for automation, CI/CD deployments, and projects that frequently provision new Object Storage buckets.

No comments:

Post a Comment

Featured Post

Notepad - Improve Productivity in Notepad++ by Managing Multiple Open Tabs

Introduction When numerous files are open in Notepad++, not all tabs are visible in a single row. Enabling multi-line tabs allows Notepad++ ...