Skip to content

Conversation

@MegaportPhilipBrowne
Copy link
Contributor

@MegaportPhilipBrowne MegaportPhilipBrowne commented Nov 26, 2025

Summary

This PR enforces API lifecycle restrictions for MCR and Transit VXC (Megaport Internet) products by preventing scheduled deletion (cancel later) and allowing only immediate deletion (CANCEL_NOW). When attempting to delete an MCR with DeleteNow: false, the SDK now returns ErrMCRCancelLaterNotAllowed; similarly, Transit VXCs are detected by checking for connectType: "TRANSIT" in the CSP connection configuration and return ErrTransitVXCCancelLaterNotAllowed when scheduled deletion is attempted. This change aligns the SDK with API requirements while maintaining backward compatibility for all other product types.

Changes

  • MCR Deletion: DeleteMCR now returns an error if DeleteNow: false is specified
  • Transit VXC Deletion: DeleteVXC detects Transit VXCs and returns an error if DeleteNow: false is specified
  • New Errors: Added ErrMCRCancelLaterNotAllowed and ErrTransitVXCCancelLaterNotAllowed with descriptive messages
  • Helper Function: Added isTransitVXC() to detect Transit VXCs by examining CSP connection type
  • Tests: Added comprehensive unit tests for Transit VXC deletion scenarios and updated integration tests

Breaking Changes

Users who were previously scheduling MCR or Transit VXC deletions with DeleteNow: false will now receive an error. They must use DeleteNow: true for these product types.

Copilot finished reviewing on behalf of MegaportPhilipBrowne November 26, 2025 16:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds validation to prevent delayed cancellation (cancel later) for MCR and Transit VXC products, enforcing that only immediate deletion (CANCEL_NOW) is allowed for these product types per API lifecycle requirements.

Key changes:

  • Added error handling to reject scheduled deletions for MCR products, returning ErrMCRCancelLaterNotAllowed
  • Implemented Transit VXC detection and validation to prevent scheduled deletions, returning ErrTransitVXCCancelLaterNotAllowed
  • Updated integration tests to verify the new error behavior instead of testing soft delete/restore functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
errors.go Defines two new error constants for MCR and Transit VXC cancel-later restrictions
mcr.go Adds validation to DeleteMCR to reject scheduled deletions and enforce CANCEL_NOW
vxc.go Implements isTransitVXC helper and adds validation to DeleteVXC for Transit VXCs
mcr_integration_test.go Updates test to verify error is returned when attempting to schedule MCR deletion
vxc_test.go Adds mock for GetVXC call needed by DeleteVXC to check if VXC is Transit type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

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.

2 participants