feat: ✨ Implement azdo service-endpoint delete command#157
Merged
Conversation
Refactor the target parsing functionality to eliminate code duplication by introducing a unified `parseTarget` function with configurable options. Added two new public functions: - `ParseTargetWithDefaultOrganization` for group-oriented targets with implicit org fallback - `ParseProjectTargetWithDefaultOrganization` for project-required targets with implicit org fallback The changes maintain backward compatibility while providing more flexible target parsing for security membership commands and other use cases that require project context.
Add comprehensive test utilities for Azure DevOps service endpoint testing including: - SharedProject helper for test project lifecycle management - Project provisioning and deletion functions - Service endpoint creation and cleanup utilities - Operation polling and process template resolution - Context-based test data management These utilities support acceptance testing for service endpoint commands by providing reusable test infrastructure for creating and managing Azure DevOps projects and service endpoints in a consistent manner.
Add FindServiceEndpoint function that resolves service endpoints by ID or name within a project. The function handles both UUID-based lookups and name-based searches with proper error handling for not found scenarios. Includes ErrEndpointNotFound error definition for consistent error reporting across service endpoint commands.
The GetServiceEndpointDetails API call may return empty results instead of nil or HTTP 404 when an endpoint doesn't exist. This change adds a nil check for the returned endpoint ID to prevent including invalid endpoints in the filtered results. Previously, the function would attempt to process endpoints that returned empty details, potentially causing issues downstream. Now we skip these endpoints entirely to ensure only valid endpoints with proper details are included in the filtered list.
Switch from ParseTargetWithDefaultOrganization to ParseProjectTargetWithDefaultOrganization when parsing the scope for variable group listing. This aligns the command with the consolidated target parsing utilities and ensures project-scoped targets are handled consistently.
Refactor azurerm service endpoint acceptance tests by moving test-specific context keys and shared project utilities into dedicated test helpers. Introduce internal/cmd/serviceendpoint/create/azurerm/test_keys.go to host contextKey definitions and switch tests to use the test package's SharedProject and helper functions. Remove in-file shared project and cleanup logic and update tests to use test.CleanupEndpointFromContext and test.GetTestProjectName to consolidate common test behavior. This centralizes test utilities, reduces duplication, and makes the acceptance tests easier to maintain.
Add a new `delete` subcommand to the serviceendpoint command group that allows deleting service endpoints from Azure DevOps projects. The command supports: - Deletion by endpoint ID or name - Deep deletion of Azure AD applications (when supported) - Confirmation prompts with safety checks - Handling of shared endpoints across multiple projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #64