Skip to content

Conversation

@tmeckel
Copy link
Owner

@tmeckel tmeckel commented Dec 5, 2025

Closes: #64

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
@tmeckel tmeckel merged commit d8be2d6 into master Dec 5, 2025
1 check passed
@tmeckel tmeckel deleted the tmeckel/issue64 branch December 5, 2025 22:43
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.

feat: Implement azdo service-endpoint delete command

2 participants