From 62cdab1b22e804d037fac0fef0cf6fd290977b52 Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Tue, 18 Nov 2025 14:58:02 -0600 Subject: [PATCH] feat: add a task to automatically onboard all SDK services --- Makefile | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1d543f2..b65fe82 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,8 @@ update: exit 1; \ fi @echo "Updating service: $(SERVICE)" - @echo "Step 1: Updating SDK package..." - @go get -u github.com/equinix/equinix-sdk-go/services/$(SERVICE) + @echo "Step 1: Fetching SDK package..." + @go get $$(go list -f '{{.Path}}@{{.Version}}' -m github.com/equinix/equinix-sdk-go) @go mod tidy @echo "" @echo "Step 2: Extracting SDK descriptions..." @@ -99,4 +99,29 @@ onboard: @echo "2. Add service-specific aliases in cmd/$(SERVICE).go if desired" @echo "3. Run 'make build' to verify the integration" @echo "4. Run 'make docs' to generate documentation" - @echo "5. Update README.md with information about the new service" \ No newline at end of file + @echo "5. Update README.md with information about the new service" + +# generate-all - Onboard/update all service integrations by fetching latest SDK +# and looping over all services that exist in the SDK +# Usage: make generate-all +# This will: +# 1. Update the SDK package to the latest version +# 2. Extract SDK descriptions and save to cmd/descriptions/.json +generate-all: + @echo "Generating all services" + @echo "Step 1: Fetching SDK package..." + @go get $$(go list -f '{{.Path}}@{{.Version}}' -m github.com/equinix/equinix-sdk-go) + @go mod tidy + @echo "" + @echo "Step 2: Onboarding all service packages in the SDK..." + @mkdir -p cmd/descriptions + @SDK_PATH=$$(go list -f '{{.Dir}}' -m github.com/equinix/equinix-sdk-go)/services; \ + if [ -z "$$SDK_PATH" ] || [ ! -d "$$SDK_PATH" ]; then \ + echo "Error: Could not find SDK path for services"; \ + echo "Make sure github.com/equinix/equinix-sdk-go/services is a valid module"; \ + exit 1; \ + fi; \ + SERVICES=$$(ls -1 $$SDK_PATH); \ + for SERVICE in $$SERVICES; do \ + $(MAKE) onboard SERVICE=$$SERVICE; \ + done;