Skip to content

[Components] oracle_cloud_infrastructure - new components #16206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Apr 8, 2025

WHY

Resolves #16070

Summary by CodeRabbit

  • New Features
    • Introduced functionality to create, update, and delete objects in Oracle Cloud Infrastructure Object Storage.
    • Expanded cloud integration with enhanced configurations for managing compartments, buckets, namespaces, and instances.
    • Added event-driven features for autonomous database creation, compute instance state changes, and new object uploads.
    • Implemented webhook management and standardized event definitions for improved notifications.
    • Upgraded package dependencies and version for enhanced performance and stability.

@jcortes jcortes self-assigned this Apr 8, 2025
Copy link

vercel bot commented Apr 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Apr 8, 2025 4:13pm
pipedream-docs ⬜️ Ignored (Inspect) Apr 8, 2025 4:13pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 8, 2025 4:13pm

Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Walkthrough

This pull request introduces several new modules and significant enhancements to the Oracle Cloud Infrastructure components. It adds action modules for creating/updating and deleting object storage objects, a constants module for various OCI API configurations, and an expanded application module with comprehensive property definitions and methods for OCI service integrations. Additionally, new sources for webhook management and event emission related to autonomous database creation, instance state changes, and object storage events have been added. The package version is bumped and new dependencies are included.

Changes

File Path(s) Change Summary
components/oracle_cloud_infrastructure/actions/{create-update-object,delete-object}/*.mjs New action modules to create/update and delete OCI Object Storage objects with dynamic property definitions and methods wrapping API requests.
components/oracle_cloud_infrastructure/common/constants.mjs Introduces constants for OCI endpoints and messaging identifiers.
components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjs Expanded application with detailed property definitions and methods for interacting with various OCI services.
components/oracle_cloud_infrastructure/package.json Version updated from 0.0.1 to 0.1.0; new dependencies for OCI libraries and related packages added.
components/oracle_cloud_infrastructure/sources/common/{events,webhook}.mjs New modules for exporting OCI event constants and managing webhook operations (activation, deactivation, and event processing).
components/oracle_cloud_infrastructure/sources/new-{autonomous-database-created-instant,instance-state-change-instant,object-storage-object-instant}/*.mjs New event source modules emitting events for autonomous database creation, compute instance state changes, and new object storage uploads.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/Caller
    participant RU as Run Method
    participant GN as getNamespace
    participant PO as putObject (makeRequest)
    participant OCI as OCI Object Storage

    U->>RU: Trigger create/update action
    RU->>GN: Request namespace using compartmentId
    GN-->>RU: Return namespaceName
    RU->>PO: Invoke putObject with namespace, bucket, & object details
    PO->>OCI: Make PUT request to Object Storage
    OCI-->>PO: Return response with clientRequestId
    PO-->>RU: Return API response
    RU-->>U: Return summary with clientRequestId
Loading
sequenceDiagram
    participant W as Webhook Module
    participant T as Topic Service
    participant S as Subscription Service
    participant R as Rule Service
    participant Req as Incoming Request

    W->>T: Activate hook - create topic
    T-->>W: Topic created
    W->>S: Subscribe to topic
    S-->>W: Subscription confirmed
    W->>R: Set up event rule
    R-->>W: Rule established
    Note over W,Req: Webhook is active
    Req->>W: Incoming webhook event
    W->>W: Process event (confirmation check, emit metadata)
    W-->>Req: Return confirmation/response
Loading

Assessment against linked issues

Objective Addressed Explanation
OCI Object Actions (Upload & Delete) [#16070]
OCI Event Emission (Object Upload, Instance State Change, Autonomous DB Creation) [#16070]

Suggested labels

ai-assisted

Suggested reviewers

  • GTFalcao

Poem

I hopped through lines of code so bright,
Crafting actions and events with delight,
Oracle clouds now gleam in the night,
With constants and hooks taking flight,
A bunny’s cheer for a PR done right!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/oracle_cloud_infrastructure/actions/delete-object/delete-object.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/oracle_cloud_infrastructure/actions/create-update-object/create-update-object.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 6 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (11)
components/oracle_cloud_infrastructure/sources/common/events.mjs (1)

1-25: Well-structured event constants for OCI services

The organization of events by service type (DATABASE, COMPUTE, OBJECT_STORAGE) provides a clean structure for event handling. The fully qualified event names match OCI's event service format.

Consider adding JSDoc comments to explain what each event represents and when it occurs, which would improve code documentation for future developers:

export default {
  DATABASE: {
+   /**
+    * Event emitted when an Autonomous Database creation completes
+    */
    AUTONOMOUS_DATABASE_CREATE_END: "com.oraclecloud.databaseservice.autonomous.database.instance.create.end",
  },
  // Other sections with similar documentation...
};
components/oracle_cloud_infrastructure/common/constants.mjs (1)

