fix(apply): add validation to reject v1 API version
Some checks failed
test / test (push) Failing after 48s
Some checks failed
test / test (push) Failing after 48s
The apply command requires v2 API features and cannot work with v1. Add early validation to provide a clear error message when users try to use apply with --api-version v1, instead of failing with a cryptic 403 Forbidden error. Error message explains that apply only supports v2 and guides users to use --api-version v2 or remove the api_version setting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a42d4af5d1
commit
2af60e7d85
1 changed files with 9 additions and 3 deletions
12
cmd/apply.go
12
cmd/apply.go
|
|
@ -67,13 +67,19 @@ func runApply(configPath string, isDryRun bool, autoApprove bool) error {
|
||||||
|
|
||||||
fmt.Printf("✅ Configuration loaded successfully: %s\n", cfg.Metadata.Name)
|
fmt.Printf("✅ Configuration loaded successfully: %s\n", cfg.Metadata.Name)
|
||||||
|
|
||||||
// Step 3: Create EdgeConnect client (apply always uses v2)
|
// Step 3: Validate API version (apply only supports v2)
|
||||||
|
apiVersion := getAPIVersion()
|
||||||
|
if apiVersion == "v1" {
|
||||||
|
return fmt.Errorf("apply command only supports API v2. The v1 API does not support the advanced deployment features required by this command. Please use --api-version v2 or remove the api_version setting")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 4: Create EdgeConnect client (v2 only)
|
||||||
client := newSDKClientV2()
|
client := newSDKClientV2()
|
||||||
|
|
||||||
// Step 4: Create deployment planner
|
// Step 5: Create deployment planner
|
||||||
planner := apply.NewPlanner(client)
|
planner := apply.NewPlanner(client)
|
||||||
|
|
||||||
// Step 5: Generate deployment plan
|
// Step 6: Generate deployment plan
|
||||||
fmt.Println("🔍 Analyzing current state and generating deployment plan...")
|
fmt.Println("🔍 Analyzing current state and generating deployment plan...")
|
||||||
|
|
||||||
planOptions := apply.DefaultPlanOptions()
|
planOptions := apply.DefaultPlanOptions()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue