bf9395e022
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package apps
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/larksuite/cli/internal/output"
|
|
)
|
|
|
|
// Gateway paths for the spark app.release OpenAPI methods.
|
|
// Prefix reuses apiBasePath = "/open-apis/spark/v1" (same package).
|
|
// Each path contains %s placeholders; use fmt.Sprintf to build the final URL.
|
|
const (
|
|
releaseCreatePath = apiBasePath + "/apps/%s/releases"
|
|
releaseGetPath = apiBasePath + "/apps/%s/releases/%s"
|
|
releaseListPath = apiBasePath + "/apps/%s/releases"
|
|
)
|
|
|
|
// writeReleaseErrorLogTable renders a release's error_logs (a slice of
|
|
// {step, error_log} maps from the gateway) as a two-column step/error_log
|
|
// table via output.PrintTable. Used by +release-get to render a failed
|
|
// release's error_logs. A nil/non-slice or
|
|
// empty value yields an empty table (PrintTable prints "(no data)").
|
|
func writeReleaseErrorLogTable(w io.Writer, raw interface{}) {
|
|
logs, _ := raw.([]interface{})
|
|
rows := make([]map[string]interface{}, 0, len(logs))
|
|
for _, l := range logs {
|
|
m, ok := l.(map[string]interface{})
|
|
if !ok {
|
|
continue
|
|
}
|
|
rows = append(rows, map[string]interface{}{
|
|
"step": m["step"],
|
|
"error_log": m["error_log"],
|
|
})
|
|
}
|
|
output.PrintTable(w, rows)
|
|
}
|