14-16: Consider adding JSDoc comments for ID constants

The ID constants are clearly named but lack explanatory comments about their intended usage contexts.

+/**
+ * Default topic identifier used in notification configurations
+ */
const TOPIC_ID = "topicId";
+/**
+ * Default subscription identifier used in notification service
+ */
const SUBSCRIPTION_ID = "subscriptionId";
+/**
+ * Default rule identifier used in events service
+ */
const RULE_ID = "ruleId";
components/oracle_cloud_infrastructure/sources/new-object-storage-object-instant/new-object-storage-object-instant.mjs (1)

36-41: Consider removing eslint-disable comments

While the alert component is helpful for users, consider addressing the eslint warnings by adding proper label and description properties instead of disabling the linting rules.

-    // eslint-disable-next-line pipedream/props-label, pipedream/props-description
     info: {
       type: "alert",
       alertType: "info",
+      label: "Object Events Information",
+      description: "Information about Object Events",
       content: "To emit events for object state changes, enable Emit Object Events on the bucket details page. [Learn more](https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/managingbuckets_topic-To_enable_or_disable_emitting_events_for_object_state_changes.htm#top).",
     },
components/oracle_cloud_infrastructure/sources/new-instance-state-change-instant/new-instance-state-change-instant.mjs (1)

54-60: Consider adding more context to the event summary

The event summary could be more informative by including the specific state change that occurred.

     generateMeta(resource) {
       return {
         id: resource.eventID,
-        summary: `Instance state changed: ${resource.data?.resourceName}`,
+        summary: `Instance state changed: ${resource.data?.resourceName} (${resource.eventType.split(':').pop()})`,
         ts: Date.parse(resource.eventTime),
       };
     },
components/oracle_cloud_infrastructure/sources/new-autonomous-database-created-instant/new-autonomous-database-created-instant.mjs (1)

18-24: Consider adding data filter to the condition

Unlike the other components, this one doesn't specify a data filter to restrict events to a specific compartment. Consider adding a filter to ensure events are only triggered for the selected compartment.

     getCondition() {
       return JSON.stringify({
         eventType: [
           events.DATABASE.AUTONOMOUS_DATABASE_CREATE_END,
         ],
+        data: {
+          compartmentId: this.compartmentId,
+        },
       });
     },
components/oracle_cloud_infrastructure/sources/common/webhook.mjs (3)

94-123: Account for potential partial errors during deactivation.
The deactivate() hook deletes resources in sequence without any error handling that logs or re-throws. If deleting the rule fails, subsequent deletions proceed silently.

Optionally, you might log each error individually or re-throw after attempts to clean up resources for better visibility and debugging.


153-164: Implement or remove placeholder methods for metadata generation.
generateMeta(), getTopicName(), and getCondition() throw ConfigurationErrors. Any call to processResource invokes generateMeta() and will fail. Consider providing meaningful implementations or removing these placeholders to avoid runtime errors.

Would you like help implementing these methods to return metadata describing the webhook events?


224-224: Remove the extraneous semicolon.
Line 224 contains a double semicolon (;;). This is a minor issue but can be removed for clarity.

- const subscriptionId = headers["x-oci-ns-subscriptionid"];;
+ const subscriptionId = headers["x-oci-ns-subscriptionid"];
components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjs (3)

21-39: Handle large compartment lists gracefully.
listCompartments may return multiple pages if there are many compartments, but this code only processes the first response. Consider adding pagination logic or returning partial results with a note to the user.


195-201: Implement pagination for listing objects if necessary.
listObjects can also yield multiple pages, and only the first page of results is used. Large buckets could lead to truncated listings.

Let me know if you'd like help adding pagination to ensure all objects are included.


166-167: Use optional chaining for cleaner resource cleanup.
Currently, the client is closed conditionally via client.close && client.close();. Using optional chaining is more concise:

- client.close && client.close();
+ client.close?.();
🧰 Tools
🪛 Biome (1.9.4)

