-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis 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
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
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
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
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
components/oracle_cloud_infrastructure/actions/delete-object/delete-object.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/oracle_cloud_infrastructure/actions/create-update-object/create-update-object.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/oracle_cloud_infrastructure/oracle_cloud_infrastructure.app.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 servicesThe 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 constantsThe 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 commentsWhile 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 summaryThe 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 conditionUnlike 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.
Thedeactivate()
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()
, andgetCondition()
throwConfigurationError
s. Any call toprocessResource
invokesgenerateMeta()
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 viaclient.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
⛔ 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 additionsThe 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 versionLength of output: 82
Dependencies Verified and Confirmed for OCI Integration
The OCI SDK dependency versions (e.g.,
oci-common
andoci-objectstorage
at2.106.2
) have been verified against the latest available on npm. The dependency list comprehensively covers all essential OCI service libraries, and the inclusion ofbunyan
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 supportThe 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 dependenciesThe 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 methodThe 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 goodThe 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 hookThe 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 structuredThe 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-structuredThe component includes all necessary methods:
getTopicName()
generates a unique name based on timestampgetCondition()
properly filters for object creation events in the specified bucketgenerateMeta()
creates appropriate metadata for emitted eventscomponents/oracle_cloud_infrastructure/sources/new-instance-state-change-instant/new-instance-state-change-instant.mjs (3)
4-11
: Component definition looks goodThe 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 structuredThe 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 filteringThe 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 goodThe 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 effectiveThe 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 goodThe 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 dependenciesThe properties are correctly defined with appropriate dependencies:
- bucketName depends on compartmentId
- 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 callThe putObject method nicely abstracts the details of the API call, making the code more maintainable and readable.
components/oracle_cloud_infrastructure/actions/delete-object/delete-object.mjs
Show resolved
Hide resolved
components/oracle_cloud_infrastructure/actions/create-update-object/create-update-object.mjs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
WHY
Resolves #16070
Summary by CodeRabbit