Skip to content

Conversation

@tmeckel
Copy link
Owner

@tmeckel tmeckel commented Dec 22, 2025

This PR introduces a update capability for Azure DevOps service endpoints, enabling users to modify existing service endpoints through both individual field updates and bulk JSON-based configuration. The implementation includes robust input validation, pipeline permission management, and secure handling of sensitive credentials.

Detailed Breakdown

🚀 New Features

Service Endpoint Update Command

  • Add new azdo service-endpoint update command with support for:
    • Individual field updates (name, description, URL)
    • Bulk updates via JSON file input or stdin
    • Pipeline permission management with --enable-for-all flag
    • Input validation and comprehensive error handling
    • Progress feedback and structured logging throughout operations

Enhanced Pipeline Authorization

  • Extend pipeline endpoint authorization to support both granting and revoking access
  • Rename and refactor GrantAllPipelinesAccessToEndpoint to SetAllPipelinesAccessToEndpoint with new authorized parameter
  • Enable bidirectional control of pipeline permissions for service endpoints

🏗️ Shared Infrastructure & Refactoring

Centralized Service Endpoint Logic

  • Consolidate common functionality into shared package to eliminate code duplication:
    • Standardize JSON field definitions in shared.ServiceEndpointJSONFields
    • Implement shared.Output() for consistent command output handling across all service endpoint commands
    • Add shared.RedactSecrets() for secure JSON output with masked credentials
    • Create shared.ValidateEndpointPayload() with baseline and strict validation modes
    • Standardize encoding detection and file reading utilities
    • Replace duplicated output rendering with shared template-based implementation

Utility Functions

  • Add FormatProjectReference() for display-friendly project reference formatting
  • Implement project reference inclusion logic with ID and name matching
  • Add authorization scheme detection and secrets redaction capabilities
  • Create comprehensive input handling for multiple text encodings (UTF-8, ASCII, UTF-16LE, UTF-16BE)

🧪 Testing & Quality

Test Infrastructure

  • Enable parallel test execution across all service endpoint test suites
  • Move encoding tests to dedicated shared/input_test.go location
  • Add comprehensive test coverage for validation scenarios and edge cases
  • Include tests for project reference matching and authorization logic

Code Quality

  • Format code indentation and import ordering across affected files
  • Maintain consistent error handling patterns with structured logging

📚 Documentation

Command Documentation

  • Add comprehensive documentation for azdo service-endpoint update command
  • Include usage examples, option details, and complete JSON field reference
  • Update help reference and command index to include new update functionality
  • Document JSON output fields and table formatting options

Closes: #68

Add support for reading service endpoints from files or stdin with validation. Includes JSON parsing, encoding handling, and baseline validation for required fields (name, type, url). The implementation supports both direct file input and stdin piping for flexible integration with other tools.
Add AuthorizationScheme() to retrieve endpoint authorization scheme and RedactSecrets() to mask sensitive parameters in service endpoints.
These utilities support secure handling of service endpoint credentials.
Add comprehensive input handling utilities for service endpoint commands, including:
- Encoding normalization and validation
- Content decoding for UTF-8, ASCII, UTF-16LE, and UTF-16BE
- Input path description utility
- Comprehensive test coverage for all encoding scenarios
Add shared functionality to render service endpoint details using templates or JSON exporters. Includes template helpers for safe value rendering and field selection support for JSON output.
Add `authorized` parameter to `SetAllPipelinesAccessToEndpoint` to allow both granting and revoking pipeline access to service endpoints. Rename function from `GrantAllPipelinesAccessToEndpoint` to reflect its expanded capability.  The change enables users to control pipeline permissions for service endpoints in both directions (authorize/unauthorize) through a single function call.
Add utility function to ensure project references are included in service
endpoint configurations with ID and name matching logic. Includes
comprehensive test coverage for edge cases and matching scenarios.
FormatProjectReference function converts service endpoint project references into a display-friendly string representation, handling various edge cases including nil values and partial data availability.
Add validation logic for service endpoint payloads with two modes:
- Baseline validation: trims whitespace and checks for empty fields when present
- Strict validation: requires name, type, and url fields to be non-nil

Includes comprehensive test coverage for all validation scenarios
Move common service endpoint functionality to the shared package to reduce code duplication across commands. Key changes include:

- Consolidate JSON field definitions in shared.ServiceEndpointJSONFields
- Add shared.Output() for consistent command output handling
- Introduce shared.RedactSecrets() for secure JSON output
- Add shared.ValidateEndpointPayload() for payload validation
- Create shared utility functions for project reference handling
- Standardize encoding and file reading logic in shared package
- Replace duplicated output rendering code with shared implementation
Adds a new `update` subcommand to the service endpoint command group, allowing users to modify existing service endpoints. The implementation supports:
- Individual field updates (name, description, URL)
- Bulk updates via JSON file input
- Pipeline permission management (enable-for-all)
- Input validation and error handling
- Progress feedback and structured logging
Add comprehensive documentation for the new `azdo service-endpoint update` command including usage examples, option details, and JSON field reference. Update help reference and command index to include the new command.
@tmeckel tmeckel merged commit abf990b into master Dec 22, 2025
1 check passed
@tmeckel tmeckel deleted the tmeckel/issue68 branch December 22, 2025 17:48
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 update command

2 participants