[error] 166-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1121f65 and 1d7c891.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/oracle_cloud_infrastructure/actions/create-update-object/create-update-object.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/actions/delete-object/delete-object.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/common/constants.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/package.json (2 hunks)
  • components/oracle_cloud_infrastructure/sources/common/events.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/sources/common/webhook.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/sources/new-autonomous-database-created-instant/new-autonomous-database-created-instant.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/sources/new-instance-state-change-instant/new-instance-state-change-instant.mjs (1 hunks)
  • components/oracle_cloud_infrastructure/sources/new-object-storage-object-instant/new-object-storage-object-instant.mjs (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjs

[error] 166-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (17)
components/oracle_cloud_infrastructure/package.json (2)

3-3: Version bump is appropriate for feature additions

The version increment from 0.0.1 to 0.1.0 aligns well with semantic versioning principles, as this PR introduces new features rather than just bug fixes.


15-24:

✅ Verification successful

Dependencies look comprehensive for OCI integration

The added dependencies cover essential OCI service libraries (object storage, core, events, identity, etc.) needed for the new components. The inclusion of bunyan for logging and @pipedream/platform is appropriate for Pipedream integration.


🏁 Script executed:

#!/bin/bash
# Check if the OCI SDK versions used are the latest available
npm view oci-common version
npm view oci-objectstorage version

Length of output: 82


Dependencies Verified and Confirmed for OCI Integration

The OCI SDK dependency versions (e.g., oci-common and oci-objectstorage at 2.106.2) have been verified against the latest available on npm. The dependency list comprehensively covers all essential OCI service libraries, and the inclusion of bunyan for logging and @pipedream/platform for Pipedream integration remains appropriate. No further changes are needed for these dependencies.

components/oracle_cloud_infrastructure/common/constants.mjs (1)

1-12: Good API endpoint structure with regional support

The API constant structure with REGION_PLACEHOLDER provides a clean way to dynamically set endpoints based on the selected region. The service-specific organization is clear and maintainable.

components/oracle_cloud_infrastructure/actions/delete-object/delete-object.mjs (2)

3-39: Well-defined action with clear prop dependencies

The action definition follows Pipedream's conventions with appropriate key, name, and description. The props are well-structured with proper dependency chains (objectName depends on bucketName which depends on compartmentId).


40-48: Clean implementation of deleteObject method

The method leverages the app's makeRequest utility, which promotes code reuse and consistency across actions.

components/oracle_cloud_infrastructure/sources/new-object-storage-object-instant/new-object-storage-object-instant.mjs (4)

4-11: Component definition looks good

The component is well-defined with appropriate metadata, including a descriptive name, clear description with documentation link, and proper version numbering for a new component.


14-32: Good implementation of the deploy hook

The deploy hook correctly retrieves the namespace name and enables object events on the specified bucket, which is necessary for this source to function properly. This provides a smoother user experience by automatically configuring required settings.


42-50: Property definition is well structured

The bucketName property is properly defined with a dependency on compartmentId, which ensures users can only select valid buckets from their selected compartment.


54-76: Methods implementation is complete and well-structured

The component includes all necessary methods:

  1. getTopicName() generates a unique name based on timestamp
  2. getCondition() properly filters for object creation events in the specified bucket
  3. generateMeta() creates appropriate metadata for emitted events
components/oracle_cloud_infrastructure/sources/new-instance-state-change-instant/new-instance-state-change-instant.mjs (3)

4-11: Component definition looks good

The component is well-defined with appropriate metadata, including a clear name, comprehensive description with documentation link, and proper version numbering for a new component.


12-23: Property definition is well structured

The instanceId property is correctly defined with a dependency on compartmentId, ensuring users can only select compute instances from their selected compartment.


30-53: Comprehensive event type filtering

The condition includes a thorough list of compute instance state change events, which will ensure all relevant instance state changes are captured. This is a good implementation that covers various scenarios.

components/oracle_cloud_infrastructure/sources/new-autonomous-database-created-instant/new-autonomous-database-created-instant.mjs (2)

4-11: Component definition looks good

The component is well-defined with appropriate metadata, including a descriptive name, clear description with documentation link, and proper version numbering for a new component.


25-31: Meta generation logic is clean and effective

The generateMeta method correctly extracts relevant information from the event resource and formats it appropriately for the Pipedream platform.

components/oracle_cloud_infrastructure/actions/create-update-object/create-update-object.mjs (3)

4-8: Component definition looks good

The action is well-defined with appropriate metadata, including a descriptive name, clear description with documentation link, and proper version numbering for a new component.


9-45: Well-structured property definitions with proper dependencies

The properties are correctly defined with appropriate dependencies:

  1. bucketName depends on compartmentId
  2. objectName depends on both compartmentId and bucketName

This creates a good user experience by dynamically populating dropdown options based on previous selections.


47-53: Good abstraction of the API call

The putObject method nicely abstracts the details of the API call, making the code more maintainable and readable.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jcortes jcortes merged commit 4dbe682 into master Apr 9, 2025
11 checks passed
@jcortes jcortes deleted the oracle-cloud-infrastructure-new-components branch April 9, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] oracle_cloud_infrastructure
2 participants