-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
2 / 22 of 2 issues completed
Copy link
Description
This issue tracks the implementation of the azdo service-endpoint create command.
Command Description
Create a service endpoint from a configuration file, allowing users to import pre-defined connections.
azdo Command Signature
azdo service-endpoint create [ORGANIZATION/]PROJECT --from-file PATH [--encoding ENCODING]
Arguments & Flags:
[ORGANIZATION/]PROJECT: Required project scope. When the organization segment is omitted, fall back to the configured default organization.--from-file: Path to a JSON file containing the service endpoint definition (required).--encoding: Optional file encoding (utf-8default, allowascii,utf-16be,utf-16le).- JSON exporter flags (optional) to emit the created endpoint.
Behavior
- Resolve scope using the shared helper; open the file using the specified encoding.
- Validate that the JSON payload matches
serviceendpoint.ServiceEndpointexpectations; rewrite organization/project fields as needed before sending to Azure DevOps. - Use
ServiceEndpointClient.CreateServiceEndpointto create the connection. - Stop the progress indicator before output; render a concise summary (ID, name, type) and support JSON output.
- Add debug logging for file resolution and payload validation (avoid logging secrets).
Command Wiring
- Implement the command in
internal/cmd/serviceendpoint/create/create.go(or similar) withNewCmd(ctx util.CmdContext) *cobra_Command. - Register it from
internal/cmd/serviceendpoint/serviceendpoint.gosoazdo service-endpoint createis accessible from the root CLI. - Regenerate documentation (
make docs) once wiring is complete.
SDK / Client Requirements
- Uses the Service Endpoint client (
ClientFactory().ServiceEndpoint(...)). If any additional Azure DevOps client is required, follow "Handling Missing Azure DevOps SDK Clients" inAGENTS.md(extendClientFactory, rungo mod tidyandgo mod vendor, updatescripts/generate_mocks.sh, and implement the factory method) before implementing the command.
Tooling & Validation
- Format new Go files with
gofmt/goimports. - Run
go build ./cmd/azdo/...to ensure the CLI compiles. - Add/update hermetic tests using mocks (Service Endpoint client, file loading) and execute
go test ./....
Testing
- Unit tests covering:
- Successful creation with UTF-8 file.
- Alternate encoding handling.
- Invalid JSON structure raising a descriptive error.
- Service Endpoint SDK error propagation.
- JSON export structure.
References
- Azure DevOps REST: Service endpoint - Create
Reactions are currently unavailable
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels