From e454cde99207dc0506f6037b53e27ebbff235bde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 05:01:55 +0000 Subject: [PATCH 01/40] chore(deps): bump supabase/realtime from v2.36.18 to v2.36.20 in /pkg/config/templates (#3725) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.36.18 to v2.36.20. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.36.20 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 0cab55e94..e8073571c 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.2 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.36.18 AS realtime +FROM supabase/realtime:v2.36.20 AS realtime FROM supabase/storage-api:v1.24.6 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From 17739310a6b8309570972c3dabcdd7b703978a61 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 18 Jun 2025 11:36:00 +0800 Subject: [PATCH 02/40] feat: hot reload eszip bundle when function source changes (#3710) * fix: file watcher skeleton for serving functions * chore: add debounce file watcher * chore: remove unnecessary log * chore: impose default watch limit * chore: add watcher tests and main.ts (#3717) * chore: add watcher tests and main.ts * chore: add serve tests * chore: fix lints * chore: remove sleep in tests * chore: simulate fs event when possible * chore: avoid flaky tests * chore: undo debounce test --------- Co-authored-by: Qiao Han * chore: simplify event ignore logic * chore: add streamer unit tests * chore: simplify streamer test * chore: update serve tests * chore: update unit tests * chore: update watcher tests --------- Co-authored-by: Andrew Valleteau --- internal/functions/serve/serve.go | 56 +++- internal/functions/serve/serve_test.go | 79 +++++- internal/functions/serve/streamer.go | 47 ++++ internal/functions/serve/streamer_test.go | 91 ++++++ internal/functions/serve/templates/main.ts | 34 ++- internal/functions/serve/testdata/config.toml | 8 + internal/functions/serve/watcher.go | 165 +++++++++++ internal/functions/serve/watcher_test.go | 264 ++++++++++++++++++ internal/testing/apitest/docker.go | 15 +- internal/utils/container_output.go | 35 --- internal/utils/container_output_test.go | 37 --- internal/utils/docker.go | 25 +- 12 files changed, 754 insertions(+), 102 deletions(-) create mode 100644 internal/functions/serve/streamer.go create mode 100644 internal/functions/serve/streamer_test.go create mode 100644 internal/functions/serve/testdata/config.toml create mode 100644 internal/functions/serve/watcher.go create mode 100644 internal/functions/serve/watcher_test.go diff --git a/internal/functions/serve/serve.go b/internal/functions/serve/serve.go index 9fba48a76..9819a181d 100644 --- a/internal/functions/serve/serve.go +++ b/internal/functions/serve/serve.go @@ -10,7 +10,9 @@ import ( "strconv" "strings" + "github.com/docker/cli/cli/compose/loader" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" "github.com/docker/go-connections/nat" "github.com/go-errors/errors" @@ -46,6 +48,7 @@ func (mode InspectMode) toFlag() string { type RuntimeOption struct { InspectMode *InspectMode InspectMain bool + fileWatcher *debounceFileWatcher } func (i *RuntimeOption) toArgs() []string { @@ -68,6 +71,36 @@ const ( var mainFuncEmbed string func Run(ctx context.Context, envFilePath string, noVerifyJWT *bool, importMapPath string, runtimeOption RuntimeOption, fsys afero.Fs) error { + watcher, err := NewDebounceFileWatcher() + if err != nil { + return err + } + go watcher.Start() + defer watcher.Close() + // TODO: refactor this to edge runtime service + runtimeOption.fileWatcher = watcher + if err := restartEdgeRuntime(ctx, envFilePath, noVerifyJWT, importMapPath, runtimeOption, fsys); err != nil { + return err + } + streamer := NewLogStreamer(ctx) + go streamer.Start(utils.EdgeRuntimeId) + defer streamer.Close() + for { + select { + case <-ctx.Done(): + fmt.Println("Stopped serving " + utils.Bold(utils.FunctionsDir)) + return ctx.Err() + case <-watcher.RestartCh: + if err := restartEdgeRuntime(ctx, envFilePath, noVerifyJWT, importMapPath, runtimeOption, fsys); err != nil { + return err + } + case err := <-streamer.ErrCh: + return err + } + } +} + +func restartEdgeRuntime(ctx context.Context, envFilePath string, noVerifyJWT *bool, importMapPath string, runtimeOption RuntimeOption, fsys afero.Fs) error { // 1. Sanity checks. if err := flags.LoadConfig(fsys); err != nil { return err @@ -84,14 +117,7 @@ func Run(ctx context.Context, envFilePath string, noVerifyJWT *bool, importMapPa dbUrl := fmt.Sprintf("postgresql://postgres:postgres@%s:5432/postgres", utils.DbAliases[0]) // 3. Serve and log to console fmt.Fprintln(os.Stderr, "Setting up Edge Functions runtime...") - if err := ServeFunctions(ctx, envFilePath, noVerifyJWT, importMapPath, dbUrl, runtimeOption, fsys); err != nil { - return err - } - if err := utils.DockerStreamLogs(ctx, utils.EdgeRuntimeId, os.Stdout, os.Stderr); err != nil { - return err - } - fmt.Println("Stopped serving " + utils.Bold(utils.FunctionsDir)) - return nil + return ServeFunctions(ctx, envFilePath, noVerifyJWT, importMapPath, dbUrl, runtimeOption, fsys) } func ServeFunctions(ctx context.Context, envFilePath string, noVerifyJWT *bool, importMapPath string, dbUrl string, runtimeOption RuntimeOption, fsys afero.Fs) error { @@ -131,6 +157,19 @@ func ServeFunctions(ctx context.Context, envFilePath string, noVerifyJWT *bool, if err != nil { return err } + if watcher := runtimeOption.fileWatcher; watcher != nil { + var watchPaths []string + for _, b := range binds { + if spec, err := loader.ParseVolume(b); err != nil { + return errors.Errorf("failed to parse docker volume: %w", err) + } else if spec.Type == string(mount.TypeBind) { + watchPaths = append(watchPaths, spec.Source) + } + } + if err := watcher.SetWatchPaths(watchPaths, fsys); err != nil { + return err + } + } env = append(env, "SUPABASE_INTERNAL_FUNCTIONS_CONFIG="+functionsConfigString) // 3. Parse entrypoint script cmd := append([]string{ @@ -215,6 +254,7 @@ func populatePerFunctionConfigs(cwd, importMapPath string, noVerifyJWT *bool, fs for slug, fc := range functionsConfig { if !fc.Enabled { fmt.Fprintln(os.Stderr, "Skipped serving Function:", slug) + delete(functionsConfig, slug) continue } modules, err := deploy.GetBindMounts(cwd, utils.FunctionsDir, "", fc.Entrypoint, fc.ImportMap, fsys) diff --git a/internal/functions/serve/serve_test.go b/internal/functions/serve/serve_test.go index 7dbd75377..7b0bb17fa 100644 --- a/internal/functions/serve/serve_test.go +++ b/internal/functions/serve/serve_test.go @@ -2,9 +2,10 @@ package serve import ( "context" + "embed" "net/http" - "os" "path/filepath" + "strings" "testing" "github.com/docker/docker/api/types/container" @@ -17,13 +18,20 @@ import ( "github.com/supabase/cli/pkg/cast" ) +var ( + //go:embed testdata/config.toml + testConfig []byte + //go:embed testdata/* + testdata embed.FS +) + func TestServeCommand(t *testing.T) { t.Run("serves all functions", func(t *testing.T) { // Setup in-memory fs fsys := afero.NewMemMapFs() - require.NoError(t, utils.InitConfig(utils.InitParams{ProjectId: "test"}, fsys)) + require.NoError(t, afero.WriteFile(fsys, utils.ConfigPath, testConfig, 0644)) require.NoError(t, afero.WriteFile(fsys, utils.FallbackEnvFilePath, []byte{}, 0644)) - require.NoError(t, afero.WriteFile(fsys, utils.FallbackImportMapPath, []byte{}, 0644)) + require.NoError(t, afero.WriteFile(fsys, utils.FallbackImportMapPath, []byte("{}"), 0644)) // Setup mock docker require.NoError(t, apitest.MockDocker(utils.Docker)) defer gock.OffAll() @@ -36,11 +44,11 @@ func TestServeCommand(t *testing.T) { Delete("/v" + utils.Docker.ClientVersion() + "/containers/" + containerId). Reply(http.StatusOK) apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.EdgeRuntime.Image), containerId) - require.NoError(t, apitest.MockDockerLogs(utils.Docker, containerId, "success")) - // Run test + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerId, 1, strings.NewReader("failed"))) + // Run test with timeout context err := Run(context.Background(), "", nil, "", RuntimeOption{}, fsys) // Check error - assert.NoError(t, err) + assert.ErrorContains(t, err, "error running container: exit 1") assert.Empty(t, apitest.ListUnmatchedRequests()) }) @@ -88,7 +96,6 @@ func TestServeCommand(t *testing.T) { }) t.Run("throws error on missing import map", func(t *testing.T) { - utils.CurrentDirAbs = "/" // Setup in-memory fs fsys := afero.NewMemMapFs() require.NoError(t, utils.InitConfig(utils.InitParams{ProjectId: "test"}, fsys)) @@ -105,6 +112,62 @@ func TestServeCommand(t *testing.T) { // Run test err := Run(context.Background(), ".env", cast.Ptr(true), "import_map.json", RuntimeOption{}, fsys) // Check error - assert.ErrorIs(t, err, os.ErrNotExist) + assert.ErrorContains(t, err, "failed to resolve relative path:") + }) +} + +func TestServeFunctions(t *testing.T) { + require.NoError(t, utils.Config.Load("testdata/config.toml", testdata)) + utils.UpdateDockerIds() + + t.Run("runs inspect mode", func(t *testing.T) { + // Setup in-memory fs + fsys := afero.FromIOFS{FS: testdata} + // Setup mock docker + require.NoError(t, apitest.MockDocker(utils.Docker)) + defer gock.OffAll() + apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.EdgeRuntime.Image), utils.EdgeRuntimeId) + // Run test + err := ServeFunctions(context.Background(), "", nil, "", "", RuntimeOption{ + InspectMode: cast.Ptr(InspectModeRun), + InspectMain: true, + }, fsys) + // Check error + assert.NoError(t, err) + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("parses env file", func(t *testing.T) { + envPath := "/project/.env" + // Setup in-memory fs + fsys := afero.NewMemMapFs() + require.NoError(t, utils.WriteFile(envPath, []byte(` + DATABASE_URL=postgresql://localhost:5432/test + API_KEY=secret123 + DEBUG=true + `), fsys)) + // Run test + env, err := parseEnvFile(envPath, fsys) + // Check error + assert.NoError(t, err) + assert.ElementsMatch(t, []string{ + "DATABASE_URL=postgresql://localhost:5432/test", + "API_KEY=secret123", + "DEBUG=true", + }, env) + }) + + t.Run("parses function config", func(t *testing.T) { + // Setup in-memory fs + fsys := afero.FromIOFS{FS: testdata} + // Run test + binds, configString, err := populatePerFunctionConfigs("/", "", nil, fsys) + // Check error + assert.NoError(t, err) + assert.ElementsMatch(t, []string{ + "supabase_edge_runtime_test:/root/.cache/deno:rw", + "/supabase/functions/:/supabase/functions/:ro", + }, binds) + assert.Equal(t, `{"hello":{"verifyJWT":true,"entrypointPath":"testdata/functions/hello/index.ts","staticFiles":["testdata/image.png"]}}`, configString) }) } diff --git a/internal/functions/serve/streamer.go b/internal/functions/serve/streamer.go new file mode 100644 index 000000000..09d4171d5 --- /dev/null +++ b/internal/functions/serve/streamer.go @@ -0,0 +1,47 @@ +package serve + +import ( + "context" + "os" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/containerd/errdefs" + "github.com/docker/docker/api/types/container" + "github.com/go-errors/errors" + "github.com/supabase/cli/internal/utils" +) + +type logStreamer struct { + ctx context.Context + Close context.CancelFunc + ErrCh chan error +} + +func NewLogStreamer(ctx context.Context) logStreamer { + cancelCtx, cancel := context.WithCancel(ctx) + return logStreamer{ + ctx: cancelCtx, + Close: cancel, + ErrCh: make(chan error, 1), + } +} + +// Used by unit tests +var retryInterval = time.Millisecond * 400 + +func (s *logStreamer) Start(containerID string) { + // Retry indefinitely until stream is closed + policy := backoff.WithContext(backoff.NewConstantBackOff(retryInterval), s.ctx) + fetch := func() error { + if err := utils.DockerStreamLogs(s.ctx, containerID, os.Stdout, os.Stderr, func(lo *container.LogsOptions) { + lo.Timestamps = true + }); errdefs.IsNotFound(err) || errdefs.IsConflict(err) || errors.Is(err, utils.ErrContainerKilled) { + return err + } else if err != nil { + return &backoff.PermanentError{Err: err} + } + return errors.Errorf("container exited gracefully: %s", containerID) + } + s.ErrCh <- backoff.Retry(fetch, policy) +} diff --git a/internal/functions/serve/streamer_test.go b/internal/functions/serve/streamer_test.go new file mode 100644 index 000000000..23116860e --- /dev/null +++ b/internal/functions/serve/streamer_test.go @@ -0,0 +1,91 @@ +package serve + +import ( + "context" + "net/http" + "strings" + "testing" + "time" + + "github.com/h2non/gock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/supabase/cli/internal/testing/apitest" + "github.com/supabase/cli/internal/utils" +) + +func TestLogStreamer(t *testing.T) { + containerID := "test-container" + retryInterval = 0 + + t.Run("streams logs from container", func(t *testing.T) { + // Setup mock docker + require.NoError(t, apitest.MockDocker(utils.Docker)) + defer gock.OffAll() + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerID, 1, strings.NewReader(""))) + // Run test + streamer := NewLogStreamer(context.Background()) + streamer.Start(containerID) + // Check error + select { + case err := <-streamer.ErrCh: + assert.ErrorContains(t, err, "error running container: exit 1") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing error signal from closing") + } + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("retries on container exit", func(t *testing.T) { + // Setup mock docker + require.NoError(t, apitest.MockDocker(utils.Docker)) + defer gock.OffAll() + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerID, 0, strings.NewReader(""))) + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerID, 137, strings.NewReader(""))) + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerID, 1, strings.NewReader(""))) + // Run test + streamer := NewLogStreamer(context.Background()) + streamer.Start(containerID) + // Check error + select { + case err := <-streamer.ErrCh: + assert.ErrorContains(t, err, "error running container: exit 1") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing error signal from closing") + } + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("retries on missing container", func(t *testing.T) { + // Setup mock docker + require.NoError(t, apitest.MockDocker(utils.Docker)) + defer gock.OffAll() + gock.New(utils.Docker.DaemonHost()). + Get("/v" + utils.Docker.ClientVersion() + "/containers/" + containerID + "/logs"). + Reply(http.StatusNotFound). + BodyString("No such container") + gock.New(utils.Docker.DaemonHost()). + Get("/v" + utils.Docker.ClientVersion() + "/containers/" + containerID + "/logs"). + Reply(http.StatusConflict). + BodyString("can not get logs from container which is dead or marked for removal") + gock.New(utils.Docker.DaemonHost()). + Get("/v" + utils.Docker.ClientVersion() + "/containers/" + containerID + "/logs"). + Reply(http.StatusOK) + gock.New(utils.Docker.DaemonHost()). + Get("/v" + utils.Docker.ClientVersion() + "/containers/" + containerID + "/json"). + Reply(http.StatusNotFound). + BodyString("No such object") + require.NoError(t, apitest.MockDockerLogsStream(utils.Docker, containerID, 1, strings.NewReader(""))) + // Run test + streamer := NewLogStreamer(context.Background()) + streamer.Start(containerID) + // Check error + select { + case err := <-streamer.ErrCh: + assert.ErrorContains(t, err, "error running container: exit 1") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing error signal from closing") + } + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) +} diff --git a/internal/functions/serve/templates/main.ts b/internal/functions/serve/templates/main.ts index 534409a98..568c547f8 100644 --- a/internal/functions/serve/templates/main.ts +++ b/internal/functions/serve/templates/main.ts @@ -48,6 +48,7 @@ const DENO_SB_ERROR_MAP = new Map([ SB_SPECIFIC_ERROR_CODE.WorkerLimit, ], ]); +const GENERIC_FUNCTION_SERVE_MESSAGE = `Serving functions on http://127.0.0.1:${HOST_PORT}/functions/v1/` interface FunctionConfig { entrypointPath: string; @@ -228,9 +229,36 @@ Deno.serve({ }, onListen: () => { - console.log( - `Serving functions on http://127.0.0.1:${HOST_PORT}/functions/v1/\nUsing ${Deno.version.deno}`, - ); + try { + const functionsConfigString = Deno.env.get( + "SUPABASE_INTERNAL_FUNCTIONS_CONFIG" + ); + if (functionsConfigString) { + const MAX_FUNCTIONS_URL_EXAMPLES = 5 + const functionsConfig = JSON.parse(functionsConfigString) as Record< + string, + unknown + >; + const functionNames = Object.keys(functionsConfig); + const exampleFunctions = functionNames.slice(0, MAX_FUNCTIONS_URL_EXAMPLES); + const functionsUrls = exampleFunctions.map( + (fname) => ` - http://127.0.0.1:${HOST_PORT}/functions/v1/${fname}` + ); + const functionsExamplesMessages = functionNames.length > 0 + // Show some functions urls examples + ? `\n${functionsUrls.join(`\n`)}${functionNames.length > MAX_FUNCTIONS_URL_EXAMPLES + // If we have more than 10 functions to serve, then show examples for first 10 + // and a count for the remaining ones + ? `\n... and ${functionNames.length - MAX_FUNCTIONS_URL_EXAMPLES} more functions` + : ''}` + : '' + console.log(`${GENERIC_FUNCTION_SERVE_MESSAGE}${functionsExamplesMessages}\nUsing ${Deno.version.deno}`); + } + } catch (e) { + console.log( + `${GENERIC_FUNCTION_SERVE_MESSAGE}\nUsing ${Deno.version.deno}` + ); + } }, onError: e => { diff --git a/internal/functions/serve/testdata/config.toml b/internal/functions/serve/testdata/config.toml new file mode 100644 index 000000000..28ea9a510 --- /dev/null +++ b/internal/functions/serve/testdata/config.toml @@ -0,0 +1,8 @@ +project_id = "test" + +[functions.hello] +static_files = ["image.png"] + +[functions.world] +enabled = false +verify_jwt = false diff --git a/internal/functions/serve/watcher.go b/internal/functions/serve/watcher.go new file mode 100644 index 000000000..6e75a104b --- /dev/null +++ b/internal/functions/serve/watcher.go @@ -0,0 +1,165 @@ +package serve + +import ( + "fmt" + "io/fs" + "os" + "path/filepath" + "slices" + "strings" + "time" + + "github.com/fsnotify/fsnotify" + "github.com/go-errors/errors" + "github.com/spf13/afero" + "github.com/spf13/viper" + "github.com/supabase/cli/internal/utils" +) + +const ( + // Debounce duration for file changes + debounceDuration = 500 * time.Millisecond + restartEvents = fsnotify.Write | fsnotify.Create | fsnotify.Remove | fsnotify.Rename + maxFileLimit = 1000 +) + +var ( + errTooManyFiles = errors.New("too many files") + + // Directories to ignore. + ignoredDirNames = []string{ + ".git", + "node_modules", + ".vscode", + ".idea", + ".DS_Store", + "vendor", + } + + // Patterns for ignoring file events. + ignoredFilePatterns = []struct { + Prefix string // File basename prefix + Suffix string // File basename suffix + ExactMatch bool // File basename exact match + }{ + {Suffix: "~"}, // Common backup files (e.g., emacs, gedit) + {Prefix: ".", Suffix: ".swp"}, // Vim swap files + {Prefix: ".", Suffix: ".swx"}, // Vim swap files (extended) + {Prefix: "___"}, // Deno temp files often start with this + {Suffix: ".tmp"}, // Generic temp files + {Prefix: ".#"}, // Emacs lock files + } +) + +// isIgnoredFileEvent checks if a file event should be ignored based on predefined patterns. +func isIgnoredFileEvent(event fsnotify.Event) bool { + if !event.Has(restartEvents) { + return true + } + baseName := filepath.Base(event.Name) + for _, p := range ignoredFilePatterns { + if strings.HasPrefix(baseName, p.Prefix) && strings.HasSuffix(baseName, p.Suffix) { + // An exact match means all characters match both prefix and suffix + if p.ExactMatch && len(baseName) > len(p.Prefix)+len(p.Suffix) { + continue + } + return true + } + } + return false +} + +type debounceFileWatcher struct { + watcher *fsnotify.Watcher + restartTimer *time.Timer + RestartCh <-chan time.Time + ErrCh <-chan error +} + +func NewDebounceFileWatcher() (*debounceFileWatcher, error) { + restartTimer := time.NewTimer(debounceDuration) + if !restartTimer.Stop() { + return nil, errors.New("failed to initialise timer") + } + watcher, err := fsnotify.NewWatcher() + if err != nil { + return nil, errors.Errorf("failed to create file watcher: %w", err) + } + return &debounceFileWatcher{ + watcher: watcher, + ErrCh: watcher.Errors, + restartTimer: restartTimer, + RestartCh: restartTimer.C, + }, nil +} + +func (w *debounceFileWatcher) Start() { + for { + event, ok := <-w.watcher.Events + if !isIgnoredFileEvent(event) { + fmt.Fprintf(os.Stderr, "File change detected: %s (%s)\n", event.Name, event.Op.String()) + // Fire immediately when timer is inactive, without blocking this thread + if active := w.restartTimer.Reset(0); active { + w.restartTimer.Reset(debounceDuration) + } + } + // Ensure the last event is fired before channel close + if !ok { + return + } + fmt.Fprintf(utils.GetDebugLogger(), "Ignoring file event: %s (%s)\n", event.Name, event.Op.String()) + } +} + +func (w *debounceFileWatcher) SetWatchPaths(watchPaths []string, fsys afero.Fs) error { + watchLimit := viper.GetUint("FUNCTIONS_WATCH_LIMIT") + if watchLimit == 0 { + watchLimit = maxFileLimit + } + shouldWatchDirs := make(map[string]struct{}) + for _, hostPath := range watchPaths { + // Ignore non-existent paths and symlink directories + if err := afero.Walk(fsys, hostPath, func(path string, info fs.FileInfo, err error) error { + if errors.Is(err, os.ErrNotExist) || slices.Contains(ignoredDirNames, filepath.Base(path)) { + return nil + } else if err != nil { + return errors.Errorf("failed to walk path: %w", err) + } + if info.IsDir() { + shouldWatchDirs[path] = struct{}{} + } else if path == hostPath { + shouldWatchDirs[filepath.Dir(path)] = struct{}{} + } + if uint(len(shouldWatchDirs)) >= watchLimit { + return errors.Errorf("file watcher stopped at %s: %w", path, errTooManyFiles) + } + return nil + }); errors.Is(err, errTooManyFiles) { + fmt.Fprintf(os.Stderr, "%s\nYou can increase this limit by setting SUPABASE_FUNCTIONS_WATCH_LIMIT=%d", err.Error(), watchLimit<<2) + } else if err != nil { + return err + } + } + // Add directories to watch, ignoring duplicates + for hostPath := range shouldWatchDirs { + if err := w.watcher.Add(hostPath); err != nil { + return errors.Errorf("failed to watch directory: %w", err) + } + fmt.Fprintln(utils.GetDebugLogger(), "Added directory from watcher:", hostPath) + } + // Remove directories that are no longer needed + for _, hostPath := range w.watcher.WatchList() { + if _, ok := shouldWatchDirs[hostPath]; !ok { + if err := w.watcher.Remove(hostPath); err != nil { + return errors.Errorf("failed to remove watch directory: %w", err) + } + fmt.Fprintln(utils.GetDebugLogger(), "Removed directory from watcher:", hostPath) + } + } + return nil +} + +func (r *debounceFileWatcher) Close() error { + // Don't stop the timer to allow debounced events to fire + return r.watcher.Close() +} diff --git a/internal/functions/serve/watcher_test.go b/internal/functions/serve/watcher_test.go new file mode 100644 index 000000000..cde1dc078 --- /dev/null +++ b/internal/functions/serve/watcher_test.go @@ -0,0 +1,264 @@ +package serve + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" + + "github.com/fsnotify/fsnotify" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// Integration test setup for watcher functionality +type WatcherIntegrationSetup struct { + T *testing.T + Context context.Context + Cancel context.CancelFunc + TempDir string +} + +func NewWatcherIntegrationSetup(t *testing.T) *WatcherIntegrationSetup { + ctx, cancel := context.WithCancel(context.Background()) + tempDir := t.TempDir() + + setup := &WatcherIntegrationSetup{ + T: t, + Context: ctx, + Cancel: cancel, + TempDir: tempDir, + } + + return setup +} + +func (s *WatcherIntegrationSetup) Cleanup() { + s.Cancel() +} + +// SetupFunctionsDirectory creates a functions directory with test functions +func (s *WatcherIntegrationSetup) SetupFunctionsDirectory() string { + functionsDir := filepath.Join(s.TempDir, "supabase", "functions") + require.NoError(s.T, os.MkdirAll(functionsDir, 0755)) + + // Set up test functions + s.createFunction("hello", `export default () => new Response("Hello World")`) + s.createFunction("protected", `export default () => new Response("Protected")`) + + return functionsDir +} + +func (s *WatcherIntegrationSetup) SetupSupabaseDirectory() string { + supabaseDir := filepath.Join(s.TempDir, "supabase") + require.NoError(s.T, os.MkdirAll(supabaseDir, 0755)) + + return supabaseDir +} + +func (s *WatcherIntegrationSetup) createFunction(name, content string) { + funcDir := filepath.Join(s.TempDir, "supabase", "functions", name) + require.NoError(s.T, os.MkdirAll(funcDir, 0755)) + require.NoError(s.T, os.WriteFile(filepath.Join(funcDir, "index.ts"), []byte(content), 0600)) +} + +// CreateFileWatcher creates and configures a debounce file watcher for testing +func (s *WatcherIntegrationSetup) CreateFileWatcher() (*debounceFileWatcher, error) { + watcher, err := NewDebounceFileWatcher() + if err != nil { + return nil, err + } + + // Set up watch paths to include our test directory + fsys := afero.NewOsFs() + watchPaths := []string{s.TempDir} + + if err := watcher.SetWatchPaths(watchPaths, fsys); err != nil { + watcher.Close() + return nil, err + } + + return watcher, nil +} + +func TestFileWatcher(t *testing.T) { + t.Run("detects TypeScript function changes and triggers restart", func(t *testing.T) { + setup := NewWatcherIntegrationSetup(t) + defer setup.Cleanup() + + functionsDir := setup.SetupFunctionsDirectory() + watcher, err := setup.CreateFileWatcher() + require.NoError(t, err) + + // Modify a function file in background + go func() { + defer watcher.Close() + funcFile := filepath.Join(functionsDir, "hello", "index.ts") + newContent := `export default () => new Response("Hello Modified World")` + require.NoError(t, os.WriteFile(funcFile, []byte(newContent), 0600)) + // https://github.com/fsnotify/fsnotify/blob/main/fsnotify_test.go#L181 + time.Sleep(50 * time.Millisecond) + }() + + // Run watcher on main thread to avoid sleeping + watcher.Start() + + // Wait for restart signal + select { + case ts, ok := <-watcher.RestartCh: + assert.NotZero(t, ts, "file change should trigger restart") + assert.True(t, ok, "timer channel should be closed") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing restart signal after modifying TypeScript file") + } + }) + + t.Run("ignores editor temporary files", func(t *testing.T) { + watcher, err := NewDebounceFileWatcher() + require.NoError(t, err) + + // Create various temporary/editor files that should be ignored + go func() { + defer watcher.Close() + tempFiles := []string{ + filepath.Join("/tmp", "test.txt~"), // Backup file + filepath.Join("/tmp", ".test.swp"), // Vim swap + filepath.Join("/tmp", ".#test.ts"), // Emacs lock + filepath.Join("/tmp", "test.tmp"), // Temp file + filepath.Join("/tmp", "___deno_temp___"), // Deno temp + } + for _, tempFile := range tempFiles { + // Fire events directly since we only care about ignore files + watcher.watcher.Events <- fsnotify.Event{ + Name: tempFile, + Op: fsnotify.Create, + } + } + }() + + // Run watcher on main thread to avoid sleeping + watcher.Start() + + // Wait multiple times for out of order events + for range 3 { + select { + case <-watcher.RestartCh: + assert.Fail(t, "should not receive any restart signals from ignored files") + case err := <-watcher.ErrCh: + assert.NoError(t, err) + } + } + }) + + t.Run("detects config file changes and triggers restart", func(t *testing.T) { + setup := NewWatcherIntegrationSetup(t) + defer setup.Cleanup() + + supabaseDir := setup.SetupSupabaseDirectory() + watcher, err := setup.CreateFileWatcher() + require.NoError(t, err) + + // Create and modify a config.toml file + go func() { + defer watcher.Close() + configFile := filepath.Join(supabaseDir, "config.toml") + require.NoError(t, os.WriteFile(configFile, []byte(` + [functions.hello] + enabled = true + verify_jwt = false + `), 0600)) + // https://github.com/fsnotify/fsnotify/blob/main/fsnotify_test.go#L181 + time.Sleep(50 * time.Millisecond) + }() + + // Run watcher on main thread to avoid sleeping + watcher.Start() + + // Wait for restart signal + select { + case ts, ok := <-watcher.RestartCh: + assert.NotZero(t, ts, "config change should trigger restart") + assert.True(t, ok, "timer channel should be closed") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing restart signal after modifying config file") + } + }) + + t.Run("debounces rapid file changes", func(t *testing.T) { + watcher, err := NewDebounceFileWatcher() + require.NoError(t, err) + + // Make rapid changes to a file + go func() { + defer watcher.Close() + for range 5 { + watcher.watcher.Events <- fsnotify.Event{ + Name: filepath.Join("/tmp", "index.ts"), + Op: fsnotify.Write, + } + } + }() + + // Run watcher on main thread to avoid sleeping + watcher.Start() + + // Wait for debounce duration + select { + case ts, ok := <-watcher.RestartCh: + assert.NotZero(t, ts) + assert.True(t, ok) + case <-time.After(debounceDuration): + assert.Fail(t, "missing restart signal after rapid file changes") + } + select { + case <-watcher.RestartCh: + assert.Fail(t, "should only get one restart signal due to debouncing") + case ts, ok := <-time.After(debounceDuration): + assert.NotZero(t, ts) + assert.True(t, ok) + } + }) + + t.Run("watches multiple directories", func(t *testing.T) { + setup := NewWatcherIntegrationSetup(t) + defer setup.Cleanup() + + // Create multiple directories with functions + functionsDir := setup.SetupFunctionsDirectory() + libDir := filepath.Join(setup.TempDir, "lib") + require.NoError(t, os.MkdirAll(libDir, 0755)) + + // Create a utility file in lib directory + utilFile := filepath.Join(libDir, "utils.ts") + require.NoError(t, os.WriteFile(utilFile, []byte(`export function util() { return "utility"; }`), 0600)) + + watcher, err := NewDebounceFileWatcher() + require.NoError(t, err) + + go func() { + defer watcher.Close() + // Set up watch paths to include both directories + fsys := afero.NewOsFs() + watchPaths := []string{functionsDir, libDir} + require.NoError(t, watcher.SetWatchPaths(watchPaths, fsys)) + // Modify file in lib directory + require.NoError(t, os.WriteFile(utilFile, []byte(`export function util() { return "modified utility"; }`), 0600)) + // https://github.com/fsnotify/fsnotify/blob/main/fsnotify_test.go#L181 + time.Sleep(50 * time.Millisecond) + }() + + // Run watcher on main thread to avoid sleeping + watcher.Start() + + // Wait for restart signal + select { + case ts, ok := <-watcher.RestartCh: + assert.NotZero(t, ts, "change in watched lib directory should trigger restart") + assert.True(t, ok, "timer channel should be closed") + case <-time.After(2 * time.Second): + assert.Fail(t, "missing restart signal after modifying file in watched lib directory") + } + }) +} diff --git a/internal/testing/apitest/docker.go b/internal/testing/apitest/docker.go index 17a14355d..9b9020c04 100644 --- a/internal/testing/apitest/docker.go +++ b/internal/testing/apitest/docker.go @@ -3,7 +3,9 @@ package apitest import ( "bytes" "fmt" + "io" "net/http" + "strings" "github.com/docker/docker/api" "github.com/docker/docker/api/types/container" @@ -84,9 +86,17 @@ func MockDockerStop(docker *client.Client) { // Ref: internal/utils/docker.go::DockerRunOnce func setupDockerLogs(docker *client.Client, containerID, stdout string, exitCode int) error { + err := MockDockerLogsStream(docker, containerID, exitCode, strings.NewReader(stdout)) + gock.New(docker.DaemonHost()). + Delete("/v" + docker.ClientVersion() + "/containers/" + containerID). + Reply(http.StatusOK) + return err +} + +func MockDockerLogsStream(docker *client.Client, containerID string, exitCode int, r io.Reader) error { var body bytes.Buffer writer := stdcopy.NewStdWriter(&body, stdcopy.Stdout) - _, err := writer.Write([]byte(stdout)) + _, err := io.Copy(writer, r) gock.New(docker.DaemonHost()). Get("/v"+docker.ClientVersion()+"/containers/"+containerID+"/logs"). Reply(http.StatusOK). @@ -99,9 +109,6 @@ func setupDockerLogs(docker *client.Client, containerID, stdout string, exitCode State: &container.State{ ExitCode: exitCode, }}}) - gock.New(docker.DaemonHost()). - Delete("/v" + docker.ClientVersion() + "/containers/" + containerID). - Reply(http.StatusOK) return err } diff --git a/internal/utils/container_output.go b/internal/utils/container_output.go index 8f417afd1..ccbbab033 100644 --- a/internal/utils/container_output.go +++ b/internal/utils/container_output.go @@ -12,8 +12,6 @@ import ( "strings" "github.com/docker/docker/pkg/jsonmessage" - "github.com/docker/docker/pkg/stdcopy" - "github.com/go-errors/errors" ) func ProcessPullOutput(out io.ReadCloser, p Program) error { @@ -205,36 +203,3 @@ func ProcessDiffOutput(diffBytes []byte) ([]byte, error) { } return []byte(diffHeader + "\n\n" + strings.Join(filteredDiffDdls, "\n\n") + "\n"), nil } - -func ProcessPsqlOutput(out io.Reader, p Program) error { - r, w := io.Pipe() - doneCh := make(chan struct{}, 1) - - go func() { - scanner := bufio.NewScanner(r) - - for scanner.Scan() { - select { - case <-doneCh: - return - default: - } - - line := scanner.Text() - p.Send(PsqlMsg(&line)) - } - }() - - var errBuf bytes.Buffer - if _, err := stdcopy.StdCopy(w, &errBuf, out); err != nil { - return err - } - if errBuf.Len() > 0 { - return errors.New("Error running SQL: " + errBuf.String()) - } - - doneCh <- struct{}{} - p.Send(PsqlMsg(nil)) - - return nil -} diff --git a/internal/utils/container_output_test.go b/internal/utils/container_output_test.go index cf3e529bb..325084618 100644 --- a/internal/utils/container_output_test.go +++ b/internal/utils/container_output_test.go @@ -1,7 +1,6 @@ package utils import ( - "bytes" "encoding/json" "io" "sync" @@ -9,7 +8,6 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/docker/docker/pkg/jsonmessage" - "github.com/docker/docker/pkg/stdcopy" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -65,41 +63,6 @@ func TestProcessDiffOutput(t *testing.T) { }) } -func TestProcessPsqlOutput(t *testing.T) { - t.Run("processes psql output", func(t *testing.T) { - var buf bytes.Buffer - writer := stdcopy.NewStdWriter(&buf, stdcopy.Stdout) - _, err := writer.Write([]byte("test output\n")) - require.NoError(t, err) - - var lastLine *string - p := NewMockProgram(func(msg tea.Msg) { - if m, ok := msg.(PsqlMsg); ok { - lastLine = m - } - }) - - err = ProcessPsqlOutput(&buf, p) - - assert.NoError(t, err) - assert.Nil(t, lastLine) - }) - - t.Run("handles stderr output", func(t *testing.T) { - var buf bytes.Buffer - writer := stdcopy.NewStdWriter(&buf, stdcopy.Stderr) - _, err := writer.Write([]byte("error message\n")) - require.NoError(t, err) - - p := NewMockProgram(nil) - - err = ProcessPsqlOutput(&buf, p) - - assert.Error(t, err) - assert.Contains(t, err.Error(), "error message") - }) -} - func TestProcessPullOutput(t *testing.T) { t.Run("processes docker pull messages", func(t *testing.T) { messages := []jsonmessage.JSONMessage{ diff --git a/internal/utils/docker.go b/internal/utils/docker.go index 374182a3e..7e908649e 100644 --- a/internal/utils/docker.go +++ b/internal/utils/docker.go @@ -376,13 +376,19 @@ func DockerRunOnceWithConfig(ctx context.Context, config container.Config, hostC return DockerStreamLogs(ctx, container, stdout, stderr) } -func DockerStreamLogs(ctx context.Context, containerId string, stdout, stderr io.Writer) error { - // Stream logs - logs, err := Docker.ContainerLogs(ctx, containerId, container.LogsOptions{ +var ErrContainerKilled = errors.New("exit 137") + +func DockerStreamLogs(ctx context.Context, containerId string, stdout, stderr io.Writer, opts ...func(*container.LogsOptions)) error { + logsOptions := container.LogsOptions{ ShowStdout: true, ShowStderr: true, Follow: true, - }) + } + for _, apply := range opts { + apply(&logsOptions) + } + // Stream logs + logs, err := Docker.ContainerLogs(ctx, containerId, logsOptions) if err != nil { return errors.Errorf("failed to read docker logs: %w", err) } @@ -395,10 +401,15 @@ func DockerStreamLogs(ctx context.Context, containerId string, stdout, stderr io if err != nil { return errors.Errorf("failed to inspect docker container: %w", err) } - if resp.State.ExitCode > 0 { - return errors.Errorf("error running container: exit %d", resp.State.ExitCode) + switch resp.State.ExitCode { + case 0: + return nil + case 137: + err = ErrContainerKilled + default: + err = errors.Errorf("exit %d", resp.State.ExitCode) } - return nil + return errors.Errorf("error running container: %w", err) } func DockerStreamLogsOnce(ctx context.Context, containerId string, stdout, stderr io.Writer) error { From e1d608256a2c89cc9a8beeda901d23f078807f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=83=A5=EB=83=90=EC=B1=A0?= Date: Wed, 18 Jun 2025 12:46:31 +0900 Subject: [PATCH 03/40] fix: bump edge-runtime to 1.68.0-develop.18 (#3727) --- pkg/config/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index ad0c71d2d..b9d03e3e3 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -12,7 +12,7 @@ const ( pg13 = "supabase/postgres:13.3.0" pg14 = "supabase/postgres:14.1.0.89" pg15 = "supabase/postgres:15.8.1.085" - deno2 = "supabase/edge-runtime:v1.68.0-develop.14" + deno2 = "supabase/edge-runtime:v1.68.0-develop.18" ) type images struct { From 0f1e20f8cc2ff51c626626f66187c116ff176d7e Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:17:42 +0300 Subject: [PATCH 04/40] feat: add CSVQ support for rule parsing (#3595) * add simple rules for parsing report output added csvq driver and normalised column names across queries combine report queries to creats rollup for tables, indexes, roles and db overall * chore: use deprecated command field * chore: add missing deprecated commands * chore: use a single toml library * fix: exclude internal schemas from db stats * chore: update unit tests * fix: load default rules in report command * chore: add deprecated command * chore: make report database configurable * feat: load inspect rules from config file --------- Co-authored-by: Qiao Han Co-authored-by: Han Qiao --- cmd/inspect.go | 229 ++++++++++-------- go.mod | 5 + go.sum | 10 + internal/inspect/bloat/bloat.go | 13 +- internal/inspect/bloat/bloat.sql | 41 ++-- internal/inspect/bloat/bloat_test.go | 9 +- internal/inspect/cache/cache.go | 57 ----- internal/inspect/cache/cache.sql | 9 - internal/inspect/cache/cache_test.go | 52 ---- internal/inspect/db_stats/db_stats.go | 52 ++++ internal/inspect/db_stats/db_stats.sql | 27 +++ .../db_stats_test.go} | 15 +- internal/inspect/index_sizes/index_sizes.sql | 9 - .../index_stats.go} | 20 +- internal/inspect/index_stats/index_stats.sql | 49 ++++ .../index_stats_test.go} | 23 +- internal/inspect/index_usage/index_usage.sql | 17 -- internal/inspect/locks/locks.go | 10 +- internal/inspect/locks/locks.sql | 4 +- internal/inspect/locks/locks_test.go | 2 +- internal/inspect/report.go | 78 ++++-- internal/inspect/report_test.go | 81 ++----- .../inspect/role_configs/role_configs.sql | 5 - .../inspect/role_configs/role_configs_test.go | 38 --- .../role_connections/role_connections.go | 62 ----- .../role_stats.go} | 18 +- .../role_stats.sql} | 10 +- .../role_stats_test.go} | 7 +- internal/inspect/seq_scans/seq_scans.go | 46 ---- internal/inspect/seq_scans/seq_scans.sql | 6 - internal/inspect/seq_scans/seq_scans_test.go | 40 --- .../table_index_sizes/table_index_sizes.go | 46 ---- .../table_index_sizes/table_index_sizes.sql | 8 - .../table_index_sizes_test.go | 40 --- .../table_record_counts.go | 47 ---- .../table_record_counts.sql | 7 - .../table_record_counts_test.go | 41 ---- internal/inspect/table_sizes/table_sizes.go | 47 ---- internal/inspect/table_sizes/table_sizes.sql | 9 - .../inspect/table_sizes/table_sizes_test.go | 41 ---- .../table_stats.go} | 23 +- internal/inspect/table_stats/table_stats.sql | 27 +++ .../table_stats_test.go} | 24 +- internal/inspect/templates/rules.toml | 43 ++++ .../total_index_size/total_index_size.go | 45 ---- .../total_index_size/total_index_size.sql | 6 - .../total_table_sizes/total_table_sizes.go | 47 ---- .../total_table_sizes/total_table_sizes.sql | 9 - .../total_table_sizes_test.go | 41 ---- .../inspect/unused_indexes/unused_indexes.go | 4 +- .../inspect/unused_indexes/unused_indexes.sql | 2 +- .../unused_indexes/unused_indexes_test.go | 2 +- internal/inspect/vacuum_stats/vacuum_stats.go | 7 +- .../inspect/vacuum_stats/vacuum_stats.sql | 3 +- .../inspect/vacuum_stats/vacuum_stats_test.go | 3 +- pkg/config/config.go | 12 + 56 files changed, 558 insertions(+), 1070 deletions(-) delete mode 100644 internal/inspect/cache/cache.go delete mode 100644 internal/inspect/cache/cache.sql delete mode 100644 internal/inspect/cache/cache_test.go create mode 100644 internal/inspect/db_stats/db_stats.go create mode 100644 internal/inspect/db_stats/db_stats.sql rename internal/inspect/{total_index_size/total_index_size_test.go => db_stats/db_stats_test.go} (63%) delete mode 100644 internal/inspect/index_sizes/index_sizes.sql rename internal/inspect/{index_sizes/index_sizes.go => index_stats/index_stats.go} (64%) create mode 100644 internal/inspect/index_stats/index_stats.sql rename internal/inspect/{index_sizes/index_sizes_test.go => index_stats/index_stats_test.go} (63%) delete mode 100644 internal/inspect/index_usage/index_usage.sql delete mode 100644 internal/inspect/role_configs/role_configs.sql delete mode 100644 internal/inspect/role_configs/role_configs_test.go delete mode 100644 internal/inspect/role_connections/role_connections.go rename internal/inspect/{role_configs/role_configs.go => role_stats/role_stats.go} (64%) rename internal/inspect/{role_connections/role_connections.sql => role_stats/role_stats.sql} (64%) rename internal/inspect/{role_connections/role_connections_test.go => role_stats/role_stats_test.go} (84%) delete mode 100644 internal/inspect/seq_scans/seq_scans.go delete mode 100644 internal/inspect/seq_scans/seq_scans.sql delete mode 100644 internal/inspect/seq_scans/seq_scans_test.go delete mode 100644 internal/inspect/table_index_sizes/table_index_sizes.go delete mode 100644 internal/inspect/table_index_sizes/table_index_sizes.sql delete mode 100644 internal/inspect/table_index_sizes/table_index_sizes_test.go delete mode 100644 internal/inspect/table_record_counts/table_record_counts.go delete mode 100644 internal/inspect/table_record_counts/table_record_counts.sql delete mode 100644 internal/inspect/table_record_counts/table_record_counts_test.go delete mode 100644 internal/inspect/table_sizes/table_sizes.go delete mode 100644 internal/inspect/table_sizes/table_sizes.sql delete mode 100644 internal/inspect/table_sizes/table_sizes_test.go rename internal/inspect/{index_usage/index_usage.go => table_stats/table_stats.go} (60%) create mode 100644 internal/inspect/table_stats/table_stats.sql rename internal/inspect/{index_usage/index_usage_test.go => table_stats/table_stats_test.go} (59%) create mode 100644 internal/inspect/templates/rules.toml delete mode 100644 internal/inspect/total_index_size/total_index_size.go delete mode 100644 internal/inspect/total_index_size/total_index_size.sql delete mode 100644 internal/inspect/total_table_sizes/total_table_sizes.go delete mode 100644 internal/inspect/total_table_sizes/total_table_sizes.sql delete mode 100644 internal/inspect/total_table_sizes/total_table_sizes_test.go diff --git a/cmd/inspect.go b/cmd/inspect.go index 2b55c3876..24c3ff465 100644 --- a/cmd/inspect.go +++ b/cmd/inspect.go @@ -1,37 +1,25 @@ package cmd import ( - "fmt" "os" "os/signal" - "path/filepath" "github.com/spf13/afero" "github.com/spf13/cobra" + "github.com/supabase/cli/internal/inspect" "github.com/supabase/cli/internal/inspect/bloat" "github.com/supabase/cli/internal/inspect/blocking" - "github.com/supabase/cli/internal/inspect/cache" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/internal/utils/flags" - - "github.com/supabase/cli/internal/inspect" "github.com/supabase/cli/internal/inspect/calls" - "github.com/supabase/cli/internal/inspect/index_sizes" - "github.com/supabase/cli/internal/inspect/index_usage" + "github.com/supabase/cli/internal/inspect/db_stats" + "github.com/supabase/cli/internal/inspect/index_stats" "github.com/supabase/cli/internal/inspect/locks" "github.com/supabase/cli/internal/inspect/long_running_queries" "github.com/supabase/cli/internal/inspect/outliers" "github.com/supabase/cli/internal/inspect/replication_slots" - "github.com/supabase/cli/internal/inspect/role_configs" - "github.com/supabase/cli/internal/inspect/role_connections" - "github.com/supabase/cli/internal/inspect/seq_scans" - "github.com/supabase/cli/internal/inspect/table_index_sizes" - "github.com/supabase/cli/internal/inspect/table_record_counts" - "github.com/supabase/cli/internal/inspect/table_sizes" - "github.com/supabase/cli/internal/inspect/total_index_size" - "github.com/supabase/cli/internal/inspect/total_table_sizes" - "github.com/supabase/cli/internal/inspect/unused_indexes" + "github.com/supabase/cli/internal/inspect/role_stats" + "github.com/supabase/cli/internal/inspect/table_stats" "github.com/supabase/cli/internal/inspect/vacuum_stats" + "github.com/supabase/cli/internal/utils/flags" ) var ( @@ -51,11 +39,11 @@ var ( }, } - inspectCacheHitCmd = &cobra.Command{ - Use: "cache-hit", - Short: "Show cache hit rates for tables and indices", + inspectDBStatsCmd = &cobra.Command{ + Use: "db-stats", + Short: "Show stats such as cache hit rates, total sizes, and WAL size", RunE: func(cmd *cobra.Command, args []string) error { - return cache.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return db_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } @@ -67,14 +55,6 @@ var ( }, } - inspectIndexUsageCmd = &cobra.Command{ - Use: "index-usage", - Short: "Show information about the efficiency of indexes", - RunE: func(cmd *cobra.Command, args []string) error { - return index_usage.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) - }, - } - inspectLocksCmd = &cobra.Command{ Use: "locks", Short: "Show queries which have taken out an exclusive lock on a relation", @@ -107,107 +87,159 @@ var ( }, } - inspectTotalIndexSizeCmd = &cobra.Command{ - Use: "total-index-size", - Short: "Show total size of all indexes", + inspectIndexStatsCmd = &cobra.Command{ + Use: "index-stats", + Short: "Show combined index size, usage percent, scan counts, and unused status", RunE: func(cmd *cobra.Command, args []string) error { - return total_index_size.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectIndexSizesCmd = &cobra.Command{ - Use: "index-sizes", - Short: "Show index sizes of individual indexes", + inspectLongRunningQueriesCmd = &cobra.Command{ + Use: "long-running-queries", + Short: "Show currently running queries running for longer than 5 minutes", RunE: func(cmd *cobra.Command, args []string) error { - return index_sizes.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return long_running_queries.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectTableSizesCmd = &cobra.Command{ - Use: "table-sizes", - Short: "Show table sizes of individual tables without their index sizes", + inspectBloatCmd = &cobra.Command{ + Use: "bloat", + Short: "Estimates space allocated to a relation that is full of dead tuples", RunE: func(cmd *cobra.Command, args []string) error { - return table_sizes.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return bloat.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectTableIndexSizesCmd = &cobra.Command{ - Use: "table-index-sizes", - Short: "Show index sizes of individual tables", + inspectRoleStatsCmd = &cobra.Command{ + Use: "role-stats", + Short: "Show information about roles on the database", RunE: func(cmd *cobra.Command, args []string) error { - return table_index_sizes.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return role_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectTotalTableSizesCmd = &cobra.Command{ - Use: "total-table-sizes", - Short: "Show total table sizes, including table index sizes", + inspectVacuumStatsCmd = &cobra.Command{ + Use: "vacuum-stats", + Short: "Show statistics related to vacuum operations per table", RunE: func(cmd *cobra.Command, args []string) error { - return total_table_sizes.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return vacuum_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectUnusedIndexesCmd = &cobra.Command{ - Use: "unused-indexes", - Short: "Show indexes with low usage", + inspectTableStatsCmd = &cobra.Command{ + Use: "table-stats", + Short: "Show combined table size, index size, and estimated row count", RunE: func(cmd *cobra.Command, args []string) error { - return unused_indexes.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return table_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectSeqScansCmd = &cobra.Command{ - Use: "seq-scans", - Short: "Show number of sequential scans recorded against all tables", + inspectCacheHitCmd = &cobra.Command{ + Deprecated: `use "db-stats" instead.`, + Use: "cache-hit", + Short: "Show cache hit rates for tables and indices", RunE: func(cmd *cobra.Command, args []string) error { - return seq_scans.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return db_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectLongRunningQueriesCmd = &cobra.Command{ - Use: "long-running-queries", - Short: "Show currently running queries running for longer than 5 minutes", + inspectIndexUsageCmd = &cobra.Command{ + Deprecated: `use "index-stats" instead.`, + Use: "index-usage", + Short: "Show information about the efficiency of indexes", RunE: func(cmd *cobra.Command, args []string) error { - return long_running_queries.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectTableRecordCountsCmd = &cobra.Command{ - Use: "table-record-counts", - Short: "Show estimated number of rows per table", + inspectTotalIndexSizeCmd = &cobra.Command{ + Deprecated: `use "index-stats" instead.`, + Use: "total-index-size", + Short: "Show total size of all indexes", RunE: func(cmd *cobra.Command, args []string) error { - return table_record_counts.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectBloatCmd = &cobra.Command{ - Use: "bloat", - Short: "Estimates space allocated to a relation that is full of dead tuples", + inspectIndexSizesCmd = &cobra.Command{ + Deprecated: `use "index-stats" instead.`, + Use: "index-sizes", + Short: "Show index sizes of individual indexes", RunE: func(cmd *cobra.Command, args []string) error { - return bloat.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } - inspectVacuumStatsCmd = &cobra.Command{ - Use: "vacuum-stats", - Short: "Show statistics related to vacuum operations per table", + inspectTableSizesCmd = &cobra.Command{ + Deprecated: `use "table-stats" instead.`, + Use: "table-sizes", + Short: "Show table sizes of individual tables without their index sizes", RunE: func(cmd *cobra.Command, args []string) error { - return vacuum_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return table_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + }, + } + + inspectTableIndexSizesCmd = &cobra.Command{ + Deprecated: `use "table-stats" instead.`, + Use: "table-index-sizes", + Short: "Show index sizes of individual tables", + RunE: func(cmd *cobra.Command, args []string) error { + return table_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + }, + } + + inspectTotalTableSizesCmd = &cobra.Command{ + Deprecated: `use "table-stats" instead.`, + Use: "total-table-sizes", + Short: "Show total table sizes, including table index sizes", + RunE: func(cmd *cobra.Command, args []string) error { + return table_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + }, + } + + inspectUnusedIndexesCmd = &cobra.Command{ + Deprecated: `use "index-stats" instead.`, + Use: "unused-indexes", + Short: "Show indexes with low usage", + RunE: func(cmd *cobra.Command, args []string) error { + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + }, + } + + inspectTableRecordCountsCmd = &cobra.Command{ + Deprecated: `use "table-stats" instead.`, + Use: "table-record-counts", + Short: "Show estimated number of rows per table", + RunE: func(cmd *cobra.Command, args []string) error { + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + }, + } + + inspectSeqScansCmd = &cobra.Command{ + Deprecated: `use "index-stats" instead.`, + Use: "seq-scans", + Short: "Show number of sequential scans recorded against all tables", + RunE: func(cmd *cobra.Command, args []string) error { + return index_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } inspectRoleConfigsCmd = &cobra.Command{ - Use: "role-configs", - Short: "Show configuration settings for database roles when they have been modified", + Deprecated: `use "role-stats" instead.`, + Use: "role-configs", + Short: "Show configuration settings for database roles when they have been modified", RunE: func(cmd *cobra.Command, args []string) error { - return role_configs.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return role_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } inspectRoleConnectionsCmd = &cobra.Command{ - Use: "role-connections", - Short: "Show number of active connections for all database roles", + Deprecated: `use "role-stats" instead.`, + Use: "role-connections", + Short: "Show number of active connections for all database roles", RunE: func(cmd *cobra.Command, args []string) error { - return role_connections.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) + return role_stats.Run(cmd.Context(), flags.DbConfig, afero.NewOsFs()) }, } @@ -217,17 +249,7 @@ var ( Use: "report", Short: "Generate a CSV output for all inspect commands", RunE: func(cmd *cobra.Command, args []string) error { - ctx := cmd.Context() - if len(outputDir) == 0 { - defaultPath := filepath.Join(utils.CurrentDirAbs, "report") - title := fmt.Sprintf("Enter a directory to save output files (or leave blank to use %s): ", utils.Bold(defaultPath)) - if dir, err := utils.NewConsole().PromptText(ctx, title); err != nil { - return err - } else if len(dir) == 0 { - outputDir = defaultPath - } - } - return inspect.Report(ctx, outputDir, flags.DbConfig, afero.NewOsFs()) + return inspect.Report(cmd.Context(), outputDir, flags.DbConfig, afero.NewOsFs()) }, } ) @@ -238,28 +260,33 @@ func init() { inspectFlags.Bool("linked", true, "Inspect the linked project.") inspectFlags.Bool("local", false, "Inspect the local database.") inspectCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local") - inspectDBCmd.AddCommand(inspectCacheHitCmd) inspectDBCmd.AddCommand(inspectReplicationSlotsCmd) - inspectDBCmd.AddCommand(inspectIndexUsageCmd) + inspectDBCmd.AddCommand(inspectIndexStatsCmd) inspectDBCmd.AddCommand(inspectLocksCmd) inspectDBCmd.AddCommand(inspectBlockingCmd) inspectDBCmd.AddCommand(inspectOutliersCmd) inspectDBCmd.AddCommand(inspectCallsCmd) + inspectDBCmd.AddCommand(inspectLongRunningQueriesCmd) + inspectDBCmd.AddCommand(inspectBloatCmd) + inspectDBCmd.AddCommand(inspectVacuumStatsCmd) + inspectDBCmd.AddCommand(inspectTableStatsCmd) + inspectDBCmd.AddCommand(inspectRoleStatsCmd) + inspectDBCmd.AddCommand(inspectDBStatsCmd) + // DEPRECATED + inspectDBCmd.AddCommand(inspectCacheHitCmd) + inspectDBCmd.AddCommand(inspectIndexUsageCmd) + inspectDBCmd.AddCommand(inspectSeqScansCmd) + inspectDBCmd.AddCommand(inspectUnusedIndexesCmd) + inspectDBCmd.AddCommand(inspectTotalTableSizesCmd) + inspectDBCmd.AddCommand(inspectTableIndexSizesCmd) inspectDBCmd.AddCommand(inspectTotalIndexSizeCmd) inspectDBCmd.AddCommand(inspectIndexSizesCmd) inspectDBCmd.AddCommand(inspectTableSizesCmd) - inspectDBCmd.AddCommand(inspectTableIndexSizesCmd) - inspectDBCmd.AddCommand(inspectTotalTableSizesCmd) - inspectDBCmd.AddCommand(inspectUnusedIndexesCmd) - inspectDBCmd.AddCommand(inspectSeqScansCmd) - inspectDBCmd.AddCommand(inspectLongRunningQueriesCmd) inspectDBCmd.AddCommand(inspectTableRecordCountsCmd) - inspectDBCmd.AddCommand(inspectBloatCmd) - inspectDBCmd.AddCommand(inspectVacuumStatsCmd) inspectDBCmd.AddCommand(inspectRoleConfigsCmd) inspectDBCmd.AddCommand(inspectRoleConnectionsCmd) inspectCmd.AddCommand(inspectDBCmd) - reportCmd.Flags().StringVar(&outputDir, "output-dir", "", "Path to save CSV files in") + reportCmd.Flags().StringVar(&outputDir, "output-dir", ".", "Path to save CSV files in") inspectCmd.AddCommand(reportCmd) rootCmd.AddCommand(inspectCmd) } diff --git a/go.mod b/go.mod index 236ba65ea..25165cd30 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,7 @@ require ( github.com/jackc/pgproto3/v2 v2.3.3 github.com/jackc/pgx/v4 v4.18.3 github.com/joho/godotenv v1.5.1 + github.com/mithrandie/csvq-driver v1.7.0 github.com/muesli/reflow v0.3.0 github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 github.com/slack-go/slack v0.17.1 @@ -223,6 +224,10 @@ require ( github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect + github.com/mithrandie/csvq v1.18.1 // indirect + github.com/mithrandie/go-file/v2 v2.1.0 // indirect + github.com/mithrandie/go-text v1.6.0 // indirect + github.com/mithrandie/ternary v1.1.1 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/sys/atomicwriter v0.1.0 // indirect github.com/moby/sys/sequential v0.6.0 // indirect diff --git a/go.sum b/go.sum index 522289a4b..40b6ea8ee 100644 --- a/go.sum +++ b/go.sum @@ -696,6 +696,16 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mithrandie/csvq v1.18.1 h1:f7NB2scbb7xx2ffPduJ2VtZ85RpWXfvanYskAkGlCBU= +github.com/mithrandie/csvq v1.18.1/go.mod h1:MRJj7AtcXfk7jhNGxLuJGP3LORmh4lpiPWxQ7VyCRn8= +github.com/mithrandie/csvq-driver v1.7.0 h1:ejiavXNWwTPMyr3fJFnhcqd1L1cYudA0foQy9cZrqhw= +github.com/mithrandie/csvq-driver v1.7.0/go.mod h1:HcN3xL9UCJnBYA/AIQOOB/KlyfXAiYr5yxDmiwrGk5o= +github.com/mithrandie/go-file/v2 v2.1.0 h1:XA5Tl+73GXMDvgwSE3Sg0uC5FkLr3hnXs8SpUas0hyg= +github.com/mithrandie/go-file/v2 v2.1.0/go.mod h1:9YtTF3Xo59GqC1Pxw6KyGVcM/qubAMlxVsqI/u9r++c= +github.com/mithrandie/go-text v1.6.0 h1:8gOXTMPbMY8DJbKMTv8kHhADcJlDWXqS/YQH4SyWO6s= +github.com/mithrandie/go-text v1.6.0/go.mod h1:xCgj1xiNbI/d4xA9sLVvXkjh5B2tNx2ZT2/3rpmh8to= +github.com/mithrandie/ternary v1.1.1 h1:k/joD6UGVYxHixYmSR8EGgDFNONBMqyD373xT4QRdC4= +github.com/mithrandie/ternary v1.1.1/go.mod h1:0D9Ba3+09K2TdSZO7/bFCC0GjSXetCvYuYq0u8FY/1g= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= diff --git a/internal/inspect/bloat/bloat.go b/internal/inspect/bloat/bloat.go index 6a97e41c8..a339cd205 100644 --- a/internal/inspect/bloat/bloat.go +++ b/internal/inspect/bloat/bloat.go @@ -19,11 +19,10 @@ import ( var BloatQuery string type Result struct { - Type string - Schemaname string - Object_name string - Bloat string - Waste string + Type string + Name string + Bloat string + Waste string } func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { @@ -41,9 +40,9 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } - table := "|Type|Schema name|Object name|Bloat|Waste\n|-|-|-|-|-|\n" + table := "|Type|Name|Bloat|Waste\n|-|-|-|-|\n" for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%s`|`%s`|\n", r.Type, r.Schemaname, r.Object_name, r.Bloat, r.Waste) + table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%s`|\n", r.Type, r.Name, r.Bloat, r.Waste) } return list.RenderTable(table) } diff --git a/internal/inspect/bloat/bloat.sql b/internal/inspect/bloat/bloat.sql index 25917d874..06e4234f0 100644 --- a/internal/inspect/bloat/bloat.sql +++ b/internal/inspect/bloat/bloat.sql @@ -25,7 +25,8 @@ WITH constants AS ( (CASE WHEN datahdr%ma=0 THEN ma ELSE datahdr%ma END))+nullhdr2+4))/(bs-20::float)) AS otta FROM bloat_info JOIN pg_class cc ON cc.relname = bloat_info.tablename - JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname AND nn.nspname <> 'information_schema' + JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname + WHERE NOT nn.nspname LIKE ANY($1) ), index_bloat AS ( SELECT schemaname, tablename, bs, @@ -33,29 +34,25 @@ WITH constants AS ( COALESCE(CEIL((c2.reltuples*(datahdr-12))/(bs-20::float)),0) AS iotta -- very rough approximation, assumes all cols FROM bloat_info JOIN pg_class cc ON cc.relname = bloat_info.tablename - JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname AND nn.nspname <> 'information_schema' + JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname JOIN pg_index i ON indrelid = cc.oid JOIN pg_class c2 ON c2.oid = i.indexrelid -) -SELECT - type, schemaname, object_name, bloat, pg_size_pretty(raw_waste) as waste -FROM -(SELECT - 'table' as type, - schemaname, - tablename as object_name, - ROUND(CASE WHEN otta=0 THEN 0.0 ELSE table_bloat.relpages/otta::numeric END,1) AS bloat, - CASE WHEN relpages < otta THEN '0' ELSE (bs*(table_bloat.relpages-otta)::bigint)::bigint END AS raw_waste -FROM - table_bloat + WHERE NOT nn.nspname LIKE ANY($1) +), bloat_summary AS ( + SELECT + 'table' as type, + FORMAT('%I.%I', schemaname, tablename) AS name, + ROUND(CASE WHEN otta=0 THEN 0.0 ELSE table_bloat.relpages/otta::numeric END,1) AS bloat, + CASE WHEN relpages < otta THEN '0' ELSE (bs*(table_bloat.relpages-otta)::bigint)::bigint END AS raw_waste + FROM table_bloat UNION -SELECT - 'index' as type, - schemaname, - tablename || '::' || iname as object_name, - ROUND(CASE WHEN iotta=0 OR ipages=0 THEN 0.0 ELSE ipages/iotta::numeric END,1) AS bloat, + SELECT + 'index' as type, + FORMAT('%I.%I::%I', schemaname, tablename, iname) AS name, + ROUND(CASE WHEN iotta=0 OR ipages=0 THEN 0.0 ELSE ipages/iotta::numeric END,1) AS bloat, CASE WHEN ipages < iotta THEN '0' ELSE (bs*(ipages-iotta))::bigint END AS raw_waste -FROM - index_bloat) bloat_summary -WHERE NOT schemaname LIKE ANY($1) + FROM index_bloat +) +SELECT type, name, bloat, pg_size_pretty(raw_waste) as waste +FROM bloat_summary ORDER BY raw_waste DESC, bloat DESC diff --git a/internal/inspect/bloat/bloat_test.go b/internal/inspect/bloat/bloat_test.go index 8646565ce..d172e4220 100644 --- a/internal/inspect/bloat/bloat_test.go +++ b/internal/inspect/bloat/bloat_test.go @@ -29,11 +29,10 @@ func TestBloat(t *testing.T) { defer conn.Close(t) conn.Query(BloatQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). Reply("SELECT 1", Result{ - Type: "index hit rate", - Schemaname: "public", - Object_name: "table", - Bloat: "0.9", - Waste: "0.1", + Type: "index hit rate", + Name: "public.table", + Bloat: "0.9", + Waste: "0.1", }) // Run test err := Run(context.Background(), dbConfig, fsys, conn.Intercept) diff --git a/internal/inspect/cache/cache.go b/internal/inspect/cache/cache.go deleted file mode 100644 index 2b7ad5f25..000000000 --- a/internal/inspect/cache/cache.go +++ /dev/null @@ -1,57 +0,0 @@ -package cache - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed cache.sql -var CacheQuery string - -type Result struct { - Name string - Ratio float64 -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - // Ref: https://github.com/heroku/heroku-pg-extras/blob/main/commands/cache_hit.js#L7 - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, CacheQuery) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - // TODO: implement a markdown table marshaller - table := "|Name|Ratio|OK?|Explanation|\n|-|-|-|-|\n" - for _, r := range result { - ok := "Yup!" - if r.Ratio < 0.94 { - ok = "Maybe not..." - } - var explanation string - switch r.Name { - case "index hit rate": - explanation = "This is the ratio of index hits to index scans. If this ratio is low, it means that the database is not using indexes effectively. Check the `index-usage` command for more info." - case "table hit rate": - explanation = "This is the ratio of table hits to table scans. If this ratio is low, it means that your queries are not finding the data effectively. Check your query performance and it might be worth increasing your compute." - } - table += fmt.Sprintf("|`%s`|`%.6f`|`%s`|`%s`|\n", r.Name, r.Ratio, ok, explanation) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/cache/cache.sql b/internal/inspect/cache/cache.sql deleted file mode 100644 index fc14b288c..000000000 --- a/internal/inspect/cache/cache.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - 'index hit rate' AS name, - (sum(idx_blks_hit)) / nullif(sum(idx_blks_hit + idx_blks_read),0) AS ratio -FROM pg_statio_user_indexes -UNION ALL -SELECT - 'table hit rate' AS name, - sum(heap_blks_hit) / nullif(sum(heap_blks_hit) + sum(heap_blks_read),0) AS ratio -FROM pg_statio_user_tables diff --git a/internal/inspect/cache/cache_test.go b/internal/inspect/cache/cache_test.go deleted file mode 100644 index 28fa1cb73..000000000 --- a/internal/inspect/cache/cache_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package cache - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestCacheCommand(t *testing.T) { - t.Run("inspects cache hit rate", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(CacheQuery). - Reply("SELECT 1", Result{ - Name: "index hit rate", - Ratio: 0.9, - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) - - t.Run("throws error on empty result", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(CacheQuery). - Reply("SELECT 1", []interface{}{}) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.ErrorContains(t, err, "cannot find field Name in returned row") - }) -} diff --git a/internal/inspect/db_stats/db_stats.go b/internal/inspect/db_stats/db_stats.go new file mode 100644 index 000000000..e9ca43f7e --- /dev/null +++ b/internal/inspect/db_stats/db_stats.go @@ -0,0 +1,52 @@ +package db_stats + +import ( + "context" + _ "embed" + "fmt" + + "github.com/go-errors/errors" + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" + "github.com/spf13/afero" + "github.com/supabase/cli/internal/db/reset" + "github.com/supabase/cli/internal/migration/list" + "github.com/supabase/cli/internal/utils" + "github.com/supabase/cli/pkg/pgxv5" +) + +//go:embed db_stats.sql +var DBStatsQuery string + +type Result struct { + Database_size string + Total_index_size string + Total_table_size string + Total_toast_size string + Time_since_stats_reset string + Index_hit_rate string + Table_hit_rate string + WAL_size string +} + +func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { + conn, err := utils.ConnectByConfig(ctx, config, options...) + if err != nil { + return err + } + defer conn.Close(context.Background()) + rows, err := conn.Query(ctx, DBStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas), config.Database) + if err != nil { + return errors.Errorf("failed to query rows: %w", err) + } + result, err := pgxv5.CollectRows[Result](rows) + if err != nil { + return err + } + + table := "|Name|Database Size|Total Index Size|Total Table Size|Total Toast Size|Time Since Stats Reset|Index Hit Rate|Table Hit Rate|WAL Size|\n|-|-|-|-|-|-|-|-|-|\n" + for _, r := range result { + table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%s`|`%s`|`%s`|`%s`|`%s`|`%s`|\n", config.Database, r.Database_size, r.Total_index_size, r.Total_table_size, r.Total_toast_size, r.Time_since_stats_reset, r.Index_hit_rate, r.Table_hit_rate, r.WAL_size) + } + return list.RenderTable(table) +} diff --git a/internal/inspect/db_stats/db_stats.sql b/internal/inspect/db_stats/db_stats.sql new file mode 100644 index 000000000..d7fc02f98 --- /dev/null +++ b/internal/inspect/db_stats/db_stats.sql @@ -0,0 +1,27 @@ +WITH total_objects AS ( + SELECT c.relkind, pg_size_pretty(SUM(pg_relation_size(c.oid))) AS size + FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('i', 'r', 't') AND NOT n.nspname LIKE ANY($1) + GROUP BY c.relkind +), cache_hit AS ( + SELECT + 'i' AS relkind, + ROUND(SUM(idx_blks_hit)::numeric / nullif(SUM(idx_blks_hit + idx_blks_read), 0), 2) AS ratio + FROM pg_statio_user_indexes + WHERE NOT schemaname LIKE ANY($1) + UNION + SELECT + 't' AS relkind, + ROUND(SUM(heap_blks_hit)::numeric / nullif(SUM(heap_blks_hit + heap_blks_read), 0), 2) AS ratio + FROM pg_statio_user_tables + WHERE NOT schemaname LIKE ANY($1) +) +SELECT + pg_size_pretty(pg_database_size($2)) AS database_size, + (SELECT size FROM total_objects WHERE relkind = 'i') AS total_index_size, + (SELECT size FROM total_objects WHERE relkind = 'r') AS total_table_size, + (SELECT size FROM total_objects WHERE relkind = 't') AS total_toast_size, + (SELECT (now() - stats_reset)::text FROM pg_stat_statements_info) AS time_since_stats_reset, + (SELECT COALESCE(ratio::text, 'N/A') FROM cache_hit WHERE relkind = 'i') AS index_hit_rate, + (SELECT COALESCE(ratio::text, 'N/A') FROM cache_hit WHERE relkind = 't') AS table_hit_rate, + (SELECT pg_size_pretty(SUM(size)) FROM pg_ls_waldir()) AS wal_size diff --git a/internal/inspect/total_index_size/total_index_size_test.go b/internal/inspect/db_stats/db_stats_test.go similarity index 63% rename from internal/inspect/total_index_size/total_index_size_test.go rename to internal/inspect/db_stats/db_stats_test.go index 8eb0e0aa9..46b22efc8 100644 --- a/internal/inspect/total_index_size/total_index_size_test.go +++ b/internal/inspect/db_stats/db_stats_test.go @@ -1,4 +1,4 @@ -package total_index_size +package db_stats import ( "context" @@ -20,16 +20,23 @@ var dbConfig = pgconn.Config{ Database: "postgres", } -func TestTotalIndexSizeCommand(t *testing.T) { +func TestDBStatsCommand(t *testing.T) { t.Run("inspects size of all indexes", func(t *testing.T) { // Setup in-memory fs fsys := afero.NewMemMapFs() // Setup mock postgres conn := pgtest.NewConn() defer conn.Close(t) - conn.Query(TotalIndexSizeQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). + conn.Query(DBStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas), dbConfig.Database). Reply("SELECT 1", Result{ - Size: "8GB", + Database_size: "8GB", + Total_index_size: "8GB", + Total_table_size: "8GB", + Total_toast_size: "8GB", + Time_since_stats_reset: "8GB", + Index_hit_rate: "0.89", + Table_hit_rate: "0.98", + WAL_size: "8GB", }) // Run test err := Run(context.Background(), dbConfig, fsys, conn.Intercept) diff --git a/internal/inspect/index_sizes/index_sizes.sql b/internal/inspect/index_sizes/index_sizes.sql deleted file mode 100644 index 25b6f96d5..000000000 --- a/internal/inspect/index_sizes/index_sizes.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - n.nspname || '.' || c.relname AS name, - pg_size_pretty(sum(c.relpages::bigint*8192)::bigint) AS size -FROM pg_class c -LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) -WHERE NOT n.nspname LIKE ANY($1) -AND c.relkind = 'i' -GROUP BY n.nspname, c.relname -ORDER BY sum(c.relpages) DESC diff --git a/internal/inspect/index_sizes/index_sizes.go b/internal/inspect/index_stats/index_stats.go similarity index 64% rename from internal/inspect/index_sizes/index_sizes.go rename to internal/inspect/index_stats/index_stats.go index 2cfc06e8d..8f781c688 100644 --- a/internal/inspect/index_sizes/index_sizes.go +++ b/internal/inspect/index_stats/index_stats.go @@ -1,4 +1,4 @@ -package index_sizes +package index_stats import ( "context" @@ -15,12 +15,16 @@ import ( "github.com/supabase/cli/pkg/pgxv5" ) -//go:embed index_sizes.sql -var IndexSizesQuery string +//go:embed index_stats.sql +var IndexStatsQuery string type Result struct { - Name string - Size string + Name string + Size string + Percent_used string + Index_scans int64 + Seq_scans int64 + Unused bool } func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { @@ -29,7 +33,7 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, IndexSizesQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) + rows, err := conn.Query(ctx, IndexStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) if err != nil { return errors.Errorf("failed to query rows: %w", err) } @@ -38,9 +42,9 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } - table := "|Name|size|\n|-|-|\n" + table := "|Name|Size|Percent used|Index scans|Seq scans|Unused|\n|-|-|-|-|-|-|\n" for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|\n", r.Name, r.Size) + table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%d`|`%d`|`%t`|\n", r.Name, r.Size, r.Percent_used, r.Index_scans, r.Seq_scans, r.Unused) } return list.RenderTable(table) } diff --git a/internal/inspect/index_stats/index_stats.sql b/internal/inspect/index_stats/index_stats.sql new file mode 100644 index 000000000..c8d33e95d --- /dev/null +++ b/internal/inspect/index_stats/index_stats.sql @@ -0,0 +1,49 @@ +-- Combined index statistics: size, usage percent, seq scans, and mark unused +WITH idx_sizes AS ( + SELECT + i.indexrelid AS oid, + FORMAT('%I.%I', n.nspname, c.relname) AS name, + pg_relation_size(i.indexrelid) AS index_size_bytes + FROM pg_stat_user_indexes ui + JOIN pg_index i ON ui.indexrelid = i.indexrelid + JOIN pg_class c ON ui.indexrelid = c.oid + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE NOT n.nspname LIKE ANY($1) +), +idx_usage AS ( + SELECT + indexrelid AS oid, + idx_scan::bigint AS idx_scans + FROM pg_stat_user_indexes ui + WHERE NOT schemaname LIKE ANY($1) +), +seq_usage AS ( + SELECT + relid AS oid, + seq_scan::bigint AS seq_scans + FROM pg_stat_user_tables + WHERE NOT schemaname LIKE ANY($1) +), +usage_pct AS ( + SELECT + u.oid, + CASE + WHEN u.idx_scans IS NULL OR u.idx_scans = 0 THEN 0 + WHEN s.seq_scans IS NULL THEN 100 + ELSE ROUND(100.0 * u.idx_scans / (s.seq_scans + u.idx_scans), 1) + END AS percent_used + FROM idx_usage u + LEFT JOIN seq_usage s ON s.oid = u.oid +) +SELECT + s.name, + pg_size_pretty(s.index_size_bytes) AS size, + COALESCE(up.percent_used, 0)::text || '%' AS percent_used, + COALESCE(u.idx_scans, 0) AS index_scans, + COALESCE(sq.seq_scans, 0) AS seq_scans, + CASE WHEN COALESCE(u.idx_scans, 0) = 0 THEN true ELSE false END AS unused +FROM idx_sizes s +LEFT JOIN idx_usage u ON u.oid = s.oid +LEFT JOIN seq_usage sq ON sq.oid = s.oid +LEFT JOIN usage_pct up ON up.oid = s.oid +ORDER BY s.index_size_bytes DESC diff --git a/internal/inspect/index_sizes/index_sizes_test.go b/internal/inspect/index_stats/index_stats_test.go similarity index 63% rename from internal/inspect/index_sizes/index_sizes_test.go rename to internal/inspect/index_stats/index_stats_test.go index 9071c5710..abc3cd654 100644 --- a/internal/inspect/index_sizes/index_sizes_test.go +++ b/internal/inspect/index_stats/index_stats_test.go @@ -1,4 +1,4 @@ -package index_sizes +package index_stats import ( "context" @@ -20,21 +20,24 @@ var dbConfig = pgconn.Config{ Database: "postgres", } -func TestIndexSizes(t *testing.T) { - t.Run("inspects index sizes", func(t *testing.T) { - // Setup in-memory fs +func TestIndexStatsCommand(t *testing.T) { + t.Run("inspects index stats", func(t *testing.T) { fsys := afero.NewMemMapFs() - // Setup mock postgres conn := pgtest.NewConn() defer conn.Close(t) - conn.Query(IndexSizesQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). + + // Mock index stats + conn.Query(IndexStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). Reply("SELECT 1", Result{ - Name: "test_table_idx", - Size: "100GB", + Name: "public.test_idx", + Size: "1GB", + Percent_used: "50%", + Index_scans: 5, + Seq_scans: 5, + Unused: false, }) - // Run test + err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error assert.NoError(t, err) }) } diff --git a/internal/inspect/index_usage/index_usage.sql b/internal/inspect/index_usage/index_usage.sql deleted file mode 100644 index fa83e97db..000000000 --- a/internal/inspect/index_usage/index_usage.sql +++ /dev/null @@ -1,17 +0,0 @@ -SELECT - schemaname || '.' || relname AS name, - CASE - WHEN idx_scan IS NULL THEN 'Insufficient data' - WHEN idx_scan = 0 THEN 'Insufficient data' - ELSE ROUND(100.0 * idx_scan / (seq_scan + idx_scan), 1) || '%' - END percent_of_times_index_used, - n_live_tup rows_in_table -FROM pg_stat_user_tables -WHERE NOT schemaname LIKE ANY($1) -ORDER BY - CASE - WHEN idx_scan is null then 1 - WHEN idx_scan = 0 then 1 - ELSE 0 - END, - n_live_tup DESC diff --git a/internal/inspect/locks/locks.go b/internal/inspect/locks/locks.go index 0b2db71c6..be5c34d3a 100644 --- a/internal/inspect/locks/locks.go +++ b/internal/inspect/locks/locks.go @@ -23,7 +23,7 @@ type Result struct { Relname string Transactionid string Granted bool - Query string + Stmt string Age string } @@ -42,16 +42,16 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } - table := "|pid|relname|transaction id|granted|query|age|\n|-|-|-|-|-|-|\n" + table := "|pid|relname|transaction id|granted|stmt|age|\n|-|-|-|-|-|-|\n" for _, r := range result { // remove whitespace from query re := regexp.MustCompile(`\s+|\r+|\n+|\t+|\v`) - query := re.ReplaceAllString(r.Query, " ") + stmt := re.ReplaceAllString(r.Stmt, " ") // escape pipes in query re = regexp.MustCompile(`\|`) - query = re.ReplaceAllString(query, `\|`) - table += fmt.Sprintf("|`%d`|`%s`|`%s`|`%t`|%s|`%s`|\n", r.Pid, r.Relname, r.Transactionid, r.Granted, query, r.Age) + stmt = re.ReplaceAllString(stmt, `\|`) + table += fmt.Sprintf("|`%d`|`%s`|`%s`|`%t`|%s|`%s`|\n", r.Pid, r.Relname, r.Transactionid, r.Granted, stmt, r.Age) } return list.RenderTable(table) } diff --git a/internal/inspect/locks/locks.sql b/internal/inspect/locks/locks.sql index e140f4786..9369057b5 100644 --- a/internal/inspect/locks/locks.sql +++ b/internal/inspect/locks/locks.sql @@ -1,9 +1,9 @@ SELECT pg_stat_activity.pid, COALESCE(pg_class.relname, 'null') AS relname, - COALESCE(pg_locks.transactionid, 'null') AS transactionid, + COALESCE(pg_locks.transactionid::text, 'null') AS transactionid, pg_locks.granted, - pg_stat_activity.query, + pg_stat_activity.query AS stmt, age(now(), pg_stat_activity.query_start)::text AS age FROM pg_stat_activity, pg_locks LEFT OUTER JOIN pg_class ON (pg_locks.relation = pg_class.oid) WHERE pg_stat_activity.query <> '' diff --git a/internal/inspect/locks/locks_test.go b/internal/inspect/locks/locks_test.go index e4c55c6bd..0964ad122 100644 --- a/internal/inspect/locks/locks_test.go +++ b/internal/inspect/locks/locks_test.go @@ -31,7 +31,7 @@ func TestLocksCommand(t *testing.T) { Relname: "rel", Transactionid: "9301", Granted: true, - Query: "select 1", + Stmt: "select 1", Age: "300ms", }) // Run test diff --git a/internal/inspect/report.go b/internal/inspect/report.go index de721d954..e69e792b1 100644 --- a/internal/inspect/report.go +++ b/internal/inspect/report.go @@ -2,6 +2,7 @@ package inspect import ( "context" + "database/sql" "embed" "fmt" "io/fs" @@ -10,20 +11,26 @@ import ( "strings" "time" + "github.com/BurntSushi/toml" "github.com/go-errors/errors" "github.com/jackc/pgconn" "github.com/jackc/pgx/v4" + _ "github.com/mithrandie/csvq-driver" "github.com/spf13/afero" "github.com/supabase/cli/internal/db/reset" + "github.com/supabase/cli/internal/migration/list" "github.com/supabase/cli/internal/utils" ) //go:embed **/*.sql var queries embed.FS -func Report(ctx context.Context, out string, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - date := time.Now().Format("2006-01-02") - if err := utils.MkdirIfNotExistFS(fsys, out); err != nil { +func Report(ctx context.Context, outDir string, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { + outDir = filepath.Join(outDir, time.Now().Format("2006-01-02")) + if !filepath.IsAbs(outDir) { + outDir = filepath.Join(utils.CurrentDirAbs, outDir) + } + if err := utils.MkdirIfNotExistFS(fsys, outDir); err != nil { return err } conn, err := utils.ConnectByConfig(ctx, config, options...) @@ -44,19 +51,18 @@ func Report(ctx context.Context, out string, config pgconn.Config, fsys afero.Fs return errors.Errorf("failed to read query: %w", err) } name := strings.Split(d.Name(), ".")[0] - outPath := filepath.Join(out, fmt.Sprintf("%s_%s.csv", name, date)) - return copyToCSV(ctx, string(query), outPath, conn.PgConn(), fsys) + outPath := filepath.Join(outDir, fmt.Sprintf("%s.csv", name)) + return copyToCSV(ctx, string(query), config.Database, outPath, conn.PgConn(), fsys) }); err != nil { return err } - if !filepath.IsAbs(out) { - out, _ = filepath.Abs(out) - } - fmt.Fprintln(os.Stderr, "Reports saved to "+utils.Bold(out)) - return nil + fmt.Fprintln(os.Stderr, "Reports saved to "+utils.Bold(outDir)) + return printSummary(ctx, outDir) } -func copyToCSV(ctx context.Context, query, outPath string, conn *pgconn.PgConn, fsys afero.Fs) error { +var ignoreSchemas = fmt.Sprintf("'{%s}'::text[]", strings.Join(reset.LikeEscapeSchema(utils.InternalSchemas), ",")) + +func copyToCSV(ctx context.Context, query, database, outPath string, conn *pgconn.PgConn, fsys afero.Fs) error { // Create output file f, err := fsys.OpenFile(outPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { @@ -64,16 +70,56 @@ func copyToCSV(ctx context.Context, query, outPath string, conn *pgconn.PgConn, } defer f.Close() // Execute query - csvQuery := wrapQuery(query) + csvQuery := wrapQuery(query, ignoreSchemas, fmt.Sprintf("'%s'", database)) if _, err = conn.CopyTo(ctx, f, csvQuery); err != nil { return errors.Errorf("failed to copy output: %w", err) } return nil } -var ignoreSchemas = fmt.Sprintf("'{%s}'::text[]", strings.Join(reset.LikeEscapeSchema(utils.InternalSchemas), ",")) +func wrapQuery(query string, args ...string) string { + for i, v := range args { + query = strings.ReplaceAll(query, fmt.Sprintf("$%d", i+1), v) + } + return fmt.Sprintf("COPY (%s) TO STDOUT WITH CSV HEADER", query) +} + +//go:embed templates/rules.toml +var rulesConfig embed.FS -func wrapQuery(query string) string { - fullQuery := strings.ReplaceAll(query, "$1", ignoreSchemas) - return fmt.Sprintf("COPY (%s) TO STDOUT WITH CSV HEADER", fullQuery) +func printSummary(ctx context.Context, outDir string) error { + if len(utils.Config.Experimental.Inspect.Rules) == 0 { + fmt.Fprintln(os.Stderr, "Loading default rules...") + if _, err := toml.DecodeFS(rulesConfig, "templates/rules.toml", &utils.Config.Experimental.Inspect); err != nil { + return errors.Errorf("failed load default rules: %w", err) + } + } + // Open csvq database rooted at the output directory + db, err := sql.Open("csvq", outDir) + if err != nil { + return err + } + defer db.Close() + // Build report summary table + table := "RULE|STATUS|MATCHES\n|-|-|-|\n" + for _, r := range utils.Config.Experimental.Inspect.Rules { + row := db.QueryRowContext(ctx, r.Query) + // find matching rule + var status string + var match sql.NullString + if err := row.Scan(&match); errors.Is(err, sql.ErrNoRows) { + status = r.Pass + } else if err != nil { + status = err.Error() + } else if !match.Valid || match.String == "" { + status = r.Pass + } else { + status = r.Fail + } + if !match.Valid { + match.String = "-" + } + table += fmt.Sprintf("|`%s`|`%s`|`%s`|\n", r.Name, status, match.String) + } + return list.RenderTable(table) } diff --git a/internal/inspect/report_test.go b/internal/inspect/report_test.go index 6b4220451..dd0b61d09 100644 --- a/internal/inspect/report_test.go +++ b/internal/inspect/report_test.go @@ -3,31 +3,13 @@ package inspect import ( "context" "fmt" + "io/fs" "testing" "github.com/jackc/pgconn" "github.com/spf13/afero" "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/inspect/bloat" - "github.com/supabase/cli/internal/inspect/blocking" - "github.com/supabase/cli/internal/inspect/cache" - "github.com/supabase/cli/internal/inspect/calls" - "github.com/supabase/cli/internal/inspect/index_sizes" - "github.com/supabase/cli/internal/inspect/index_usage" - "github.com/supabase/cli/internal/inspect/locks" - "github.com/supabase/cli/internal/inspect/long_running_queries" - "github.com/supabase/cli/internal/inspect/outliers" - "github.com/supabase/cli/internal/inspect/replication_slots" - "github.com/supabase/cli/internal/inspect/role_configs" - "github.com/supabase/cli/internal/inspect/role_connections" - "github.com/supabase/cli/internal/inspect/seq_scans" - "github.com/supabase/cli/internal/inspect/table_index_sizes" - "github.com/supabase/cli/internal/inspect/table_record_counts" - "github.com/supabase/cli/internal/inspect/table_sizes" - "github.com/supabase/cli/internal/inspect/total_index_size" - "github.com/supabase/cli/internal/inspect/total_table_sizes" - "github.com/supabase/cli/internal/inspect/unused_indexes" - "github.com/supabase/cli/internal/inspect/vacuum_stats" + "github.com/stretchr/testify/require" "github.com/supabase/cli/pkg/pgtest" ) @@ -41,58 +23,25 @@ var dbConfig = pgconn.Config{ func TestReportCommand(t *testing.T) { t.Run("runs all queries", func(t *testing.T) { - // Setup in-memory fs fsys := afero.NewMemMapFs() // Setup mock postgres conn := pgtest.NewConn() defer conn.Close(t) - conn.Query(wrapQuery(bloat.BloatQuery)). - Reply("COPY 0"). - Query(wrapQuery(blocking.BlockingQuery)). - Reply("COPY 0"). - Query(wrapQuery(cache.CacheQuery)). - Reply("COPY 0"). - Query(wrapQuery(calls.CallsQuery)). - Reply("COPY 0"). - Query(wrapQuery(index_sizes.IndexSizesQuery)). - Reply("COPY 0"). - Query(wrapQuery(index_usage.IndexUsageQuery)). - Reply("COPY 0"). - Query(wrapQuery(locks.LocksQuery)). - Reply("COPY 0"). - Query(wrapQuery(long_running_queries.LongRunningQueriesQuery)). - Reply("COPY 0"). - Query(wrapQuery(outliers.OutliersQuery)). - Reply("COPY 0"). - Query(wrapQuery(replication_slots.ReplicationSlotsQuery)). - Reply("COPY 0"). - Query(wrapQuery(role_configs.RoleConfigsQuery)). - Reply("COPY 0"). - Query(wrapQuery(role_connections.RoleConnectionsQuery)). - Reply("COPY 0"). - Query(wrapQuery(seq_scans.SeqScansQuery)). - Reply("COPY 0"). - Query(wrapQuery(table_index_sizes.TableIndexSizesQuery)). - Reply("COPY 0"). - Query(wrapQuery(table_record_counts.TableRecordCountsQuery)). - Reply("COPY 0"). - Query(wrapQuery(table_sizes.TableSizesQuery)). - Reply("COPY 0"). - Query(wrapQuery(total_index_size.TotalIndexSizeQuery)). - Reply("COPY 0"). - Query(wrapQuery(total_table_sizes.TotalTableSizesQuery)). - Reply("COPY 0"). - Query(wrapQuery(unused_indexes.UnusedIndexesQuery)). - Reply("COPY 0"). - Query(wrapQuery(vacuum_stats.VacuumStatsQuery)). - Reply("COPY 0") + // Iterate over all embedded SQL files + sqlPaths, err := fs.Glob(queries, "*/*.sql") + require.NoError(t, err) + for _, fp := range sqlPaths { + data, err := queries.ReadFile(fp) + require.NoError(t, err) + sql := wrapQuery(string(data), ignoreSchemas, fmt.Sprintf("'%s'", dbConfig.Database)) + conn.Query(sql).Reply("COPY 0") + } // Run test - err := Report(context.Background(), ".", dbConfig, fsys, conn.Intercept) - // Check error + err = Report(context.Background(), ".", dbConfig, fsys, conn.Intercept) assert.NoError(t, err) - matches, err := afero.Glob(fsys, "*.csv") + matches, err := afero.Glob(fsys, "*/*.csv") assert.NoError(t, err) - assert.Len(t, matches, 20) + assert.Len(t, matches, len(sqlPaths)) }) } @@ -107,7 +56,7 @@ func TestWrapQuery(t *testing.T) { t.Run("replaces placeholder value", func(t *testing.T) { assert.Equal(t, fmt.Sprintf("COPY (SELECT 'a' LIKE ANY(%s)) TO STDOUT WITH CSV HEADER", ignoreSchemas), - wrapQuery("SELECT 'a' LIKE ANY($1)"), + wrapQuery("SELECT 'a' LIKE ANY($1)", ignoreSchemas), ) }) } diff --git a/internal/inspect/role_configs/role_configs.sql b/internal/inspect/role_configs/role_configs.sql deleted file mode 100644 index fd7f964d0..000000000 --- a/internal/inspect/role_configs/role_configs.sql +++ /dev/null @@ -1,5 +0,0 @@ -select - rolname as role_name, - array_to_string(rolconfig, ',', '*') as custom_config -from - pg_roles where rolconfig is not null diff --git a/internal/inspect/role_configs/role_configs_test.go b/internal/inspect/role_configs/role_configs_test.go deleted file mode 100644 index 554a12526..000000000 --- a/internal/inspect/role_configs/role_configs_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package role_configs - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestRoleCommand(t *testing.T) { - t.Run("inspects role connections", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(RoleConfigsQuery). - Reply("SELECT 1", Result{ - Role_name: "postgres", - Custom_config: "statement_timeout=3s", - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/role_connections/role_connections.go b/internal/inspect/role_connections/role_connections.go deleted file mode 100644 index 5b0a56539..000000000 --- a/internal/inspect/role_connections/role_connections.go +++ /dev/null @@ -1,62 +0,0 @@ -package role_connections - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed role_connections.sql -var RoleConnectionsQuery string - -type Result struct { - Rolname string - Active_connections int - Connection_limit int -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, RoleConnectionsQuery) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "|Role Name|Active connction|\n|-|-|\n" - sum := 0 - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%d`|\n", r.Rolname, r.Active_connections) - sum += r.Active_connections - } - - if err := list.RenderTable(table); err != nil { - return err - } - - if len(result) > 0 { - fmt.Printf("\nActive connections %d/%d\n\n", sum, result[0].Connection_limit) - } - - if matches := utils.ProjectHostPattern.FindStringSubmatch(config.Host); len(matches) == 4 { - fmt.Println("Go to the dashboard for more here:") - fmt.Printf("https://app.supabase.com/project/%s/database/roles\n", matches[2]) - } - - return nil -} diff --git a/internal/inspect/role_configs/role_configs.go b/internal/inspect/role_stats/role_stats.go similarity index 64% rename from internal/inspect/role_configs/role_configs.go rename to internal/inspect/role_stats/role_stats.go index f4fb79382..ee5e724f2 100644 --- a/internal/inspect/role_configs/role_configs.go +++ b/internal/inspect/role_stats/role_stats.go @@ -1,4 +1,4 @@ -package role_configs +package role_stats import ( "context" @@ -14,12 +14,14 @@ import ( "github.com/supabase/cli/pkg/pgxv5" ) -//go:embed role_configs.sql -var RoleConfigsQuery string +//go:embed role_stats.sql +var RoleStatsQuery string type Result struct { - Role_name string - Custom_config string + Role_name string + Active_connections int + Connection_limit int + Custom_config string } func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { @@ -28,7 +30,7 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, RoleConfigsQuery) + rows, err := conn.Query(ctx, RoleStatsQuery) if err != nil { return errors.Errorf("failed to query rows: %w", err) } @@ -37,9 +39,9 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } - table := "|Role name|Custom config|\n|-|-|\n" + table := "|Role name|Active connections|Connection limit|Custom config|\n|-|-|-|-|\n" for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|\n", r.Role_name, r.Custom_config) + table += fmt.Sprintf("|`%s`|`%d`|`%d`|`%s`|\n", r.Role_name, r.Active_connections, r.Connection_limit, r.Custom_config) } return list.RenderTable(table) diff --git a/internal/inspect/role_connections/role_connections.sql b/internal/inspect/role_stats/role_stats.sql similarity index 64% rename from internal/inspect/role_connections/role_connections.sql rename to internal/inspect/role_stats/role_stats.sql index 40b103669..92f32c9e5 100644 --- a/internal/inspect/role_connections/role_connections.sql +++ b/internal/inspect/role_stats/role_stats.sql @@ -1,5 +1,5 @@ SELECT - rolname, + rolname as role_name, ( SELECT count(*) @@ -11,6 +11,8 @@ SELECT CASE WHEN rolconnlimit = -1 THEN current_setting('max_connections')::int8 ELSE rolconnlimit - END AS connection_limit -FROM pg_roles -ORDER BY 2 DESC + END AS connection_limit, + array_to_string(rolconfig, ',', '*') as custom_config +FROM + pg_roles +ORDER BY 1 DESC diff --git a/internal/inspect/role_connections/role_connections_test.go b/internal/inspect/role_stats/role_stats_test.go similarity index 84% rename from internal/inspect/role_connections/role_connections_test.go rename to internal/inspect/role_stats/role_stats_test.go index 32ecab768..0539c594f 100644 --- a/internal/inspect/role_connections/role_connections_test.go +++ b/internal/inspect/role_stats/role_stats_test.go @@ -1,4 +1,4 @@ -package role_connections +package role_stats import ( "context" @@ -25,9 +25,10 @@ func TestRoleCommand(t *testing.T) { // Setup mock postgres conn := pgtest.NewConn() defer conn.Close(t) - conn.Query(RoleConnectionsQuery). + conn.Query(RoleStatsQuery). Reply("SELECT 1", Result{ - Rolname: "postgres", + Role_name: "postgres", + Custom_config: "statement_timeout=3s", Active_connections: 1, Connection_limit: 10, }) diff --git a/internal/inspect/seq_scans/seq_scans.go b/internal/inspect/seq_scans/seq_scans.go deleted file mode 100644 index 6b52538ee..000000000 --- a/internal/inspect/seq_scans/seq_scans.go +++ /dev/null @@ -1,46 +0,0 @@ -package seq_scans - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed seq_scans.sql -var SeqScansQuery string - -type Result struct { - Name string - Count int64 -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, SeqScansQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "|Name|Count|\n|-|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%d`|\n", r.Name, r.Count) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/seq_scans/seq_scans.sql b/internal/inspect/seq_scans/seq_scans.sql deleted file mode 100644 index c8edfc8e3..000000000 --- a/internal/inspect/seq_scans/seq_scans.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - schemaname || '.' || relname AS name, - seq_scan as count -FROM pg_stat_user_tables -WHERE NOT schemaname LIKE ANY($1) -ORDER BY seq_scan DESC diff --git a/internal/inspect/seq_scans/seq_scans_test.go b/internal/inspect/seq_scans/seq_scans_test.go deleted file mode 100644 index 3db6caee5..000000000 --- a/internal/inspect/seq_scans/seq_scans_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package seq_scans - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestSequentialScansCommand(t *testing.T) { - t.Run("inspects sequential scans", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(SeqScansQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). - Reply("SELECT 1", Result{ - Name: "test_table", - Count: 99999, - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/table_index_sizes/table_index_sizes.go b/internal/inspect/table_index_sizes/table_index_sizes.go deleted file mode 100644 index e61f23361..000000000 --- a/internal/inspect/table_index_sizes/table_index_sizes.go +++ /dev/null @@ -1,46 +0,0 @@ -package table_index_sizes - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed table_index_sizes.sql -var TableIndexSizesQuery string - -type Result struct { - Table string - Index_size string -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, TableIndexSizesQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "|Table|Index size|\n|-|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|\n", r.Table, r.Index_size) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/table_index_sizes/table_index_sizes.sql b/internal/inspect/table_index_sizes/table_index_sizes.sql deleted file mode 100644 index 0c9bc6bfc..000000000 --- a/internal/inspect/table_index_sizes/table_index_sizes.sql +++ /dev/null @@ -1,8 +0,0 @@ -SELECT - n.nspname || '.' || c.relname AS table, - pg_size_pretty(pg_indexes_size(c.oid)) AS index_size -FROM pg_class c -LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) -WHERE NOT n.nspname LIKE ANY($1) -AND c.relkind = 'r' -ORDER BY pg_indexes_size(c.oid) DESC diff --git a/internal/inspect/table_index_sizes/table_index_sizes_test.go b/internal/inspect/table_index_sizes/table_index_sizes_test.go deleted file mode 100644 index 20ad80fc9..000000000 --- a/internal/inspect/table_index_sizes/table_index_sizes_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package table_index_sizes - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestTableIndexSizesCommand(t *testing.T) { - t.Run("inspects table index sizes", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(TableIndexSizesQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). - Reply("SELECT 1", Result{ - Table: "public.test_table", - Index_size: "3GB", - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/table_record_counts/table_record_counts.go b/internal/inspect/table_record_counts/table_record_counts.go deleted file mode 100644 index e0b394374..000000000 --- a/internal/inspect/table_record_counts/table_record_counts.go +++ /dev/null @@ -1,47 +0,0 @@ -package table_record_counts - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed table_record_counts.sql -var TableRecordCountsQuery string - -type Result struct { - Schema string - Name string - Estimated_count int64 -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, TableRecordCountsQuery, reset.LikeEscapeSchema(utils.PgSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "Schema|Table|Estimated count|\n|-|-|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%d`|\n", r.Schema, r.Name, r.Estimated_count) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/table_record_counts/table_record_counts.sql b/internal/inspect/table_record_counts/table_record_counts.sql deleted file mode 100644 index 1b24f04a4..000000000 --- a/internal/inspect/table_record_counts/table_record_counts.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT - schemaname AS schema, - relname AS name, - n_live_tup AS estimated_count -FROM pg_stat_user_tables -WHERE NOT schemaname LIKE ANY($1) -ORDER BY n_live_tup DESC diff --git a/internal/inspect/table_record_counts/table_record_counts_test.go b/internal/inspect/table_record_counts/table_record_counts_test.go deleted file mode 100644 index a03714d97..000000000 --- a/internal/inspect/table_record_counts/table_record_counts_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package table_record_counts - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestTableRecordCountsCommand(t *testing.T) { - t.Run("inspects table record counts", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(TableRecordCountsQuery, reset.LikeEscapeSchema(utils.PgSchemas)). - Reply("SELECT 1", Result{ - Schema: "public", - Name: "test_table", - Estimated_count: 100, - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/table_sizes/table_sizes.go b/internal/inspect/table_sizes/table_sizes.go deleted file mode 100644 index 7741f0119..000000000 --- a/internal/inspect/table_sizes/table_sizes.go +++ /dev/null @@ -1,47 +0,0 @@ -package table_sizes - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed table_sizes.sql -var TableSizesQuery string - -type Result struct { - Schema string - Name string - Size string -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, TableSizesQuery, reset.LikeEscapeSchema(utils.PgSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "Schema|Table|size|\n|-|-|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%s`|\n", r.Schema, r.Name, r.Size) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/table_sizes/table_sizes.sql b/internal/inspect/table_sizes/table_sizes.sql deleted file mode 100644 index 2c8fb3064..000000000 --- a/internal/inspect/table_sizes/table_sizes.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - n.nspname AS schema, - c.relname AS name, - pg_size_pretty(pg_table_size(c.oid)) AS size -FROM pg_class c -LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) -WHERE NOT n.nspname LIKE ANY($1) -AND c.relkind = 'r' -ORDER BY pg_table_size(c.oid) DESC diff --git a/internal/inspect/table_sizes/table_sizes_test.go b/internal/inspect/table_sizes/table_sizes_test.go deleted file mode 100644 index 5cc6426ad..000000000 --- a/internal/inspect/table_sizes/table_sizes_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package table_sizes - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestTableSizesCommand(t *testing.T) { - t.Run("inspects table sizes", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(TableSizesQuery, reset.LikeEscapeSchema(utils.PgSchemas)). - Reply("SELECT 1", Result{ - Schema: "schema", - Name: "test_table", - Size: "3GB", - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/index_usage/index_usage.go b/internal/inspect/table_stats/table_stats.go similarity index 60% rename from internal/inspect/index_usage/index_usage.go rename to internal/inspect/table_stats/table_stats.go index cd8875f79..afc3b193b 100644 --- a/internal/inspect/index_usage/index_usage.go +++ b/internal/inspect/table_stats/table_stats.go @@ -1,4 +1,4 @@ -package index_usage +package table_stats import ( "context" @@ -15,13 +15,16 @@ import ( "github.com/supabase/cli/pkg/pgxv5" ) -//go:embed index_usage.sql -var IndexUsageQuery string +//go:embed table_stats.sql +var TableStatsQuery string type Result struct { - Name string - Percent_of_times_index_used string - Rows_in_table int64 + Name string + Table_size string + Index_size string + Total_size string + Estimated_row_count int64 + Seq_scans int64 } func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { @@ -30,7 +33,7 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, IndexUsageQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) + rows, err := conn.Query(ctx, TableStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) if err != nil { return errors.Errorf("failed to query rows: %w", err) } @@ -38,10 +41,10 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu if err != nil { return err } - // TODO: implement a markdown table marshaller - table := "|Table name|Percentage of times index used|Rows in table|\n|-|-|-|\n" + + table := "|Name|Table size|Index size|Total size|Estimated row count|Seq scans|\n|-|-|-|-|-|-|\n" for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%d`|\n", r.Name, r.Percent_of_times_index_used, r.Rows_in_table) + table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%s`|`%d`|`%d`|\n", r.Name, r.Table_size, r.Index_size, r.Total_size, r.Estimated_row_count, r.Seq_scans) } return list.RenderTable(table) } diff --git a/internal/inspect/table_stats/table_stats.sql b/internal/inspect/table_stats/table_stats.sql new file mode 100644 index 000000000..bcc22b29d --- /dev/null +++ b/internal/inspect/table_stats/table_stats.sql @@ -0,0 +1,27 @@ +SELECT + ts.name, + pg_size_pretty(ts.table_size_bytes) AS table_size, + pg_size_pretty(ts.index_size_bytes) AS index_size, + pg_size_pretty(ts.total_size_bytes) AS total_size, + COALESCE(rc.estimated_row_count, 0) AS estimated_row_count, + COALESCE(rc.seq_scans, 0) AS seq_scans +FROM ( + SELECT + FORMAT('%I.%I', n.nspname, c.relname) AS name, + pg_table_size(c.oid) AS table_size_bytes, + pg_indexes_size(c.oid) AS index_size_bytes, + pg_total_relation_size(c.oid) AS total_size_bytes + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE NOT n.nspname LIKE ANY($1) + AND c.relkind = 'r' +) ts +LEFT JOIN ( + SELECT + FORMAT('%I.%I', schemaname, relname) AS name, + n_live_tup AS estimated_row_count, + seq_scan AS seq_scans + FROM pg_stat_user_tables + WHERE NOT schemaname LIKE ANY($1) +) rc ON rc.name = ts.name +ORDER BY ts.total_size_bytes DESC diff --git a/internal/inspect/index_usage/index_usage_test.go b/internal/inspect/table_stats/table_stats_test.go similarity index 59% rename from internal/inspect/index_usage/index_usage_test.go rename to internal/inspect/table_stats/table_stats_test.go index 5b735bb60..087641029 100644 --- a/internal/inspect/index_usage/index_usage_test.go +++ b/internal/inspect/table_stats/table_stats_test.go @@ -1,4 +1,4 @@ -package index_usage +package table_stats import ( "context" @@ -20,22 +20,24 @@ var dbConfig = pgconn.Config{ Database: "postgres", } -func TestIndexUsage(t *testing.T) { - t.Run("inspects index usage", func(t *testing.T) { - // Setup in-memory fs +func TestTableStatsCommand(t *testing.T) { + t.Run("inspects table stats", func(t *testing.T) { fsys := afero.NewMemMapFs() - // Setup mock postgres conn := pgtest.NewConn() defer conn.Close(t) - conn.Query(IndexUsageQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). + + // Mock table sizes and index sizes + conn.Query(TableStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). Reply("SELECT 1", Result{ - Name: "test_table_idx", - Percent_of_times_index_used: "0.9", - Rows_in_table: 300, + Name: "public.test_table", + Table_size: "3GB", + Index_size: "1GB", + Total_size: "4GB", + Estimated_row_count: 100, + Seq_scans: 1, }) - // Run test + err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error assert.NoError(t, err) }) } diff --git a/internal/inspect/templates/rules.toml b/internal/inspect/templates/rules.toml new file mode 100644 index 000000000..2597ee720 --- /dev/null +++ b/internal/inspect/templates/rules.toml @@ -0,0 +1,43 @@ +# Rules to validate CSV report files + +[[rules]] +query = "SELECT LISTAGG(stmt, ',') AS match FROM `locks.csv` WHERE age > '00:02:00'" +name = "No old locks" +pass = "✔" +fail = "There is at least one lock older than 2 minutes" + +[[rules]] +query = "SELECT LISTAGG(stmt, ',') AS match FROM `locks.csv` WHERE granted = 'f'" +name = "No ungranted locks" +pass = "✔" +fail = "There is at least one ungranted lock" + +[[rules]] +query = "SELECT LISTAGG(index, ',') AS match FROM `unused_indexes.csv`" +name = "No unused indexes" +pass = "✔" +fail = "There is at least one unused index" + +[[rules]] +query = "SELECT LISTAGG(name, ',') AS match FROM `db_stats.csv` WHERE index_hit_rate < 0.94 OR table_hit_rate < 0.94" +name = "Check cache hit is within acceptable bounds" +pass = "✔" +fail = "There is a cache hit ratio (table or index) below 94%" + +[[rules]] +query = "SELECT LISTAGG(t.name, ',') AS match FROM `table_stats.csv` t WHERE t.seq_scans > t.estimated_row_count * 0.1 AND t.estimated_row_count > 1000;" +name = "No large tables with sequential scans more than 10% of rows" +pass = "✔" +fail = "At least one table is showing sequential scans more than 10% of total row count" + +[[rules]] +query = "SELECT LISTAGG(s.tbl, ',') AS match FROM `vacuum_stats.csv` s WHERE s.expect_autovacuum = 'yes' and s.rowcount > 1000;" +name = "No large tables waiting on autovacuum" +pass = "✔" +fail = "At least one table is waiting on autovacuum" + +[[rules]] +query = "SELECT LISTAGG(s.name, ',') AS match FROM `vacuum_stats.csv` s WHERE s.rowcount > 0 AND (s.last_autovacuum = '' OR s.last_vacuum = '');" +name = "No tables yet to be vacuumed" +pass = "✔" +fail = "At least one table has never had autovacuum or vacuum run on it" diff --git a/internal/inspect/total_index_size/total_index_size.go b/internal/inspect/total_index_size/total_index_size.go deleted file mode 100644 index fbc66b259..000000000 --- a/internal/inspect/total_index_size/total_index_size.go +++ /dev/null @@ -1,45 +0,0 @@ -package total_index_size - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed total_index_size.sql -var TotalIndexSizeQuery string - -type Result struct { - Size string -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, TotalIndexSizeQuery, reset.LikeEscapeSchema(utils.InternalSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "|Size|\n|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|\n", r.Size) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/total_index_size/total_index_size.sql b/internal/inspect/total_index_size/total_index_size.sql deleted file mode 100644 index d1e8ab3d8..000000000 --- a/internal/inspect/total_index_size/total_index_size.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - pg_size_pretty(sum(c.relpages::bigint*8192)::bigint) AS size -FROM pg_class c -LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) -WHERE NOT n.nspname LIKE ANY($1) -AND c.relkind = 'i' diff --git a/internal/inspect/total_table_sizes/total_table_sizes.go b/internal/inspect/total_table_sizes/total_table_sizes.go deleted file mode 100644 index 80b1c89a8..000000000 --- a/internal/inspect/total_table_sizes/total_table_sizes.go +++ /dev/null @@ -1,47 +0,0 @@ -package total_table_sizes - -import ( - "context" - _ "embed" - "fmt" - - "github.com/go-errors/errors" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" - "github.com/spf13/afero" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/migration/list" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgxv5" -) - -//go:embed total_table_sizes.sql -var TotalTableSizesQuery string - -type Result struct { - Schema string - Name string - Size string -} - -func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectByConfig(ctx, config, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - rows, err := conn.Query(ctx, TotalTableSizesQuery, reset.LikeEscapeSchema(utils.PgSchemas)) - if err != nil { - return errors.Errorf("failed to query rows: %w", err) - } - result, err := pgxv5.CollectRows[Result](rows) - if err != nil { - return err - } - - table := "Schema|Table|Size|\n|-|-|-|\n" - for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%s`|\n", r.Schema, r.Name, r.Size) - } - return list.RenderTable(table) -} diff --git a/internal/inspect/total_table_sizes/total_table_sizes.sql b/internal/inspect/total_table_sizes/total_table_sizes.sql deleted file mode 100644 index 471d0655f..000000000 --- a/internal/inspect/total_table_sizes/total_table_sizes.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - n.nspname AS schema, - c.relname AS name, - pg_size_pretty(pg_total_relation_size(c.oid)) AS size -FROM pg_class c -LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) -WHERE NOT n.nspname LIKE ANY($1) -AND c.relkind = 'r' -ORDER BY pg_total_relation_size(c.oid) DESC diff --git a/internal/inspect/total_table_sizes/total_table_sizes_test.go b/internal/inspect/total_table_sizes/total_table_sizes_test.go deleted file mode 100644 index bc548af60..000000000 --- a/internal/inspect/total_table_sizes/total_table_sizes_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package total_table_sizes - -import ( - "context" - "testing" - - "github.com/jackc/pgconn" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/supabase/cli/internal/db/reset" - "github.com/supabase/cli/internal/utils" - "github.com/supabase/cli/pkg/pgtest" -) - -var dbConfig = pgconn.Config{ - Host: "127.0.0.1", - Port: 5432, - User: "admin", - Password: "password", - Database: "postgres", -} - -func TestTotalTableSizesCommand(t *testing.T) { - t.Run("inspects total table sizes", func(t *testing.T) { - // Setup in-memory fs - fsys := afero.NewMemMapFs() - // Setup mock postgres - conn := pgtest.NewConn() - defer conn.Close(t) - conn.Query(TotalTableSizesQuery, reset.LikeEscapeSchema(utils.PgSchemas)). - Reply("SELECT 1", Result{ - Schema: "public", - Name: "test_table", - Size: "3GB", - }) - // Run test - err := Run(context.Background(), dbConfig, fsys, conn.Intercept) - // Check error - assert.NoError(t, err) - }) -} diff --git a/internal/inspect/unused_indexes/unused_indexes.go b/internal/inspect/unused_indexes/unused_indexes.go index 2a30a46d7..bfbbf523a 100644 --- a/internal/inspect/unused_indexes/unused_indexes.go +++ b/internal/inspect/unused_indexes/unused_indexes.go @@ -19,7 +19,7 @@ import ( var UnusedIndexesQuery string type Result struct { - Table string + Name string Index string Index_size string Index_scans int64 @@ -42,7 +42,7 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu table := "|Table|Index|Index Size|Index Scans\n|-|-|-|-|\n" for _, r := range result { - table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%d`|\n", r.Table, r.Index, r.Index_size, r.Index_scans) + table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%d`|\n", r.Name, r.Index, r.Index_size, r.Index_scans) } return list.RenderTable(table) } diff --git a/internal/inspect/unused_indexes/unused_indexes.sql b/internal/inspect/unused_indexes/unused_indexes.sql index 6e775967d..aa429b9ed 100644 --- a/internal/inspect/unused_indexes/unused_indexes.sql +++ b/internal/inspect/unused_indexes/unused_indexes.sql @@ -1,5 +1,5 @@ SELECT - schemaname || '.' || relname AS table, + FORMAT('%I.%I', schemaname, relname) AS name, indexrelname AS index, pg_size_pretty(pg_relation_size(i.indexrelid)) AS index_size, idx_scan as index_scans diff --git a/internal/inspect/unused_indexes/unused_indexes_test.go b/internal/inspect/unused_indexes/unused_indexes_test.go index ee4182094..517f88c61 100644 --- a/internal/inspect/unused_indexes/unused_indexes_test.go +++ b/internal/inspect/unused_indexes/unused_indexes_test.go @@ -29,7 +29,7 @@ func TestUnusedIndexesCommand(t *testing.T) { defer conn.Close(t) conn.Query(UnusedIndexesQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). Reply("SELECT 1", Result{ - Table: "test_table", + Name: "public.test_table", Index: "test_table_idx", Index_size: "3GB", Index_scans: 2, diff --git a/internal/inspect/vacuum_stats/vacuum_stats.go b/internal/inspect/vacuum_stats/vacuum_stats.go index dc9326d79..8b3669879 100644 --- a/internal/inspect/vacuum_stats/vacuum_stats.go +++ b/internal/inspect/vacuum_stats/vacuum_stats.go @@ -20,8 +20,7 @@ import ( var VacuumStatsQuery string type Result struct { - Schema string - Table string + Name string Last_vacuum string Last_autovacuum string Rowcount string @@ -45,10 +44,10 @@ func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...fu return err } - table := "|Schema|Table|Last Vacuum|Last Auto Vacuum|Row count|Dead row count|Expect autovacuum?\n|-|-|-|-|-|-|-|\n" + table := "|Table|Last Vacuum|Last Auto Vacuum|Row count|Dead row count|Expect autovacuum?\n|-|-|-|-|-|-|\n" for _, r := range result { rowcount := strings.Replace(r.Rowcount, "-1", "No stats", 1) - table += fmt.Sprintf("|`%s`|`%s`|%s|%s|`%s`|`%s`|`%s`|\n", r.Schema, r.Table, r.Last_vacuum, r.Last_autovacuum, rowcount, r.Dead_rowcount, r.Expect_autovacuum) + table += fmt.Sprintf("|`%s`|%s|%s|`%s`|`%s`|`%s`|\n", r.Name, r.Last_vacuum, r.Last_autovacuum, rowcount, r.Dead_rowcount, r.Expect_autovacuum) } return list.RenderTable(table) } diff --git a/internal/inspect/vacuum_stats/vacuum_stats.sql b/internal/inspect/vacuum_stats/vacuum_stats.sql index 707847497..534fa4e64 100644 --- a/internal/inspect/vacuum_stats/vacuum_stats.sql +++ b/internal/inspect/vacuum_stats/vacuum_stats.sql @@ -20,8 +20,7 @@ WITH table_opts AS ( table_opts ) SELECT - vacuum_settings.nspname AS schema, - vacuum_settings.relname AS table, + FORMAT('%I.%I', vacuum_settings.nspname, vacuum_settings.relname) AS name, coalesce(to_char(psut.last_vacuum, 'YYYY-MM-DD HH24:MI'), '') AS last_vacuum, coalesce(to_char(psut.last_autovacuum, 'YYYY-MM-DD HH24:MI'), '') AS last_autovacuum, to_char(pg_class.reltuples, '9G999G999G999') AS rowcount, diff --git a/internal/inspect/vacuum_stats/vacuum_stats_test.go b/internal/inspect/vacuum_stats/vacuum_stats_test.go index 0d3cbec10..7872567b3 100644 --- a/internal/inspect/vacuum_stats/vacuum_stats_test.go +++ b/internal/inspect/vacuum_stats/vacuum_stats_test.go @@ -29,8 +29,7 @@ func TestVacuumCommand(t *testing.T) { defer conn.Close(t) conn.Query(VacuumStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas)). Reply("SELECT 1", Result{ - Schema: "test_schema", - Table: "test_table", + Name: "test_schema.test_table", Last_vacuum: "2021-01-01 00:00:00", Last_autovacuum: "2021-01-01 00:00:00", Rowcount: "1000", diff --git a/pkg/config/config.go b/pkg/config/config.go index c6edda1b7..75bf61fcd 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -247,6 +247,17 @@ type ( Enabled bool `toml:"enabled"` } + inspect struct { + Rules []rule `toml:"rules"` + } + + rule struct { + Query string `toml:"query"` + Name string `toml:"name"` + Pass string `toml:"pass"` + Fail string `toml:"fail"` + } + experimental struct { OrioleDBVersion string `toml:"orioledb_version"` S3Host string `toml:"s3_host"` @@ -254,6 +265,7 @@ type ( S3AccessKey string `toml:"s3_access_key"` S3SecretKey string `toml:"s3_secret_key"` Webhooks *webhooks `toml:"webhooks"` + Inspect inspect `toml:"inspect"` } ) From 86b9b7dea330f66d1d20110b1367e5d883b3277d Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Wed, 18 Jun 2025 08:18:05 +0200 Subject: [PATCH 05/40] chore: sync API types from infrastructure (#3728) Co-authored-by: sweatybridge <1639722+sweatybridge@users.noreply.github.com> --- pkg/api/client.gen.go | 1422 +++++++++++++++++++++++++++++++++++++---- pkg/api/types.gen.go | 174 ++++- 2 files changed, 1466 insertions(+), 130 deletions(-) diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index b5659e914..0527d078a 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -122,6 +122,9 @@ type ClientInterface interface { // V1AuthorizeUser request V1AuthorizeUser(ctx context.Context, params *V1AuthorizeUserParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1OauthAuthorizeProjectClaim request + V1OauthAuthorizeProjectClaim(ctx context.Context, params *V1OauthAuthorizeProjectClaimParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1RevokeTokenWithBody request with any body V1RevokeTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -146,6 +149,12 @@ type ClientInterface interface { // V1ListOrganizationMembers request V1ListOrganizationMembers(ctx context.Context, slug string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetOrganizationProjectClaim request + V1GetOrganizationProjectClaim(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1ClaimProjectForOrganization request + V1ClaimProjectForOrganization(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1ListAllProjects request V1ListAllProjects(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -164,7 +173,7 @@ type ClientInterface interface { GetPerformanceAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetSecurityAdvisors request - GetSecurityAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + GetSecurityAdvisors(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetLogs request GetLogs(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -222,6 +231,15 @@ type ClientInterface interface { V1CreateABranch(ctx context.Context, ref string, body V1CreateABranchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1DeleteProjectClaimToken request + V1DeleteProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetProjectClaimToken request + V1GetProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CreateProjectClaimToken request + V1CreateProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetAuthServiceConfig request V1GetAuthServiceConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -334,6 +352,19 @@ type ClientInterface interface { V1RestorePitrBackup(ctx context.Context, ref string, body V1RestorePitrBackupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetRestorePoint request + V1GetRestorePoint(ctx context.Context, ref string, params *V1GetRestorePointParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CreateRestorePointWithBody request with any body + V1CreateRestorePointWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1CreateRestorePoint(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1UndoWithBody request with any body + V1UndoWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1Undo(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetDatabaseMetadata request GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -659,6 +690,18 @@ func (c *Client) V1AuthorizeUser(ctx context.Context, params *V1AuthorizeUserPar return c.Client.Do(req) } +func (c *Client) V1OauthAuthorizeProjectClaim(ctx context.Context, params *V1OauthAuthorizeProjectClaimParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1OauthAuthorizeProjectClaimRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1RevokeTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1RevokeTokenRequestWithBody(c.Server, contentType, body) if err != nil { @@ -767,6 +810,30 @@ func (c *Client) V1ListOrganizationMembers(ctx context.Context, slug string, req return c.Client.Do(req) } +func (c *Client) V1GetOrganizationProjectClaim(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetOrganizationProjectClaimRequest(c.Server, slug, token) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1ClaimProjectForOrganization(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ClaimProjectForOrganizationRequest(c.Server, slug, token) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1ListAllProjects(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1ListAllProjectsRequest(c.Server) if err != nil { @@ -839,8 +906,8 @@ func (c *Client) GetPerformanceAdvisors(ctx context.Context, ref string, reqEdit return c.Client.Do(req) } -func (c *Client) GetSecurityAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSecurityAdvisorsRequest(c.Server, ref) +func (c *Client) GetSecurityAdvisors(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSecurityAdvisorsRequest(c.Server, ref, params) if err != nil { return nil, err } @@ -1091,6 +1158,42 @@ func (c *Client) V1CreateABranch(ctx context.Context, ref string, body V1CreateA return c.Client.Do(req) } +func (c *Client) V1DeleteProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteProjectClaimTokenRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectClaimTokenRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateProjectClaimToken(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectClaimTokenRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1GetAuthServiceConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1GetAuthServiceConfigRequest(c.Server, ref) if err != nil { @@ -1583,6 +1686,66 @@ func (c *Client) V1RestorePitrBackup(ctx context.Context, ref string, body V1Res return c.Client.Do(req) } +func (c *Client) V1GetRestorePoint(ctx context.Context, ref string, params *V1GetRestorePointParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetRestorePointRequest(c.Server, ref, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateRestorePointWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateRestorePointRequestWithBody(c.Server, ref, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateRestorePoint(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateRestorePointRequest(c.Server, ref, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1UndoWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UndoRequestWithBody(c.Server, ref, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1Undo(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UndoRequest(c.Server, ref, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetDatabaseMetadataRequest(c.Server, ref) if err != nil { @@ -2836,19 +2999,8 @@ func NewV1AuthorizeUserRequest(server string, params *V1AuthorizeUserParams) (*h return req, nil } -// NewV1RevokeTokenRequest calls the generic V1RevokeToken builder with application/json body -func NewV1RevokeTokenRequest(server string, body V1RevokeTokenJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewV1RevokeTokenRequestWithBody(server, "application/json", bodyReader) -} - -// NewV1RevokeTokenRequestWithBody generates requests for V1RevokeToken with any type of body -func NewV1RevokeTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewV1OauthAuthorizeProjectClaimRequest generates requests for V1OauthAuthorizeProjectClaim +func NewV1OauthAuthorizeProjectClaimRequest(server string, params *V1OauthAuthorizeProjectClaimParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2856,7 +3008,7 @@ func NewV1RevokeTokenRequestWithBody(server string, contentType string, body io. return nil, err } - operationPath := fmt.Sprintf("/v1/oauth/revoke") + operationPath := fmt.Sprintf("/v1/oauth/authorize/project-claim") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -2866,67 +3018,223 @@ func NewV1RevokeTokenRequestWithBody(server string, contentType string, body io. return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) + if params != nil { + queryValues := queryURL.Query() - return req, nil -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "project_ref", runtime.ParamLocationQuery, params.ProjectRef); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// NewV1ExchangeOauthTokenRequestWithFormdataBody calls the generic V1ExchangeOauthToken builder with application/x-www-form-urlencoded body -func NewV1ExchangeOauthTokenRequestWithFormdataBody(server string, body V1ExchangeOauthTokenFormdataRequestBody) (*http.Request, error) { - var bodyReader io.Reader - bodyStr, err := runtime.MarshalForm(body, nil) - if err != nil { - return nil, err - } - bodyReader = strings.NewReader(bodyStr.Encode()) - return NewV1ExchangeOauthTokenRequestWithBody(server, "application/x-www-form-urlencoded", bodyReader) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_id", runtime.ParamLocationQuery, params.ClientId); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// NewV1ExchangeOauthTokenRequestWithBody generates requests for V1ExchangeOauthToken with any type of body -func NewV1ExchangeOauthTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "response_type", runtime.ParamLocationQuery, params.ResponseType); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "redirect_uri", runtime.ParamLocationQuery, params.RedirectUri); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - operationPath := fmt.Sprintf("/v1/oauth/token") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + if params.State != nil { - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } + } - req.Header.Add("Content-Type", contentType) + if params.ResponseMode != nil { - return req, nil -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "response_mode", runtime.ParamLocationQuery, *params.ResponseMode); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// NewV1ListAllOrganizationsRequest generates requests for V1ListAllOrganizations -func NewV1ListAllOrganizationsRequest(server string) (*http.Request, error) { - var err error + } - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + if params.CodeChallenge != nil { - operationPath := fmt.Sprintf("/v1/organizations") - if operationPath[0] == '/' { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge", runtime.ParamLocationQuery, *params.CodeChallenge); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.CodeChallengeMethod != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge_method", runtime.ParamLocationQuery, *params.CodeChallengeMethod); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1RevokeTokenRequest calls the generic V1RevokeToken builder with application/json body +func NewV1RevokeTokenRequest(server string, body V1RevokeTokenJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1RevokeTokenRequestWithBody(server, "application/json", bodyReader) +} + +// NewV1RevokeTokenRequestWithBody generates requests for V1RevokeToken with any type of body +func NewV1RevokeTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/oauth/revoke") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1ExchangeOauthTokenRequestWithFormdataBody calls the generic V1ExchangeOauthToken builder with application/x-www-form-urlencoded body +func NewV1ExchangeOauthTokenRequestWithFormdataBody(server string, body V1ExchangeOauthTokenFormdataRequestBody) (*http.Request, error) { + var bodyReader io.Reader + bodyStr, err := runtime.MarshalForm(body, nil) + if err != nil { + return nil, err + } + bodyReader = strings.NewReader(bodyStr.Encode()) + return NewV1ExchangeOauthTokenRequestWithBody(server, "application/x-www-form-urlencoded", bodyReader) +} + +// NewV1ExchangeOauthTokenRequestWithBody generates requests for V1ExchangeOauthToken with any type of body +func NewV1ExchangeOauthTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/oauth/token") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1ListAllOrganizationsRequest generates requests for V1ListAllOrganizations +func NewV1ListAllOrganizationsRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations") + if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3051,6 +3359,88 @@ func NewV1ListOrganizationMembersRequest(server string, slug string) (*http.Requ return req, nil } +// NewV1GetOrganizationProjectClaimRequest generates requests for V1GetOrganizationProjectClaim +func NewV1GetOrganizationProjectClaimRequest(server string, slug string, token string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "slug", runtime.ParamLocationPath, slug) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "token", runtime.ParamLocationPath, token) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/project-claim/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1ClaimProjectForOrganizationRequest generates requests for V1ClaimProjectForOrganization +func NewV1ClaimProjectForOrganizationRequest(server string, slug string, token string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "slug", runtime.ParamLocationPath, slug) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "token", runtime.ParamLocationPath, token) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/project-claim/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1ListAllProjectsRequest generates requests for V1ListAllProjects func NewV1ListAllProjectsRequest(server string) (*http.Request, error) { var err error @@ -3221,7 +3611,7 @@ func NewGetPerformanceAdvisorsRequest(server string, ref string) (*http.Request, } // NewGetSecurityAdvisorsRequest generates requests for GetSecurityAdvisors -func NewGetSecurityAdvisorsRequest(server string, ref string) (*http.Request, error) { +func NewGetSecurityAdvisorsRequest(server string, ref string, params *GetSecurityAdvisorsParams) (*http.Request, error) { var err error var pathParam0 string @@ -3246,6 +3636,28 @@ func NewGetSecurityAdvisorsRequest(server string, ref string) (*http.Request, er return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.LintType != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "lint_type", runtime.ParamLocationQuery, *params.LintType); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -4114,6 +4526,108 @@ func NewV1CreateABranchRequestWithBody(server string, ref string, contentType st return req, nil } +// NewV1DeleteProjectClaimTokenRequest generates requests for V1DeleteProjectClaimToken +func NewV1DeleteProjectClaimTokenRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/claim-token", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetProjectClaimTokenRequest generates requests for V1GetProjectClaimToken +func NewV1GetProjectClaimTokenRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/claim-token", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1CreateProjectClaimTokenRequest generates requests for V1CreateProjectClaimToken +func NewV1CreateProjectClaimTokenRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/claim-token", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1GetAuthServiceConfigRequest generates requests for V1GetAuthServiceConfig func NewV1GetAuthServiceConfigRequest(server string, ref string) (*http.Request, error) { var err error @@ -5119,7 +5633,122 @@ func NewV1GetHostnameConfigRequest(server string, ref string) (*http.Request, er return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1ActivateCustomHostnameRequest generates requests for V1ActivateCustomHostname +func NewV1ActivateCustomHostnameRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/activate", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1UpdateHostnameConfigRequest calls the generic V1UpdateHostnameConfig builder with application/json body +func NewV1UpdateHostnameConfigRequest(server string, ref string, body V1UpdateHostnameConfigJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1UpdateHostnameConfigRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewV1UpdateHostnameConfigRequestWithBody generates requests for V1UpdateHostnameConfig with any type of body +func NewV1UpdateHostnameConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/initialize", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1VerifyDnsConfigRequest generates requests for V1VerifyDnsConfig +func NewV1VerifyDnsConfigRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/reverify", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -5129,7 +5758,7 @@ func NewV1GetHostnameConfigRequest(server string, ref string) (*http.Request, er return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), nil) if err != nil { return nil, err } @@ -5137,8 +5766,8 @@ func NewV1GetHostnameConfigRequest(server string, ref string) (*http.Request, er return req, nil } -// NewV1ActivateCustomHostnameRequest generates requests for V1ActivateCustomHostname -func NewV1ActivateCustomHostnameRequest(server string, ref string) (*http.Request, error) { +// NewV1ListAllBackupsRequest generates requests for V1ListAllBackups +func NewV1ListAllBackupsRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -5153,7 +5782,7 @@ func NewV1ActivateCustomHostnameRequest(server string, ref string) (*http.Reques return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/activate", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/database/backups", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -5163,7 +5792,7 @@ func NewV1ActivateCustomHostnameRequest(server string, ref string) (*http.Reques return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), nil) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } @@ -5171,19 +5800,19 @@ func NewV1ActivateCustomHostnameRequest(server string, ref string) (*http.Reques return req, nil } -// NewV1UpdateHostnameConfigRequest calls the generic V1UpdateHostnameConfig builder with application/json body -func NewV1UpdateHostnameConfigRequest(server string, ref string, body V1UpdateHostnameConfigJSONRequestBody) (*http.Request, error) { +// NewV1RestorePitrBackupRequest calls the generic V1RestorePitrBackup builder with application/json body +func NewV1RestorePitrBackupRequest(server string, ref string, body V1RestorePitrBackupJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewV1UpdateHostnameConfigRequestWithBody(server, ref, "application/json", bodyReader) + return NewV1RestorePitrBackupRequestWithBody(server, ref, "application/json", bodyReader) } -// NewV1UpdateHostnameConfigRequestWithBody generates requests for V1UpdateHostnameConfig with any type of body -func NewV1UpdateHostnameConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { +// NewV1RestorePitrBackupRequestWithBody generates requests for V1RestorePitrBackup with any type of body +func NewV1RestorePitrBackupRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -5198,7 +5827,7 @@ func NewV1UpdateHostnameConfigRequestWithBody(server string, ref string, content return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/initialize", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/database/backups/restore-pitr", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -5218,8 +5847,8 @@ func NewV1UpdateHostnameConfigRequestWithBody(server string, ref string, content return req, nil } -// NewV1VerifyDnsConfigRequest generates requests for V1VerifyDnsConfig -func NewV1VerifyDnsConfigRequest(server string, ref string) (*http.Request, error) { +// NewV1GetRestorePointRequest generates requests for V1GetRestorePoint +func NewV1GetRestorePointRequest(server string, ref string, params *V1GetRestorePointParams) (*http.Request, error) { var err error var pathParam0 string @@ -5234,7 +5863,7 @@ func NewV1VerifyDnsConfigRequest(server string, ref string) (*http.Request, erro return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/custom-hostname/reverify", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/database/backups/restore-point", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -5244,7 +5873,29 @@ func NewV1VerifyDnsConfigRequest(server string, ref string) (*http.Request, erro return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), nil) + if params != nil { + queryValues := queryURL.Query() + + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } @@ -5252,8 +5903,19 @@ func NewV1VerifyDnsConfigRequest(server string, ref string) (*http.Request, erro return req, nil } -// NewV1ListAllBackupsRequest generates requests for V1ListAllBackups -func NewV1ListAllBackupsRequest(server string, ref string) (*http.Request, error) { +// NewV1CreateRestorePointRequest calls the generic V1CreateRestorePoint builder with application/json body +func NewV1CreateRestorePointRequest(server string, ref string, body V1CreateRestorePointJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1CreateRestorePointRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewV1CreateRestorePointRequestWithBody generates requests for V1CreateRestorePoint with any type of body +func NewV1CreateRestorePointRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -5268,7 +5930,7 @@ func NewV1ListAllBackupsRequest(server string, ref string) (*http.Request, error return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/database/backups", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/database/backups/restore-point", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -5278,27 +5940,29 @@ func NewV1ListAllBackupsRequest(server string, ref string) (*http.Request, error return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewV1RestorePitrBackupRequest calls the generic V1RestorePitrBackup builder with application/json body -func NewV1RestorePitrBackupRequest(server string, ref string, body V1RestorePitrBackupJSONRequestBody) (*http.Request, error) { +// NewV1UndoRequest calls the generic V1Undo builder with application/json body +func NewV1UndoRequest(server string, ref string, body V1UndoJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewV1RestorePitrBackupRequestWithBody(server, ref, "application/json", bodyReader) + return NewV1UndoRequestWithBody(server, ref, "application/json", bodyReader) } -// NewV1RestorePitrBackupRequestWithBody generates requests for V1RestorePitrBackup with any type of body -func NewV1RestorePitrBackupRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { +// NewV1UndoRequestWithBody generates requests for V1Undo with any type of body +func NewV1UndoRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -5313,7 +5977,7 @@ func NewV1RestorePitrBackupRequestWithBody(server string, ref string, contentTyp return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/database/backups/restore-pitr", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/database/backups/undo", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -7733,6 +8397,9 @@ type ClientWithResponsesInterface interface { // V1AuthorizeUserWithResponse request V1AuthorizeUserWithResponse(ctx context.Context, params *V1AuthorizeUserParams, reqEditors ...RequestEditorFn) (*V1AuthorizeUserResponse, error) + // V1OauthAuthorizeProjectClaimWithResponse request + V1OauthAuthorizeProjectClaimWithResponse(ctx context.Context, params *V1OauthAuthorizeProjectClaimParams, reqEditors ...RequestEditorFn) (*V1OauthAuthorizeProjectClaimResponse, error) + // V1RevokeTokenWithBodyWithResponse request with any body V1RevokeTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) @@ -7757,6 +8424,12 @@ type ClientWithResponsesInterface interface { // V1ListOrganizationMembersWithResponse request V1ListOrganizationMembersWithResponse(ctx context.Context, slug string, reqEditors ...RequestEditorFn) (*V1ListOrganizationMembersResponse, error) + // V1GetOrganizationProjectClaimWithResponse request + V1GetOrganizationProjectClaimWithResponse(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*V1GetOrganizationProjectClaimResponse, error) + + // V1ClaimProjectForOrganizationWithResponse request + V1ClaimProjectForOrganizationWithResponse(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*V1ClaimProjectForOrganizationResponse, error) + // V1ListAllProjectsWithResponse request V1ListAllProjectsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1ListAllProjectsResponse, error) @@ -7775,7 +8448,7 @@ type ClientWithResponsesInterface interface { GetPerformanceAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPerformanceAdvisorsResponse, error) // GetSecurityAdvisorsWithResponse request - GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) + GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) // GetLogsWithResponse request GetLogsWithResponse(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*GetLogsResponse, error) @@ -7833,6 +8506,15 @@ type ClientWithResponsesInterface interface { V1CreateABranchWithResponse(ctx context.Context, ref string, body V1CreateABranchJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateABranchResponse, error) + // V1DeleteProjectClaimTokenWithResponse request + V1DeleteProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1DeleteProjectClaimTokenResponse, error) + + // V1GetProjectClaimTokenWithResponse request + V1GetProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectClaimTokenResponse, error) + + // V1CreateProjectClaimTokenWithResponse request + V1CreateProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CreateProjectClaimTokenResponse, error) + // V1GetAuthServiceConfigWithResponse request V1GetAuthServiceConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetAuthServiceConfigResponse, error) @@ -7945,6 +8627,19 @@ type ClientWithResponsesInterface interface { V1RestorePitrBackupWithResponse(ctx context.Context, ref string, body V1RestorePitrBackupJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RestorePitrBackupResponse, error) + // V1GetRestorePointWithResponse request + V1GetRestorePointWithResponse(ctx context.Context, ref string, params *V1GetRestorePointParams, reqEditors ...RequestEditorFn) (*V1GetRestorePointResponse, error) + + // V1CreateRestorePointWithBodyWithResponse request with any body + V1CreateRestorePointWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateRestorePointResponse, error) + + V1CreateRestorePointWithResponse(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateRestorePointResponse, error) + + // V1UndoWithBodyWithResponse request with any body + V1UndoWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) + + V1UndoWithResponse(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) + // GetDatabaseMetadataWithResponse request GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) @@ -8300,6 +8995,27 @@ func (r V1AuthorizeUserResponse) StatusCode() int { return 0 } +type V1OauthAuthorizeProjectClaimResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1OauthAuthorizeProjectClaimResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1OauthAuthorizeProjectClaimResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1RevokeTokenResponse struct { Body []byte HTTPResponse *http.Response @@ -8431,6 +9147,49 @@ func (r V1ListOrganizationMembersResponse) StatusCode() int { return 0 } +type V1GetOrganizationProjectClaimResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *OrganizationProjectClaimResponse +} + +// Status returns HTTPResponse.Status +func (r V1GetOrganizationProjectClaimResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetOrganizationProjectClaimResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1ClaimProjectForOrganizationResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1ClaimProjectForOrganizationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ClaimProjectForOrganizationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1ListAllProjectsResponse struct { Body []byte HTTPResponse *http.Response @@ -8912,6 +9671,71 @@ func (r V1CreateABranchResponse) StatusCode() int { return 0 } +type V1DeleteProjectClaimTokenResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1DeleteProjectClaimTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteProjectClaimTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetProjectClaimTokenResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ProjectClaimTokenResponse +} + +// Status returns HTTPResponse.Status +func (r V1GetProjectClaimTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetProjectClaimTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1CreateProjectClaimTokenResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CreateProjectClaimTokenResponse +} + +// Status returns HTTPResponse.Status +func (r V1CreateProjectClaimTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1CreateProjectClaimTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1GetAuthServiceConfigResponse struct { Body []byte HTTPResponse *http.Response @@ -9423,7 +10247,73 @@ type V1DeleteHostnameConfigResponse struct { } // Status returns HTTPResponse.Status -func (r V1DeleteHostnameConfigResponse) Status() string { +func (r V1DeleteHostnameConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteHostnameConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetHostnameConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *UpdateCustomHostnameResponse +} + +// Status returns HTTPResponse.Status +func (r V1GetHostnameConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetHostnameConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1ActivateCustomHostnameResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *UpdateCustomHostnameResponse +} + +// Status returns HTTPResponse.Status +func (r V1ActivateCustomHostnameResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ActivateCustomHostnameResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1UpdateHostnameConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *UpdateCustomHostnameResponse +} + +// Status returns HTTPResponse.Status +func (r V1UpdateHostnameConfigResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9431,21 +10321,21 @@ func (r V1DeleteHostnameConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1DeleteHostnameConfigResponse) StatusCode() int { +func (r V1UpdateHostnameConfigResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1GetHostnameConfigResponse struct { +type V1VerifyDnsConfigResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *UpdateCustomHostnameResponse + JSON201 *UpdateCustomHostnameResponse } // Status returns HTTPResponse.Status -func (r V1GetHostnameConfigResponse) Status() string { +func (r V1VerifyDnsConfigResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9453,21 +10343,21 @@ func (r V1GetHostnameConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1GetHostnameConfigResponse) StatusCode() int { +func (r V1VerifyDnsConfigResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1ActivateCustomHostnameResponse struct { +type V1ListAllBackupsResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *UpdateCustomHostnameResponse + JSON200 *V1BackupsResponse } // Status returns HTTPResponse.Status -func (r V1ActivateCustomHostnameResponse) Status() string { +func (r V1ListAllBackupsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9475,21 +10365,20 @@ func (r V1ActivateCustomHostnameResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1ActivateCustomHostnameResponse) StatusCode() int { +func (r V1ListAllBackupsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1UpdateHostnameConfigResponse struct { +type V1RestorePitrBackupResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *UpdateCustomHostnameResponse } // Status returns HTTPResponse.Status -func (r V1UpdateHostnameConfigResponse) Status() string { +func (r V1RestorePitrBackupResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9497,21 +10386,21 @@ func (r V1UpdateHostnameConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1UpdateHostnameConfigResponse) StatusCode() int { +func (r V1RestorePitrBackupResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1VerifyDnsConfigResponse struct { +type V1GetRestorePointResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *UpdateCustomHostnameResponse + JSON200 *V1RestorePointResponse } // Status returns HTTPResponse.Status -func (r V1VerifyDnsConfigResponse) Status() string { +func (r V1GetRestorePointResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9519,21 +10408,21 @@ func (r V1VerifyDnsConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1VerifyDnsConfigResponse) StatusCode() int { +func (r V1GetRestorePointResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1ListAllBackupsResponse struct { +type V1CreateRestorePointResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *V1BackupsResponse + JSON201 *V1RestorePointResponse } // Status returns HTTPResponse.Status -func (r V1ListAllBackupsResponse) Status() string { +func (r V1CreateRestorePointResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9541,20 +10430,20 @@ func (r V1ListAllBackupsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1ListAllBackupsResponse) StatusCode() int { +func (r V1CreateRestorePointResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type V1RestorePitrBackupResponse struct { +type V1UndoResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status -func (r V1RestorePitrBackupResponse) Status() string { +func (r V1UndoResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9562,7 +10451,7 @@ func (r V1RestorePitrBackupResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r V1RestorePitrBackupResponse) StatusCode() int { +func (r V1UndoResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -10714,6 +11603,15 @@ func (c *ClientWithResponses) V1AuthorizeUserWithResponse(ctx context.Context, p return ParseV1AuthorizeUserResponse(rsp) } +// V1OauthAuthorizeProjectClaimWithResponse request returning *V1OauthAuthorizeProjectClaimResponse +func (c *ClientWithResponses) V1OauthAuthorizeProjectClaimWithResponse(ctx context.Context, params *V1OauthAuthorizeProjectClaimParams, reqEditors ...RequestEditorFn) (*V1OauthAuthorizeProjectClaimResponse, error) { + rsp, err := c.V1OauthAuthorizeProjectClaim(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1OauthAuthorizeProjectClaimResponse(rsp) +} + // V1RevokeTokenWithBodyWithResponse request with arbitrary body returning *V1RevokeTokenResponse func (c *ClientWithResponses) V1RevokeTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) { rsp, err := c.V1RevokeTokenWithBody(ctx, contentType, body, reqEditors...) @@ -10792,6 +11690,24 @@ func (c *ClientWithResponses) V1ListOrganizationMembersWithResponse(ctx context. return ParseV1ListOrganizationMembersResponse(rsp) } +// V1GetOrganizationProjectClaimWithResponse request returning *V1GetOrganizationProjectClaimResponse +func (c *ClientWithResponses) V1GetOrganizationProjectClaimWithResponse(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*V1GetOrganizationProjectClaimResponse, error) { + rsp, err := c.V1GetOrganizationProjectClaim(ctx, slug, token, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1GetOrganizationProjectClaimResponse(rsp) +} + +// V1ClaimProjectForOrganizationWithResponse request returning *V1ClaimProjectForOrganizationResponse +func (c *ClientWithResponses) V1ClaimProjectForOrganizationWithResponse(ctx context.Context, slug string, token string, reqEditors ...RequestEditorFn) (*V1ClaimProjectForOrganizationResponse, error) { + rsp, err := c.V1ClaimProjectForOrganization(ctx, slug, token, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1ClaimProjectForOrganizationResponse(rsp) +} + // V1ListAllProjectsWithResponse request returning *V1ListAllProjectsResponse func (c *ClientWithResponses) V1ListAllProjectsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1ListAllProjectsResponse, error) { rsp, err := c.V1ListAllProjects(ctx, reqEditors...) @@ -10846,8 +11762,8 @@ func (c *ClientWithResponses) GetPerformanceAdvisorsWithResponse(ctx context.Con } // GetSecurityAdvisorsWithResponse request returning *GetSecurityAdvisorsResponse -func (c *ClientWithResponses) GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) { - rsp, err := c.GetSecurityAdvisors(ctx, ref, reqEditors...) +func (c *ClientWithResponses) GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) { + rsp, err := c.GetSecurityAdvisors(ctx, ref, params, reqEditors...) if err != nil { return nil, err } @@ -11030,6 +11946,33 @@ func (c *ClientWithResponses) V1CreateABranchWithResponse(ctx context.Context, r return ParseV1CreateABranchResponse(rsp) } +// V1DeleteProjectClaimTokenWithResponse request returning *V1DeleteProjectClaimTokenResponse +func (c *ClientWithResponses) V1DeleteProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1DeleteProjectClaimTokenResponse, error) { + rsp, err := c.V1DeleteProjectClaimToken(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1DeleteProjectClaimTokenResponse(rsp) +} + +// V1GetProjectClaimTokenWithResponse request returning *V1GetProjectClaimTokenResponse +func (c *ClientWithResponses) V1GetProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectClaimTokenResponse, error) { + rsp, err := c.V1GetProjectClaimToken(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1GetProjectClaimTokenResponse(rsp) +} + +// V1CreateProjectClaimTokenWithResponse request returning *V1CreateProjectClaimTokenResponse +func (c *ClientWithResponses) V1CreateProjectClaimTokenWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CreateProjectClaimTokenResponse, error) { + rsp, err := c.V1CreateProjectClaimToken(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1CreateProjectClaimTokenResponse(rsp) +} + // V1GetAuthServiceConfigWithResponse request returning *V1GetAuthServiceConfigResponse func (c *ClientWithResponses) V1GetAuthServiceConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetAuthServiceConfigResponse, error) { rsp, err := c.V1GetAuthServiceConfig(ctx, ref, reqEditors...) @@ -11388,6 +12331,49 @@ func (c *ClientWithResponses) V1RestorePitrBackupWithResponse(ctx context.Contex return ParseV1RestorePitrBackupResponse(rsp) } +// V1GetRestorePointWithResponse request returning *V1GetRestorePointResponse +func (c *ClientWithResponses) V1GetRestorePointWithResponse(ctx context.Context, ref string, params *V1GetRestorePointParams, reqEditors ...RequestEditorFn) (*V1GetRestorePointResponse, error) { + rsp, err := c.V1GetRestorePoint(ctx, ref, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1GetRestorePointResponse(rsp) +} + +// V1CreateRestorePointWithBodyWithResponse request with arbitrary body returning *V1CreateRestorePointResponse +func (c *ClientWithResponses) V1CreateRestorePointWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateRestorePointResponse, error) { + rsp, err := c.V1CreateRestorePointWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1CreateRestorePointResponse(rsp) +} + +func (c *ClientWithResponses) V1CreateRestorePointWithResponse(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateRestorePointResponse, error) { + rsp, err := c.V1CreateRestorePoint(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1CreateRestorePointResponse(rsp) +} + +// V1UndoWithBodyWithResponse request with arbitrary body returning *V1UndoResponse +func (c *ClientWithResponses) V1UndoWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) { + rsp, err := c.V1UndoWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1UndoResponse(rsp) +} + +func (c *ClientWithResponses) V1UndoWithResponse(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) { + rsp, err := c.V1Undo(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1UndoResponse(rsp) +} + // GetDatabaseMetadataWithResponse request returning *GetDatabaseMetadataResponse func (c *ClientWithResponses) GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) { rsp, err := c.GetDatabaseMetadata(ctx, ref, reqEditors...) @@ -12152,6 +13138,22 @@ func ParseV1AuthorizeUserResponse(rsp *http.Response) (*V1AuthorizeUserResponse, return response, nil } +// ParseV1OauthAuthorizeProjectClaimResponse parses an HTTP response from a V1OauthAuthorizeProjectClaimWithResponse call +func ParseV1OauthAuthorizeProjectClaimResponse(rsp *http.Response) (*V1OauthAuthorizeProjectClaimResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1OauthAuthorizeProjectClaimResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseV1RevokeTokenResponse parses an HTTP response from a V1RevokeTokenWithResponse call func ParseV1RevokeTokenResponse(rsp *http.Response) (*V1RevokeTokenResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -12298,6 +13300,48 @@ func ParseV1ListOrganizationMembersResponse(rsp *http.Response) (*V1ListOrganiza return response, nil } +// ParseV1GetOrganizationProjectClaimResponse parses an HTTP response from a V1GetOrganizationProjectClaimWithResponse call +func ParseV1GetOrganizationProjectClaimResponse(rsp *http.Response) (*V1GetOrganizationProjectClaimResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetOrganizationProjectClaimResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest OrganizationProjectClaimResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1ClaimProjectForOrganizationResponse parses an HTTP response from a V1ClaimProjectForOrganizationWithResponse call +func ParseV1ClaimProjectForOrganizationResponse(rsp *http.Response) (*V1ClaimProjectForOrganizationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ClaimProjectForOrganizationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseV1ListAllProjectsResponse parses an HTTP response from a V1ListAllProjectsWithResponse call func ParseV1ListAllProjectsResponse(rsp *http.Response) (*V1ListAllProjectsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -12840,6 +13884,74 @@ func ParseV1CreateABranchResponse(rsp *http.Response) (*V1CreateABranchResponse, return response, nil } +// ParseV1DeleteProjectClaimTokenResponse parses an HTTP response from a V1DeleteProjectClaimTokenWithResponse call +func ParseV1DeleteProjectClaimTokenResponse(rsp *http.Response) (*V1DeleteProjectClaimTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeleteProjectClaimTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseV1GetProjectClaimTokenResponse parses an HTTP response from a V1GetProjectClaimTokenWithResponse call +func ParseV1GetProjectClaimTokenResponse(rsp *http.Response) (*V1GetProjectClaimTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetProjectClaimTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ProjectClaimTokenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1CreateProjectClaimTokenResponse parses an HTTP response from a V1CreateProjectClaimTokenWithResponse call +func ParseV1CreateProjectClaimTokenResponse(rsp *http.Response) (*V1CreateProjectClaimTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CreateProjectClaimTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CreateProjectClaimTokenResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseV1GetAuthServiceConfigResponse parses an HTTP response from a V1GetAuthServiceConfigWithResponse call func ParseV1GetAuthServiceConfigResponse(rsp *http.Response) (*V1GetAuthServiceConfigResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -13590,6 +14702,74 @@ func ParseV1RestorePitrBackupResponse(rsp *http.Response) (*V1RestorePitrBackupR return response, nil } +// ParseV1GetRestorePointResponse parses an HTTP response from a V1GetRestorePointWithResponse call +func ParseV1GetRestorePointResponse(rsp *http.Response) (*V1GetRestorePointResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetRestorePointResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1RestorePointResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1CreateRestorePointResponse parses an HTTP response from a V1CreateRestorePointWithResponse call +func ParseV1CreateRestorePointResponse(rsp *http.Response) (*V1CreateRestorePointResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CreateRestorePointResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest V1RestorePointResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + +// ParseV1UndoResponse parses an HTTP response from a V1UndoWithResponse call +func ParseV1UndoResponse(rsp *http.Response) (*V1UndoResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1UndoResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseGetDatabaseMetadataResponse parses an HTTP response from a GetDatabaseMetadataWithResponse call func ParseGetDatabaseMetadataResponse(rsp *http.Response) (*GetDatabaseMetadataResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 50148b79f..b9ec43b0b 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -462,6 +462,22 @@ const ( Bearer OAuthTokenResponseTokenType = "Bearer" ) +// Defines values for OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan. +const ( + OrganizationProjectClaimResponsePreviewSourceSubscriptionPlanEnterprise OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan = "enterprise" + OrganizationProjectClaimResponsePreviewSourceSubscriptionPlanFree OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan = "free" + OrganizationProjectClaimResponsePreviewSourceSubscriptionPlanPro OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan = "pro" + OrganizationProjectClaimResponsePreviewSourceSubscriptionPlanTeam OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan = "team" +) + +// Defines values for OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan. +const ( + OrganizationProjectClaimResponsePreviewTargetSubscriptionPlanEnterprise OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan = "enterprise" + OrganizationProjectClaimResponsePreviewTargetSubscriptionPlanFree OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan = "free" + OrganizationProjectClaimResponsePreviewTargetSubscriptionPlanPro OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan = "pro" + OrganizationProjectClaimResponsePreviewTargetSubscriptionPlanTeam OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan = "team" +) + // Defines values for PostgresConfigResponseSessionReplicationRole. const ( PostgresConfigResponseSessionReplicationRoleLocal PostgresConfigResponseSessionReplicationRole = "local" @@ -853,6 +869,13 @@ const ( V1ProjectWithDatabaseResponseStatusUPGRADING V1ProjectWithDatabaseResponseStatus = "UPGRADING" ) +// Defines values for V1RestorePointResponseStatus. +const ( + V1RestorePointResponseStatusAVAILABLE V1RestorePointResponseStatus = "AVAILABLE" + V1RestorePointResponseStatusPENDING V1RestorePointResponseStatus = "PENDING" + V1RestorePointResponseStatusREMOVED V1RestorePointResponseStatus = "REMOVED" +) + // Defines values for V1ServiceHealthResponseInfo0Name. const ( GoTrue V1ServiceHealthResponseInfo0Name = "GoTrue" @@ -870,9 +893,9 @@ const ( // Defines values for V1ServiceHealthResponseStatus. const ( - V1ServiceHealthResponseStatusACTIVEHEALTHY V1ServiceHealthResponseStatus = "ACTIVE_HEALTHY" - V1ServiceHealthResponseStatusCOMINGUP V1ServiceHealthResponseStatus = "COMING_UP" - V1ServiceHealthResponseStatusUNHEALTHY V1ServiceHealthResponseStatus = "UNHEALTHY" + ACTIVEHEALTHY V1ServiceHealthResponseStatus = "ACTIVE_HEALTHY" + COMINGUP V1ServiceHealthResponseStatus = "COMING_UP" + UNHEALTHY V1ServiceHealthResponseStatus = "UNHEALTHY" ) // Defines values for VanitySubdomainConfigResponseStatus. @@ -884,16 +907,35 @@ const ( // Defines values for V1AuthorizeUserParamsResponseType. const ( - Code V1AuthorizeUserParamsResponseType = "code" - IdTokenToken V1AuthorizeUserParamsResponseType = "id_token token" - Token V1AuthorizeUserParamsResponseType = "token" + V1AuthorizeUserParamsResponseTypeCode V1AuthorizeUserParamsResponseType = "code" + V1AuthorizeUserParamsResponseTypeIdTokenToken V1AuthorizeUserParamsResponseType = "id_token token" + V1AuthorizeUserParamsResponseTypeToken V1AuthorizeUserParamsResponseType = "token" ) // Defines values for V1AuthorizeUserParamsCodeChallengeMethod. const ( - Plain V1AuthorizeUserParamsCodeChallengeMethod = "plain" - S256 V1AuthorizeUserParamsCodeChallengeMethod = "S256" - Sha256 V1AuthorizeUserParamsCodeChallengeMethod = "sha256" + V1AuthorizeUserParamsCodeChallengeMethodPlain V1AuthorizeUserParamsCodeChallengeMethod = "plain" + V1AuthorizeUserParamsCodeChallengeMethodS256 V1AuthorizeUserParamsCodeChallengeMethod = "S256" + V1AuthorizeUserParamsCodeChallengeMethodSha256 V1AuthorizeUserParamsCodeChallengeMethod = "sha256" +) + +// Defines values for V1OauthAuthorizeProjectClaimParamsResponseType. +const ( + V1OauthAuthorizeProjectClaimParamsResponseTypeCode V1OauthAuthorizeProjectClaimParamsResponseType = "code" + V1OauthAuthorizeProjectClaimParamsResponseTypeIdTokenToken V1OauthAuthorizeProjectClaimParamsResponseType = "id_token token" + V1OauthAuthorizeProjectClaimParamsResponseTypeToken V1OauthAuthorizeProjectClaimParamsResponseType = "token" +) + +// Defines values for V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod. +const ( + V1OauthAuthorizeProjectClaimParamsCodeChallengeMethodPlain V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod = "plain" + V1OauthAuthorizeProjectClaimParamsCodeChallengeMethodS256 V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod = "S256" + V1OauthAuthorizeProjectClaimParamsCodeChallengeMethodSha256 V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod = "sha256" +) + +// Defines values for GetSecurityAdvisorsParamsLintType. +const ( + Sql GetSecurityAdvisorsParamsLintType = "sql" ) // Defines values for GetApiCountsParamsInterval. @@ -1336,6 +1378,15 @@ type CreateOrganizationV1 struct { Name string `json:"name"` } +// CreateProjectClaimTokenResponse defines model for CreateProjectClaimTokenResponse. +type CreateProjectClaimTokenResponse struct { + CreatedAt string `json:"created_at"` + CreatedBy openapi_types.UUID `json:"created_by"` + ExpiresAt string `json:"expires_at"` + Token string `json:"token"` + TokenAlias string `json:"token_alias"` +} + // CreateProviderBody defines model for CreateProviderBody. type CreateProviderBody struct { AttributeMapping *struct { @@ -1797,6 +1848,46 @@ type OAuthTokenResponse struct { // OAuthTokenResponseTokenType defines model for OAuthTokenResponse.TokenType. type OAuthTokenResponseTokenType string +// OrganizationProjectClaimResponse defines model for OrganizationProjectClaimResponse. +type OrganizationProjectClaimResponse struct { + CreatedAt string `json:"created_at"` + CreatedBy openapi_types.UUID `json:"created_by"` + ExpiresAt string `json:"expires_at"` + Preview struct { + Errors []struct { + Key string `json:"key"` + Message string `json:"message"` + } `json:"errors"` + Info []struct { + Key string `json:"key"` + Message string `json:"message"` + } `json:"info"` + MembersExceedingFreeProjectLimit []struct { + Limit float32 `json:"limit"` + Name string `json:"name"` + } `json:"members_exceeding_free_project_limit"` + SourceSubscriptionPlan OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan `json:"source_subscription_plan"` + TargetOrganizationEligible nullable.Nullable[bool] `json:"target_organization_eligible"` + TargetOrganizationHasFreeProjectSlots nullable.Nullable[bool] `json:"target_organization_has_free_project_slots"` + TargetSubscriptionPlan nullable.Nullable[OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan] `json:"target_subscription_plan"` + Valid bool `json:"valid"` + Warnings []struct { + Key string `json:"key"` + Message string `json:"message"` + } `json:"warnings"` + } `json:"preview"` + Project struct { + Name string `json:"name"` + Ref string `json:"ref"` + } `json:"project"` +} + +// OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan defines model for OrganizationProjectClaimResponse.Preview.SourceSubscriptionPlan. +type OrganizationProjectClaimResponsePreviewSourceSubscriptionPlan string + +// OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan defines model for OrganizationProjectClaimResponse.Preview.TargetSubscriptionPlan. +type OrganizationProjectClaimResponsePreviewTargetSubscriptionPlan string + // OrganizationResponseV1 defines model for OrganizationResponseV1. type OrganizationResponseV1 struct { Id string `json:"id"` @@ -1849,6 +1940,14 @@ type PostgrestConfigWithJWTSecretResponse struct { MaxRows int `json:"max_rows"` } +// ProjectClaimTokenResponse defines model for ProjectClaimTokenResponse. +type ProjectClaimTokenResponse struct { + CreatedAt string `json:"created_at"` + CreatedBy openapi_types.UUID `json:"created_by"` + ExpiresAt string `json:"expires_at"` + TokenAlias string `json:"token_alias"` +} + // ProjectUpgradeEligibilityResponse defines model for ProjectUpgradeEligibilityResponse. type ProjectUpgradeEligibilityResponse struct { CurrentAppVersion string `json:"current_app_version"` @@ -2697,6 +2796,20 @@ type V1RestorePitrBody struct { RecoveryTimeTargetUnix int64 `json:"recovery_time_target_unix"` } +// V1RestorePointPostBody defines model for V1RestorePointPostBody. +type V1RestorePointPostBody struct { + Name string `json:"name"` +} + +// V1RestorePointResponse defines model for V1RestorePointResponse. +type V1RestorePointResponse struct { + Name string `json:"name"` + Status V1RestorePointResponseStatus `json:"status"` +} + +// V1RestorePointResponseStatus defines model for V1RestorePointResponse.Status. +type V1RestorePointResponseStatus string + // V1RunQueryBody defines model for V1RunQueryBody. type V1RunQueryBody struct { Query string `json:"query"` @@ -2750,6 +2863,11 @@ type V1StorageBucketResponse struct { UpdatedAt string `json:"updated_at"` } +// V1UndoBody defines model for V1UndoBody. +type V1UndoBody struct { + Name string `json:"name"` +} + // V1UpdateFunctionBody defines model for V1UpdateFunctionBody. type V1UpdateFunctionBody struct { Body *string `json:"body,omitempty"` @@ -2808,6 +2926,33 @@ type V1AuthorizeUserParamsResponseType string // V1AuthorizeUserParamsCodeChallengeMethod defines parameters for V1AuthorizeUser. type V1AuthorizeUserParamsCodeChallengeMethod string +// V1OauthAuthorizeProjectClaimParams defines parameters for V1OauthAuthorizeProjectClaim. +type V1OauthAuthorizeProjectClaimParams struct { + // ProjectRef Project ref + ProjectRef string `form:"project_ref" json:"project_ref"` + ClientId openapi_types.UUID `form:"client_id" json:"client_id"` + ResponseType V1OauthAuthorizeProjectClaimParamsResponseType `form:"response_type" json:"response_type"` + RedirectUri string `form:"redirect_uri" json:"redirect_uri"` + State *string `form:"state,omitempty" json:"state,omitempty"` + ResponseMode *string `form:"response_mode,omitempty" json:"response_mode,omitempty"` + CodeChallenge *string `form:"code_challenge,omitempty" json:"code_challenge,omitempty"` + CodeChallengeMethod *V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod `form:"code_challenge_method,omitempty" json:"code_challenge_method,omitempty"` +} + +// V1OauthAuthorizeProjectClaimParamsResponseType defines parameters for V1OauthAuthorizeProjectClaim. +type V1OauthAuthorizeProjectClaimParamsResponseType string + +// V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod defines parameters for V1OauthAuthorizeProjectClaim. +type V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod string + +// GetSecurityAdvisorsParams defines parameters for GetSecurityAdvisors. +type GetSecurityAdvisorsParams struct { + LintType *GetSecurityAdvisorsParamsLintType `form:"lint_type,omitempty" json:"lint_type,omitempty"` +} + +// GetSecurityAdvisorsParamsLintType defines parameters for GetSecurityAdvisors. +type GetSecurityAdvisorsParamsLintType string + // GetLogsParams defines parameters for GetLogs. type GetLogsParams struct { Sql *string `form:"sql,omitempty" json:"sql,omitempty"` @@ -2863,6 +3008,11 @@ type UpdateApiKeyParams struct { Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` } +// V1GetRestorePointParams defines parameters for V1GetRestorePoint. +type V1GetRestorePointParams struct { + Name *string `form:"name,omitempty" json:"name,omitempty"` +} + // V1ApplyAMigrationParams defines parameters for V1ApplyAMigration. type V1ApplyAMigrationParams struct { // IdempotencyKey A unique key to ensure the same migration is tracked only once. @@ -3018,6 +3168,12 @@ type V1UpdateHostnameConfigJSONRequestBody = UpdateCustomHostnameBody // V1RestorePitrBackupJSONRequestBody defines body for V1RestorePitrBackup for application/json ContentType. type V1RestorePitrBackupJSONRequestBody = V1RestorePitrBody +// V1CreateRestorePointJSONRequestBody defines body for V1CreateRestorePoint for application/json ContentType. +type V1CreateRestorePointJSONRequestBody = V1RestorePointPostBody + +// V1UndoJSONRequestBody defines body for V1Undo for application/json ContentType. +type V1UndoJSONRequestBody = V1UndoBody + // V1ApplyAMigrationJSONRequestBody defines body for V1ApplyAMigration for application/json ContentType. type V1ApplyAMigrationJSONRequestBody = V1CreateMigrationBody From 66916d4136ce2ba73bbea5145a8ec34fab4d3e97 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Wed, 18 Jun 2025 11:58:52 +0200 Subject: [PATCH 06/40] chore: sync API types from infrastructure (#3733) Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> --- pkg/api/client.gen.go | 856 +++++++++++++++++++++--------------------- pkg/api/types.gen.go | 84 ++--- 2 files changed, 470 insertions(+), 470 deletions(-) diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index 0527d078a..a00065344 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -169,45 +169,45 @@ type ClientInterface interface { // V1GetProject request V1GetProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetPerformanceAdvisors request - GetPerformanceAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetPerformanceAdvisors request + V1GetPerformanceAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetSecurityAdvisors request - GetSecurityAdvisors(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetSecurityAdvisors request + V1GetSecurityAdvisors(ctx context.Context, ref string, params *V1GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetLogs request - GetLogs(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectLogs request + V1GetProjectLogs(ctx context.Context, ref string, params *V1GetProjectLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiCounts request - GetApiCounts(ctx context.Context, ref string, params *GetApiCountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectUsageApiCount request + V1GetProjectUsageApiCount(ctx context.Context, ref string, params *V1GetProjectUsageApiCountParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiRequestsCount request - GetApiRequestsCount(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectUsageRequestCount request + V1GetProjectUsageRequestCount(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) // V1GetProjectApiKeys request V1GetProjectApiKeys(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // CreateApiKeyWithBody request with any body - CreateApiKeyWithBody(ctx context.Context, ref string, params *CreateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1CreateProjectApiKeyWithBody request with any body + V1CreateProjectApiKeyWithBody(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - CreateApiKey(ctx context.Context, ref string, params *CreateApiKeyParams, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + V1CreateProjectApiKey(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, body V1CreateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // CheckLegacyApiKeys request - CheckLegacyApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectLegacyApiKeys request + V1GetProjectLegacyApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // UpdateLegacyApiKeys request - UpdateLegacyApiKeys(ctx context.Context, ref string, params *UpdateLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1UpdateProjectLegacyApiKeys request + V1UpdateProjectLegacyApiKeys(ctx context.Context, ref string, params *V1UpdateProjectLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteApiKey request - DeleteApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1DeleteProjectApiKey request + V1DeleteProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1DeleteProjectApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiKey request - GetApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *GetApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectApiKey request + V1GetProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1GetProjectApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // UpdateApiKeyWithBody request with any body - UpdateApiKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1UpdateProjectApiKeyWithBody request with any body + V1UpdateProjectApiKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - UpdateApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, body UpdateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + V1UpdateProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, body V1UpdateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // V1ListProjectAddons request V1ListProjectAddons(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -248,24 +248,24 @@ type ClientInterface interface { V1UpdateAuthServiceConfig(ctx context.Context, ref string, body V1UpdateAuthServiceConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // ListSigningKeysForProject request - ListSigningKeysForProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectSigningKeys request + V1GetProjectSigningKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // CreateSigningKeyForProjectWithBody request with any body - CreateSigningKeyForProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1CreateProjectSigningKeyWithBody request with any body + V1CreateProjectSigningKeyWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - CreateSigningKeyForProject(ctx context.Context, ref string, body CreateSigningKeyForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + V1CreateProjectSigningKey(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteSigningKey request - DeleteSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1RemoveProjectSigningKey request + V1RemoveProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetSigningKeyForProject request - GetSigningKeyForProject(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectSigningKey request + V1GetProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) - // PatchSigningKeyWithBody request with any body - PatchSigningKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1UpdateProjectSigningKeyWithBody request with any body + V1UpdateProjectSigningKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PatchSigningKey(ctx context.Context, ref string, id openapi_types.UUID, body PatchSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + V1UpdateProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, body V1UpdateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // V1ListAllSsoProvider request V1ListAllSsoProvider(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -286,19 +286,19 @@ type ClientInterface interface { V1UpdateASsoProvider(ctx context.Context, ref string, providerId openapi_types.UUID, body V1UpdateASsoProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // ListTPAForProject request - ListTPAForProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1ListProjectTpaIntegrations request + V1ListProjectTpaIntegrations(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // CreateTPAForProjectWithBody request with any body - CreateTPAForProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1CreateProjectTpaIntegrationWithBody request with any body + V1CreateProjectTpaIntegrationWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - CreateTPAForProject(ctx context.Context, ref string, body CreateTPAForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + V1CreateProjectTpaIntegration(ctx context.Context, ref string, body V1CreateProjectTpaIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteTPAForProject request - DeleteTPAForProject(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1DeleteProjectTpaIntegration request + V1DeleteProjectTpaIntegration(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetTPAForProject request - GetTPAForProject(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectTpaIntegration request + V1GetProjectTpaIntegration(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // V1GetProjectPgbouncerConfig request V1GetProjectPgbouncerConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -365,8 +365,8 @@ type ClientInterface interface { V1Undo(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetDatabaseMetadata request - GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetDatabaseMetadata request + V1GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) // V1ListMigrationHistory request V1ListMigrationHistory(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -894,8 +894,8 @@ func (c *Client) V1GetProject(ctx context.Context, ref string, reqEditors ...Req return c.Client.Do(req) } -func (c *Client) GetPerformanceAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetPerformanceAdvisorsRequest(c.Server, ref) +func (c *Client) V1GetPerformanceAdvisors(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetPerformanceAdvisorsRequest(c.Server, ref) if err != nil { return nil, err } @@ -906,8 +906,8 @@ func (c *Client) GetPerformanceAdvisors(ctx context.Context, ref string, reqEdit return c.Client.Do(req) } -func (c *Client) GetSecurityAdvisors(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSecurityAdvisorsRequest(c.Server, ref, params) +func (c *Client) V1GetSecurityAdvisors(ctx context.Context, ref string, params *V1GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetSecurityAdvisorsRequest(c.Server, ref, params) if err != nil { return nil, err } @@ -918,8 +918,8 @@ func (c *Client) GetSecurityAdvisors(ctx context.Context, ref string, params *Ge return c.Client.Do(req) } -func (c *Client) GetLogs(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLogsRequest(c.Server, ref, params) +func (c *Client) V1GetProjectLogs(ctx context.Context, ref string, params *V1GetProjectLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectLogsRequest(c.Server, ref, params) if err != nil { return nil, err } @@ -930,8 +930,8 @@ func (c *Client) GetLogs(ctx context.Context, ref string, params *GetLogsParams, return c.Client.Do(req) } -func (c *Client) GetApiCounts(ctx context.Context, ref string, params *GetApiCountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetApiCountsRequest(c.Server, ref, params) +func (c *Client) V1GetProjectUsageApiCount(ctx context.Context, ref string, params *V1GetProjectUsageApiCountParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectUsageApiCountRequest(c.Server, ref, params) if err != nil { return nil, err } @@ -942,8 +942,8 @@ func (c *Client) GetApiCounts(ctx context.Context, ref string, params *GetApiCou return c.Client.Do(req) } -func (c *Client) GetApiRequestsCount(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetApiRequestsCountRequest(c.Server, ref) +func (c *Client) V1GetProjectUsageRequestCount(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectUsageRequestCountRequest(c.Server, ref) if err != nil { return nil, err } @@ -966,8 +966,8 @@ func (c *Client) V1GetProjectApiKeys(ctx context.Context, ref string, params *V1 return c.Client.Do(req) } -func (c *Client) CreateApiKeyWithBody(ctx context.Context, ref string, params *CreateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateApiKeyRequestWithBody(c.Server, ref, params, contentType, body) +func (c *Client) V1CreateProjectApiKeyWithBody(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectApiKeyRequestWithBody(c.Server, ref, params, contentType, body) if err != nil { return nil, err } @@ -978,8 +978,8 @@ func (c *Client) CreateApiKeyWithBody(ctx context.Context, ref string, params *C return c.Client.Do(req) } -func (c *Client) CreateApiKey(ctx context.Context, ref string, params *CreateApiKeyParams, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateApiKeyRequest(c.Server, ref, params, body) +func (c *Client) V1CreateProjectApiKey(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, body V1CreateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectApiKeyRequest(c.Server, ref, params, body) if err != nil { return nil, err } @@ -990,8 +990,8 @@ func (c *Client) CreateApiKey(ctx context.Context, ref string, params *CreateApi return c.Client.Do(req) } -func (c *Client) CheckLegacyApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCheckLegacyApiKeysRequest(c.Server, ref) +func (c *Client) V1GetProjectLegacyApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectLegacyApiKeysRequest(c.Server, ref) if err != nil { return nil, err } @@ -1002,8 +1002,8 @@ func (c *Client) CheckLegacyApiKeys(ctx context.Context, ref string, reqEditors return c.Client.Do(req) } -func (c *Client) UpdateLegacyApiKeys(ctx context.Context, ref string, params *UpdateLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateLegacyApiKeysRequest(c.Server, ref, params) +func (c *Client) V1UpdateProjectLegacyApiKeys(ctx context.Context, ref string, params *V1UpdateProjectLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateProjectLegacyApiKeysRequest(c.Server, ref, params) if err != nil { return nil, err } @@ -1014,8 +1014,8 @@ func (c *Client) UpdateLegacyApiKeys(ctx context.Context, ref string, params *Up return c.Client.Do(req) } -func (c *Client) DeleteApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteApiKeyRequest(c.Server, ref, id, params) +func (c *Client) V1DeleteProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1DeleteProjectApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteProjectApiKeyRequest(c.Server, ref, id, params) if err != nil { return nil, err } @@ -1026,8 +1026,8 @@ func (c *Client) DeleteApiKey(ctx context.Context, ref string, id openapi_types. return c.Client.Do(req) } -func (c *Client) GetApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *GetApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetApiKeyRequest(c.Server, ref, id, params) +func (c *Client) V1GetProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1GetProjectApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectApiKeyRequest(c.Server, ref, id, params) if err != nil { return nil, err } @@ -1038,8 +1038,8 @@ func (c *Client) GetApiKey(ctx context.Context, ref string, id openapi_types.UUI return c.Client.Do(req) } -func (c *Client) UpdateApiKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateApiKeyRequestWithBody(c.Server, ref, id, params, contentType, body) +func (c *Client) V1UpdateProjectApiKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateProjectApiKeyRequestWithBody(c.Server, ref, id, params, contentType, body) if err != nil { return nil, err } @@ -1050,8 +1050,8 @@ func (c *Client) UpdateApiKeyWithBody(ctx context.Context, ref string, id openap return c.Client.Do(req) } -func (c *Client) UpdateApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, body UpdateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateApiKeyRequest(c.Server, ref, id, params, body) +func (c *Client) V1UpdateProjectApiKey(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, body V1UpdateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateProjectApiKeyRequest(c.Server, ref, id, params, body) if err != nil { return nil, err } @@ -1230,8 +1230,8 @@ func (c *Client) V1UpdateAuthServiceConfig(ctx context.Context, ref string, body return c.Client.Do(req) } -func (c *Client) ListSigningKeysForProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSigningKeysForProjectRequest(c.Server, ref) +func (c *Client) V1GetProjectSigningKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectSigningKeysRequest(c.Server, ref) if err != nil { return nil, err } @@ -1242,8 +1242,8 @@ func (c *Client) ListSigningKeysForProject(ctx context.Context, ref string, reqE return c.Client.Do(req) } -func (c *Client) CreateSigningKeyForProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSigningKeyForProjectRequestWithBody(c.Server, ref, contentType, body) +func (c *Client) V1CreateProjectSigningKeyWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectSigningKeyRequestWithBody(c.Server, ref, contentType, body) if err != nil { return nil, err } @@ -1254,8 +1254,8 @@ func (c *Client) CreateSigningKeyForProjectWithBody(ctx context.Context, ref str return c.Client.Do(req) } -func (c *Client) CreateSigningKeyForProject(ctx context.Context, ref string, body CreateSigningKeyForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSigningKeyForProjectRequest(c.Server, ref, body) +func (c *Client) V1CreateProjectSigningKey(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectSigningKeyRequest(c.Server, ref, body) if err != nil { return nil, err } @@ -1266,8 +1266,8 @@ func (c *Client) CreateSigningKeyForProject(ctx context.Context, ref string, bod return c.Client.Do(req) } -func (c *Client) DeleteSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSigningKeyRequest(c.Server, ref, id) +func (c *Client) V1RemoveProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1RemoveProjectSigningKeyRequest(c.Server, ref, id) if err != nil { return nil, err } @@ -1278,8 +1278,8 @@ func (c *Client) DeleteSigningKey(ctx context.Context, ref string, id openapi_ty return c.Client.Do(req) } -func (c *Client) GetSigningKeyForProject(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSigningKeyForProjectRequest(c.Server, ref, id) +func (c *Client) V1GetProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectSigningKeyRequest(c.Server, ref, id) if err != nil { return nil, err } @@ -1290,8 +1290,8 @@ func (c *Client) GetSigningKeyForProject(ctx context.Context, ref string, id ope return c.Client.Do(req) } -func (c *Client) PatchSigningKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchSigningKeyRequestWithBody(c.Server, ref, id, contentType, body) +func (c *Client) V1UpdateProjectSigningKeyWithBody(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateProjectSigningKeyRequestWithBody(c.Server, ref, id, contentType, body) if err != nil { return nil, err } @@ -1302,8 +1302,8 @@ func (c *Client) PatchSigningKeyWithBody(ctx context.Context, ref string, id ope return c.Client.Do(req) } -func (c *Client) PatchSigningKey(ctx context.Context, ref string, id openapi_types.UUID, body PatchSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchSigningKeyRequest(c.Server, ref, id, body) +func (c *Client) V1UpdateProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, body V1UpdateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateProjectSigningKeyRequest(c.Server, ref, id, body) if err != nil { return nil, err } @@ -1398,8 +1398,8 @@ func (c *Client) V1UpdateASsoProvider(ctx context.Context, ref string, providerI return c.Client.Do(req) } -func (c *Client) ListTPAForProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListTPAForProjectRequest(c.Server, ref) +func (c *Client) V1ListProjectTpaIntegrations(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListProjectTpaIntegrationsRequest(c.Server, ref) if err != nil { return nil, err } @@ -1410,8 +1410,8 @@ func (c *Client) ListTPAForProject(ctx context.Context, ref string, reqEditors . return c.Client.Do(req) } -func (c *Client) CreateTPAForProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateTPAForProjectRequestWithBody(c.Server, ref, contentType, body) +func (c *Client) V1CreateProjectTpaIntegrationWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectTpaIntegrationRequestWithBody(c.Server, ref, contentType, body) if err != nil { return nil, err } @@ -1422,8 +1422,8 @@ func (c *Client) CreateTPAForProjectWithBody(ctx context.Context, ref string, co return c.Client.Do(req) } -func (c *Client) CreateTPAForProject(ctx context.Context, ref string, body CreateTPAForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateTPAForProjectRequest(c.Server, ref, body) +func (c *Client) V1CreateProjectTpaIntegration(ctx context.Context, ref string, body V1CreateProjectTpaIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateProjectTpaIntegrationRequest(c.Server, ref, body) if err != nil { return nil, err } @@ -1434,8 +1434,8 @@ func (c *Client) CreateTPAForProject(ctx context.Context, ref string, body Creat return c.Client.Do(req) } -func (c *Client) DeleteTPAForProject(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteTPAForProjectRequest(c.Server, ref, tpaId) +func (c *Client) V1DeleteProjectTpaIntegration(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteProjectTpaIntegrationRequest(c.Server, ref, tpaId) if err != nil { return nil, err } @@ -1446,8 +1446,8 @@ func (c *Client) DeleteTPAForProject(ctx context.Context, ref string, tpaId open return c.Client.Do(req) } -func (c *Client) GetTPAForProject(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetTPAForProjectRequest(c.Server, ref, tpaId) +func (c *Client) V1GetProjectTpaIntegration(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectTpaIntegrationRequest(c.Server, ref, tpaId) if err != nil { return nil, err } @@ -1746,8 +1746,8 @@ func (c *Client) V1Undo(ctx context.Context, ref string, body V1UndoJSONRequestB return c.Client.Do(req) } -func (c *Client) GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDatabaseMetadataRequest(c.Server, ref) +func (c *Client) V1GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetDatabaseMetadataRequest(c.Server, ref) if err != nil { return nil, err } @@ -3576,8 +3576,8 @@ func NewV1GetProjectRequest(server string, ref string) (*http.Request, error) { return req, nil } -// NewGetPerformanceAdvisorsRequest generates requests for GetPerformanceAdvisors -func NewGetPerformanceAdvisorsRequest(server string, ref string) (*http.Request, error) { +// NewV1GetPerformanceAdvisorsRequest generates requests for V1GetPerformanceAdvisors +func NewV1GetPerformanceAdvisorsRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -3610,8 +3610,8 @@ func NewGetPerformanceAdvisorsRequest(server string, ref string) (*http.Request, return req, nil } -// NewGetSecurityAdvisorsRequest generates requests for GetSecurityAdvisors -func NewGetSecurityAdvisorsRequest(server string, ref string, params *GetSecurityAdvisorsParams) (*http.Request, error) { +// NewV1GetSecurityAdvisorsRequest generates requests for V1GetSecurityAdvisors +func NewV1GetSecurityAdvisorsRequest(server string, ref string, params *V1GetSecurityAdvisorsParams) (*http.Request, error) { var err error var pathParam0 string @@ -3666,8 +3666,8 @@ func NewGetSecurityAdvisorsRequest(server string, ref string, params *GetSecurit return req, nil } -// NewGetLogsRequest generates requests for GetLogs -func NewGetLogsRequest(server string, ref string, params *GetLogsParams) (*http.Request, error) { +// NewV1GetProjectLogsRequest generates requests for V1GetProjectLogs +func NewV1GetProjectLogsRequest(server string, ref string, params *V1GetProjectLogsParams) (*http.Request, error) { var err error var pathParam0 string @@ -3754,8 +3754,8 @@ func NewGetLogsRequest(server string, ref string, params *GetLogsParams) (*http. return req, nil } -// NewGetApiCountsRequest generates requests for GetApiCounts -func NewGetApiCountsRequest(server string, ref string, params *GetApiCountsParams) (*http.Request, error) { +// NewV1GetProjectUsageApiCountRequest generates requests for V1GetProjectUsageApiCount +func NewV1GetProjectUsageApiCountRequest(server string, ref string, params *V1GetProjectUsageApiCountParams) (*http.Request, error) { var err error var pathParam0 string @@ -3810,8 +3810,8 @@ func NewGetApiCountsRequest(server string, ref string, params *GetApiCountsParam return req, nil } -// NewGetApiRequestsCountRequest generates requests for GetApiRequestsCount -func NewGetApiRequestsCountRequest(server string, ref string) (*http.Request, error) { +// NewV1GetProjectUsageRequestCountRequest generates requests for V1GetProjectUsageRequestCount +func NewV1GetProjectUsageRequestCountRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -3900,19 +3900,19 @@ func NewV1GetProjectApiKeysRequest(server string, ref string, params *V1GetProje return req, nil } -// NewCreateApiKeyRequest calls the generic CreateApiKey builder with application/json body -func NewCreateApiKeyRequest(server string, ref string, params *CreateApiKeyParams, body CreateApiKeyJSONRequestBody) (*http.Request, error) { +// NewV1CreateProjectApiKeyRequest calls the generic V1CreateProjectApiKey builder with application/json body +func NewV1CreateProjectApiKeyRequest(server string, ref string, params *V1CreateProjectApiKeyParams, body V1CreateProjectApiKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateApiKeyRequestWithBody(server, ref, params, "application/json", bodyReader) + return NewV1CreateProjectApiKeyRequestWithBody(server, ref, params, "application/json", bodyReader) } -// NewCreateApiKeyRequestWithBody generates requests for CreateApiKey with any type of body -func NewCreateApiKeyRequestWithBody(server string, ref string, params *CreateApiKeyParams, contentType string, body io.Reader) (*http.Request, error) { +// NewV1CreateProjectApiKeyRequestWithBody generates requests for V1CreateProjectApiKey with any type of body +func NewV1CreateProjectApiKeyRequestWithBody(server string, ref string, params *V1CreateProjectApiKeyParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3969,8 +3969,8 @@ func NewCreateApiKeyRequestWithBody(server string, ref string, params *CreateApi return req, nil } -// NewCheckLegacyApiKeysRequest generates requests for CheckLegacyApiKeys -func NewCheckLegacyApiKeysRequest(server string, ref string) (*http.Request, error) { +// NewV1GetProjectLegacyApiKeysRequest generates requests for V1GetProjectLegacyApiKeys +func NewV1GetProjectLegacyApiKeysRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -4003,8 +4003,8 @@ func NewCheckLegacyApiKeysRequest(server string, ref string) (*http.Request, err return req, nil } -// NewUpdateLegacyApiKeysRequest generates requests for UpdateLegacyApiKeys -func NewUpdateLegacyApiKeysRequest(server string, ref string, params *UpdateLegacyApiKeysParams) (*http.Request, error) { +// NewV1UpdateProjectLegacyApiKeysRequest generates requests for V1UpdateProjectLegacyApiKeys +func NewV1UpdateProjectLegacyApiKeysRequest(server string, ref string, params *V1UpdateProjectLegacyApiKeysParams) (*http.Request, error) { var err error var pathParam0 string @@ -4055,8 +4055,8 @@ func NewUpdateLegacyApiKeysRequest(server string, ref string, params *UpdateLega return req, nil } -// NewDeleteApiKeyRequest generates requests for DeleteApiKey -func NewDeleteApiKeyRequest(server string, ref string, id openapi_types.UUID, params *DeleteApiKeyParams) (*http.Request, error) { +// NewV1DeleteProjectApiKeyRequest generates requests for V1DeleteProjectApiKey +func NewV1DeleteProjectApiKeyRequest(server string, ref string, id openapi_types.UUID, params *V1DeleteProjectApiKeyParams) (*http.Request, error) { var err error var pathParam0 string @@ -4150,8 +4150,8 @@ func NewDeleteApiKeyRequest(server string, ref string, id openapi_types.UUID, pa return req, nil } -// NewGetApiKeyRequest generates requests for GetApiKey -func NewGetApiKeyRequest(server string, ref string, id openapi_types.UUID, params *GetApiKeyParams) (*http.Request, error) { +// NewV1GetProjectApiKeyRequest generates requests for V1GetProjectApiKey +func NewV1GetProjectApiKeyRequest(server string, ref string, id openapi_types.UUID, params *V1GetProjectApiKeyParams) (*http.Request, error) { var err error var pathParam0 string @@ -4213,19 +4213,19 @@ func NewGetApiKeyRequest(server string, ref string, id openapi_types.UUID, param return req, nil } -// NewUpdateApiKeyRequest calls the generic UpdateApiKey builder with application/json body -func NewUpdateApiKeyRequest(server string, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, body UpdateApiKeyJSONRequestBody) (*http.Request, error) { +// NewV1UpdateProjectApiKeyRequest calls the generic V1UpdateProjectApiKey builder with application/json body +func NewV1UpdateProjectApiKeyRequest(server string, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, body V1UpdateProjectApiKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewUpdateApiKeyRequestWithBody(server, ref, id, params, "application/json", bodyReader) + return NewV1UpdateProjectApiKeyRequestWithBody(server, ref, id, params, "application/json", bodyReader) } -// NewUpdateApiKeyRequestWithBody generates requests for UpdateApiKey with any type of body -func NewUpdateApiKeyRequestWithBody(server string, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, contentType string, body io.Reader) (*http.Request, error) { +// NewV1UpdateProjectApiKeyRequestWithBody generates requests for V1UpdateProjectApiKey with any type of body +func NewV1UpdateProjectApiKeyRequestWithBody(server string, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -4709,8 +4709,8 @@ func NewV1UpdateAuthServiceConfigRequestWithBody(server string, ref string, cont return req, nil } -// NewListSigningKeysForProjectRequest generates requests for ListSigningKeysForProject -func NewListSigningKeysForProjectRequest(server string, ref string) (*http.Request, error) { +// NewV1GetProjectSigningKeysRequest generates requests for V1GetProjectSigningKeys +func NewV1GetProjectSigningKeysRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -4743,19 +4743,19 @@ func NewListSigningKeysForProjectRequest(server string, ref string) (*http.Reque return req, nil } -// NewCreateSigningKeyForProjectRequest calls the generic CreateSigningKeyForProject builder with application/json body -func NewCreateSigningKeyForProjectRequest(server string, ref string, body CreateSigningKeyForProjectJSONRequestBody) (*http.Request, error) { +// NewV1CreateProjectSigningKeyRequest calls the generic V1CreateProjectSigningKey builder with application/json body +func NewV1CreateProjectSigningKeyRequest(server string, ref string, body V1CreateProjectSigningKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateSigningKeyForProjectRequestWithBody(server, ref, "application/json", bodyReader) + return NewV1CreateProjectSigningKeyRequestWithBody(server, ref, "application/json", bodyReader) } -// NewCreateSigningKeyForProjectRequestWithBody generates requests for CreateSigningKeyForProject with any type of body -func NewCreateSigningKeyForProjectRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { +// NewV1CreateProjectSigningKeyRequestWithBody generates requests for V1CreateProjectSigningKey with any type of body +func NewV1CreateProjectSigningKeyRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -4790,8 +4790,8 @@ func NewCreateSigningKeyForProjectRequestWithBody(server string, ref string, con return req, nil } -// NewDeleteSigningKeyRequest generates requests for DeleteSigningKey -func NewDeleteSigningKeyRequest(server string, ref string, id openapi_types.UUID) (*http.Request, error) { +// NewV1RemoveProjectSigningKeyRequest generates requests for V1RemoveProjectSigningKey +func NewV1RemoveProjectSigningKeyRequest(server string, ref string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -4831,8 +4831,8 @@ func NewDeleteSigningKeyRequest(server string, ref string, id openapi_types.UUID return req, nil } -// NewGetSigningKeyForProjectRequest generates requests for GetSigningKeyForProject -func NewGetSigningKeyForProjectRequest(server string, ref string, id openapi_types.UUID) (*http.Request, error) { +// NewV1GetProjectSigningKeyRequest generates requests for V1GetProjectSigningKey +func NewV1GetProjectSigningKeyRequest(server string, ref string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -4872,19 +4872,19 @@ func NewGetSigningKeyForProjectRequest(server string, ref string, id openapi_typ return req, nil } -// NewPatchSigningKeyRequest calls the generic PatchSigningKey builder with application/json body -func NewPatchSigningKeyRequest(server string, ref string, id openapi_types.UUID, body PatchSigningKeyJSONRequestBody) (*http.Request, error) { +// NewV1UpdateProjectSigningKeyRequest calls the generic V1UpdateProjectSigningKey builder with application/json body +func NewV1UpdateProjectSigningKeyRequest(server string, ref string, id openapi_types.UUID, body V1UpdateProjectSigningKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPatchSigningKeyRequestWithBody(server, ref, id, "application/json", bodyReader) + return NewV1UpdateProjectSigningKeyRequestWithBody(server, ref, id, "application/json", bodyReader) } -// NewPatchSigningKeyRequestWithBody generates requests for PatchSigningKey with any type of body -func NewPatchSigningKeyRequestWithBody(server string, ref string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { +// NewV1UpdateProjectSigningKeyRequestWithBody generates requests for V1UpdateProjectSigningKey with any type of body +func NewV1UpdateProjectSigningKeyRequestWithBody(server string, ref string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -5143,8 +5143,8 @@ func NewV1UpdateASsoProviderRequestWithBody(server string, ref string, providerI return req, nil } -// NewListTPAForProjectRequest generates requests for ListTPAForProject -func NewListTPAForProjectRequest(server string, ref string) (*http.Request, error) { +// NewV1ListProjectTpaIntegrationsRequest generates requests for V1ListProjectTpaIntegrations +func NewV1ListProjectTpaIntegrationsRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -5177,19 +5177,19 @@ func NewListTPAForProjectRequest(server string, ref string) (*http.Request, erro return req, nil } -// NewCreateTPAForProjectRequest calls the generic CreateTPAForProject builder with application/json body -func NewCreateTPAForProjectRequest(server string, ref string, body CreateTPAForProjectJSONRequestBody) (*http.Request, error) { +// NewV1CreateProjectTpaIntegrationRequest calls the generic V1CreateProjectTpaIntegration builder with application/json body +func NewV1CreateProjectTpaIntegrationRequest(server string, ref string, body V1CreateProjectTpaIntegrationJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateTPAForProjectRequestWithBody(server, ref, "application/json", bodyReader) + return NewV1CreateProjectTpaIntegrationRequestWithBody(server, ref, "application/json", bodyReader) } -// NewCreateTPAForProjectRequestWithBody generates requests for CreateTPAForProject with any type of body -func NewCreateTPAForProjectRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { +// NewV1CreateProjectTpaIntegrationRequestWithBody generates requests for V1CreateProjectTpaIntegration with any type of body +func NewV1CreateProjectTpaIntegrationRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -5224,8 +5224,8 @@ func NewCreateTPAForProjectRequestWithBody(server string, ref string, contentTyp return req, nil } -// NewDeleteTPAForProjectRequest generates requests for DeleteTPAForProject -func NewDeleteTPAForProjectRequest(server string, ref string, tpaId openapi_types.UUID) (*http.Request, error) { +// NewV1DeleteProjectTpaIntegrationRequest generates requests for V1DeleteProjectTpaIntegration +func NewV1DeleteProjectTpaIntegrationRequest(server string, ref string, tpaId openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -5265,8 +5265,8 @@ func NewDeleteTPAForProjectRequest(server string, ref string, tpaId openapi_type return req, nil } -// NewGetTPAForProjectRequest generates requests for GetTPAForProject -func NewGetTPAForProjectRequest(server string, ref string, tpaId openapi_types.UUID) (*http.Request, error) { +// NewV1GetProjectTpaIntegrationRequest generates requests for V1GetProjectTpaIntegration +func NewV1GetProjectTpaIntegrationRequest(server string, ref string, tpaId openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -5997,8 +5997,8 @@ func NewV1UndoRequestWithBody(server string, ref string, contentType string, bod return req, nil } -// NewGetDatabaseMetadataRequest generates requests for GetDatabaseMetadata -func NewGetDatabaseMetadataRequest(server string, ref string) (*http.Request, error) { +// NewV1GetDatabaseMetadataRequest generates requests for V1GetDatabaseMetadata +func NewV1GetDatabaseMetadataRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -8444,45 +8444,45 @@ type ClientWithResponsesInterface interface { // V1GetProjectWithResponse request V1GetProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectResponse, error) - // GetPerformanceAdvisorsWithResponse request - GetPerformanceAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPerformanceAdvisorsResponse, error) + // V1GetPerformanceAdvisorsWithResponse request + V1GetPerformanceAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetPerformanceAdvisorsResponse, error) - // GetSecurityAdvisorsWithResponse request - GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) + // V1GetSecurityAdvisorsWithResponse request + V1GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *V1GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*V1GetSecurityAdvisorsResponse, error) - // GetLogsWithResponse request - GetLogsWithResponse(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*GetLogsResponse, error) + // V1GetProjectLogsWithResponse request + V1GetProjectLogsWithResponse(ctx context.Context, ref string, params *V1GetProjectLogsParams, reqEditors ...RequestEditorFn) (*V1GetProjectLogsResponse, error) - // GetApiCountsWithResponse request - GetApiCountsWithResponse(ctx context.Context, ref string, params *GetApiCountsParams, reqEditors ...RequestEditorFn) (*GetApiCountsResponse, error) + // V1GetProjectUsageApiCountWithResponse request + V1GetProjectUsageApiCountWithResponse(ctx context.Context, ref string, params *V1GetProjectUsageApiCountParams, reqEditors ...RequestEditorFn) (*V1GetProjectUsageApiCountResponse, error) - // GetApiRequestsCountWithResponse request - GetApiRequestsCountWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetApiRequestsCountResponse, error) + // V1GetProjectUsageRequestCountWithResponse request + V1GetProjectUsageRequestCountWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectUsageRequestCountResponse, error) // V1GetProjectApiKeysWithResponse request V1GetProjectApiKeysWithResponse(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*V1GetProjectApiKeysResponse, error) - // CreateApiKeyWithBodyWithResponse request with any body - CreateApiKeyWithBodyWithResponse(ctx context.Context, ref string, params *CreateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) + // V1CreateProjectApiKeyWithBodyWithResponse request with any body + V1CreateProjectApiKeyWithBodyWithResponse(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectApiKeyResponse, error) - CreateApiKeyWithResponse(ctx context.Context, ref string, params *CreateApiKeyParams, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) + V1CreateProjectApiKeyWithResponse(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, body V1CreateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectApiKeyResponse, error) - // CheckLegacyApiKeysWithResponse request - CheckLegacyApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*CheckLegacyApiKeysResponse, error) + // V1GetProjectLegacyApiKeysWithResponse request + V1GetProjectLegacyApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectLegacyApiKeysResponse, error) - // UpdateLegacyApiKeysWithResponse request - UpdateLegacyApiKeysWithResponse(ctx context.Context, ref string, params *UpdateLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*UpdateLegacyApiKeysResponse, error) + // V1UpdateProjectLegacyApiKeysWithResponse request + V1UpdateProjectLegacyApiKeysWithResponse(ctx context.Context, ref string, params *V1UpdateProjectLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*V1UpdateProjectLegacyApiKeysResponse, error) - // DeleteApiKeyWithResponse request - DeleteApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error) + // V1DeleteProjectApiKeyWithResponse request + V1DeleteProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1DeleteProjectApiKeyParams, reqEditors ...RequestEditorFn) (*V1DeleteProjectApiKeyResponse, error) - // GetApiKeyWithResponse request - GetApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *GetApiKeyParams, reqEditors ...RequestEditorFn) (*GetApiKeyResponse, error) + // V1GetProjectApiKeyWithResponse request + V1GetProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1GetProjectApiKeyParams, reqEditors ...RequestEditorFn) (*V1GetProjectApiKeyResponse, error) - // UpdateApiKeyWithBodyWithResponse request with any body - UpdateApiKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateApiKeyResponse, error) + // V1UpdateProjectApiKeyWithBodyWithResponse request with any body + V1UpdateProjectApiKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateProjectApiKeyResponse, error) - UpdateApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, body UpdateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateApiKeyResponse, error) + V1UpdateProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, body V1UpdateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateProjectApiKeyResponse, error) // V1ListProjectAddonsWithResponse request V1ListProjectAddonsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListProjectAddonsResponse, error) @@ -8523,24 +8523,24 @@ type ClientWithResponsesInterface interface { V1UpdateAuthServiceConfigWithResponse(ctx context.Context, ref string, body V1UpdateAuthServiceConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateAuthServiceConfigResponse, error) - // ListSigningKeysForProjectWithResponse request - ListSigningKeysForProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListSigningKeysForProjectResponse, error) + // V1GetProjectSigningKeysWithResponse request + V1GetProjectSigningKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectSigningKeysResponse, error) - // CreateSigningKeyForProjectWithBodyWithResponse request with any body - CreateSigningKeyForProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSigningKeyForProjectResponse, error) + // V1CreateProjectSigningKeyWithBodyWithResponse request with any body + V1CreateProjectSigningKeyWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectSigningKeyResponse, error) - CreateSigningKeyForProjectWithResponse(ctx context.Context, ref string, body CreateSigningKeyForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSigningKeyForProjectResponse, error) + V1CreateProjectSigningKeyWithResponse(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectSigningKeyResponse, error) - // DeleteSigningKeyWithResponse request - DeleteSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteSigningKeyResponse, error) + // V1RemoveProjectSigningKeyWithResponse request + V1RemoveProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1RemoveProjectSigningKeyResponse, error) - // GetSigningKeyForProjectWithResponse request - GetSigningKeyForProjectWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetSigningKeyForProjectResponse, error) + // V1GetProjectSigningKeyWithResponse request + V1GetProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetProjectSigningKeyResponse, error) - // PatchSigningKeyWithBodyWithResponse request with any body - PatchSigningKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchSigningKeyResponse, error) + // V1UpdateProjectSigningKeyWithBodyWithResponse request with any body + V1UpdateProjectSigningKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateProjectSigningKeyResponse, error) - PatchSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, body PatchSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchSigningKeyResponse, error) + V1UpdateProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, body V1UpdateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateProjectSigningKeyResponse, error) // V1ListAllSsoProviderWithResponse request V1ListAllSsoProviderWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListAllSsoProviderResponse, error) @@ -8561,19 +8561,19 @@ type ClientWithResponsesInterface interface { V1UpdateASsoProviderWithResponse(ctx context.Context, ref string, providerId openapi_types.UUID, body V1UpdateASsoProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateASsoProviderResponse, error) - // ListTPAForProjectWithResponse request - ListTPAForProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListTPAForProjectResponse, error) + // V1ListProjectTpaIntegrationsWithResponse request + V1ListProjectTpaIntegrationsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListProjectTpaIntegrationsResponse, error) - // CreateTPAForProjectWithBodyWithResponse request with any body - CreateTPAForProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTPAForProjectResponse, error) + // V1CreateProjectTpaIntegrationWithBodyWithResponse request with any body + V1CreateProjectTpaIntegrationWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectTpaIntegrationResponse, error) - CreateTPAForProjectWithResponse(ctx context.Context, ref string, body CreateTPAForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTPAForProjectResponse, error) + V1CreateProjectTpaIntegrationWithResponse(ctx context.Context, ref string, body V1CreateProjectTpaIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectTpaIntegrationResponse, error) - // DeleteTPAForProjectWithResponse request - DeleteTPAForProjectWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteTPAForProjectResponse, error) + // V1DeleteProjectTpaIntegrationWithResponse request + V1DeleteProjectTpaIntegrationWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1DeleteProjectTpaIntegrationResponse, error) - // GetTPAForProjectWithResponse request - GetTPAForProjectWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetTPAForProjectResponse, error) + // V1GetProjectTpaIntegrationWithResponse request + V1GetProjectTpaIntegrationWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetProjectTpaIntegrationResponse, error) // V1GetProjectPgbouncerConfigWithResponse request V1GetProjectPgbouncerConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectPgbouncerConfigResponse, error) @@ -8640,8 +8640,8 @@ type ClientWithResponsesInterface interface { V1UndoWithResponse(ctx context.Context, ref string, body V1UndoJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) - // GetDatabaseMetadataWithResponse request - GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) + // V1GetDatabaseMetadataWithResponse request + V1GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetDatabaseMetadataResponse, error) // V1ListMigrationHistoryWithResponse request V1ListMigrationHistoryWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListMigrationHistoryResponse, error) @@ -9278,14 +9278,14 @@ func (r V1GetProjectResponse) StatusCode() int { return 0 } -type GetPerformanceAdvisorsResponse struct { +type V1GetPerformanceAdvisorsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *V1ProjectAdvisorsResponse } // Status returns HTTPResponse.Status -func (r GetPerformanceAdvisorsResponse) Status() string { +func (r V1GetPerformanceAdvisorsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9293,21 +9293,21 @@ func (r GetPerformanceAdvisorsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetPerformanceAdvisorsResponse) StatusCode() int { +func (r V1GetPerformanceAdvisorsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetSecurityAdvisorsResponse struct { +type V1GetSecurityAdvisorsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *V1ProjectAdvisorsResponse } // Status returns HTTPResponse.Status -func (r GetSecurityAdvisorsResponse) Status() string { +func (r V1GetSecurityAdvisorsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9315,21 +9315,21 @@ func (r GetSecurityAdvisorsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetSecurityAdvisorsResponse) StatusCode() int { +func (r V1GetSecurityAdvisorsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetLogsResponse struct { +type V1GetProjectLogsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *AnalyticsResponse } // Status returns HTTPResponse.Status -func (r GetLogsResponse) Status() string { +func (r V1GetProjectLogsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9337,21 +9337,21 @@ func (r GetLogsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetLogsResponse) StatusCode() int { +func (r V1GetProjectLogsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetApiCountsResponse struct { +type V1GetProjectUsageApiCountResponse struct { Body []byte HTTPResponse *http.Response JSON200 *AnalyticsResponse } // Status returns HTTPResponse.Status -func (r GetApiCountsResponse) Status() string { +func (r V1GetProjectUsageApiCountResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9359,21 +9359,21 @@ func (r GetApiCountsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetApiCountsResponse) StatusCode() int { +func (r V1GetProjectUsageApiCountResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetApiRequestsCountResponse struct { +type V1GetProjectUsageRequestCountResponse struct { Body []byte HTTPResponse *http.Response JSON200 *AnalyticsResponse } // Status returns HTTPResponse.Status -func (r GetApiRequestsCountResponse) Status() string { +func (r V1GetProjectUsageRequestCountResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9381,7 +9381,7 @@ func (r GetApiRequestsCountResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetApiRequestsCountResponse) StatusCode() int { +func (r V1GetProjectUsageRequestCountResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -9410,14 +9410,14 @@ func (r V1GetProjectApiKeysResponse) StatusCode() int { return 0 } -type CreateApiKeyResponse struct { +type V1CreateProjectApiKeyResponse struct { Body []byte HTTPResponse *http.Response JSON201 *ApiKeyResponse } // Status returns HTTPResponse.Status -func (r CreateApiKeyResponse) Status() string { +func (r V1CreateProjectApiKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9425,21 +9425,21 @@ func (r CreateApiKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateApiKeyResponse) StatusCode() int { +func (r V1CreateProjectApiKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CheckLegacyApiKeysResponse struct { +type V1GetProjectLegacyApiKeysResponse struct { Body []byte HTTPResponse *http.Response JSON200 *LegacyApiKeysResponse } // Status returns HTTPResponse.Status -func (r CheckLegacyApiKeysResponse) Status() string { +func (r V1GetProjectLegacyApiKeysResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9447,21 +9447,21 @@ func (r CheckLegacyApiKeysResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CheckLegacyApiKeysResponse) StatusCode() int { +func (r V1GetProjectLegacyApiKeysResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type UpdateLegacyApiKeysResponse struct { +type V1UpdateProjectLegacyApiKeysResponse struct { Body []byte HTTPResponse *http.Response JSON200 *LegacyApiKeysResponse } // Status returns HTTPResponse.Status -func (r UpdateLegacyApiKeysResponse) Status() string { +func (r V1UpdateProjectLegacyApiKeysResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9469,21 +9469,21 @@ func (r UpdateLegacyApiKeysResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UpdateLegacyApiKeysResponse) StatusCode() int { +func (r V1UpdateProjectLegacyApiKeysResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteApiKeyResponse struct { +type V1DeleteProjectApiKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ApiKeyResponse } // Status returns HTTPResponse.Status -func (r DeleteApiKeyResponse) Status() string { +func (r V1DeleteProjectApiKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9491,21 +9491,21 @@ func (r DeleteApiKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteApiKeyResponse) StatusCode() int { +func (r V1DeleteProjectApiKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetApiKeyResponse struct { +type V1GetProjectApiKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ApiKeyResponse } // Status returns HTTPResponse.Status -func (r GetApiKeyResponse) Status() string { +func (r V1GetProjectApiKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9513,21 +9513,21 @@ func (r GetApiKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetApiKeyResponse) StatusCode() int { +func (r V1GetProjectApiKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type UpdateApiKeyResponse struct { +type V1UpdateProjectApiKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ApiKeyResponse } // Status returns HTTPResponse.Status -func (r UpdateApiKeyResponse) Status() string { +func (r V1UpdateProjectApiKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9535,7 +9535,7 @@ func (r UpdateApiKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UpdateApiKeyResponse) StatusCode() int { +func (r V1UpdateProjectApiKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -9780,14 +9780,14 @@ func (r V1UpdateAuthServiceConfigResponse) StatusCode() int { return 0 } -type ListSigningKeysForProjectResponse struct { +type V1GetProjectSigningKeysResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SigningKeysResponse } // Status returns HTTPResponse.Status -func (r ListSigningKeysForProjectResponse) Status() string { +func (r V1GetProjectSigningKeysResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9795,21 +9795,21 @@ func (r ListSigningKeysForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListSigningKeysForProjectResponse) StatusCode() int { +func (r V1GetProjectSigningKeysResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CreateSigningKeyForProjectResponse struct { +type V1CreateProjectSigningKeyResponse struct { Body []byte HTTPResponse *http.Response JSON201 *SigningKeyResponse } // Status returns HTTPResponse.Status -func (r CreateSigningKeyForProjectResponse) Status() string { +func (r V1CreateProjectSigningKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9817,21 +9817,21 @@ func (r CreateSigningKeyForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateSigningKeyForProjectResponse) StatusCode() int { +func (r V1CreateProjectSigningKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteSigningKeyResponse struct { +type V1RemoveProjectSigningKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SigningKeyResponse } // Status returns HTTPResponse.Status -func (r DeleteSigningKeyResponse) Status() string { +func (r V1RemoveProjectSigningKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9839,21 +9839,21 @@ func (r DeleteSigningKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteSigningKeyResponse) StatusCode() int { +func (r V1RemoveProjectSigningKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetSigningKeyForProjectResponse struct { +type V1GetProjectSigningKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SigningKeyResponse } // Status returns HTTPResponse.Status -func (r GetSigningKeyForProjectResponse) Status() string { +func (r V1GetProjectSigningKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9861,21 +9861,21 @@ func (r GetSigningKeyForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetSigningKeyForProjectResponse) StatusCode() int { +func (r V1GetProjectSigningKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type PatchSigningKeyResponse struct { +type V1UpdateProjectSigningKeyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SigningKeyResponse } // Status returns HTTPResponse.Status -func (r PatchSigningKeyResponse) Status() string { +func (r V1UpdateProjectSigningKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -9883,7 +9883,7 @@ func (r PatchSigningKeyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PatchSigningKeyResponse) StatusCode() int { +func (r V1UpdateProjectSigningKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -10000,14 +10000,14 @@ func (r V1UpdateASsoProviderResponse) StatusCode() int { return 0 } -type ListTPAForProjectResponse struct { +type V1ListProjectTpaIntegrationsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]ThirdPartyAuth } // Status returns HTTPResponse.Status -func (r ListTPAForProjectResponse) Status() string { +func (r V1ListProjectTpaIntegrationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10015,21 +10015,21 @@ func (r ListTPAForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListTPAForProjectResponse) StatusCode() int { +func (r V1ListProjectTpaIntegrationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CreateTPAForProjectResponse struct { +type V1CreateProjectTpaIntegrationResponse struct { Body []byte HTTPResponse *http.Response JSON201 *ThirdPartyAuth } // Status returns HTTPResponse.Status -func (r CreateTPAForProjectResponse) Status() string { +func (r V1CreateProjectTpaIntegrationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10037,21 +10037,21 @@ func (r CreateTPAForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateTPAForProjectResponse) StatusCode() int { +func (r V1CreateProjectTpaIntegrationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type DeleteTPAForProjectResponse struct { +type V1DeleteProjectTpaIntegrationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ThirdPartyAuth } // Status returns HTTPResponse.Status -func (r DeleteTPAForProjectResponse) Status() string { +func (r V1DeleteProjectTpaIntegrationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10059,21 +10059,21 @@ func (r DeleteTPAForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteTPAForProjectResponse) StatusCode() int { +func (r V1DeleteProjectTpaIntegrationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetTPAForProjectResponse struct { +type V1GetProjectTpaIntegrationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ThirdPartyAuth } // Status returns HTTPResponse.Status -func (r GetTPAForProjectResponse) Status() string { +func (r V1GetProjectTpaIntegrationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10081,7 +10081,7 @@ func (r GetTPAForProjectResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetTPAForProjectResponse) StatusCode() int { +func (r V1GetProjectTpaIntegrationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -10458,14 +10458,14 @@ func (r V1UndoResponse) StatusCode() int { return 0 } -type GetDatabaseMetadataResponse struct { +type V1GetDatabaseMetadataResponse struct { Body []byte HTTPResponse *http.Response JSON200 *GetProjectDbMetadataResponse } // Status returns HTTPResponse.Status -func (r GetDatabaseMetadataResponse) Status() string { +func (r V1GetDatabaseMetadataResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10473,7 +10473,7 @@ func (r GetDatabaseMetadataResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetDatabaseMetadataResponse) StatusCode() int { +func (r V1GetDatabaseMetadataResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11752,49 +11752,49 @@ func (c *ClientWithResponses) V1GetProjectWithResponse(ctx context.Context, ref return ParseV1GetProjectResponse(rsp) } -// GetPerformanceAdvisorsWithResponse request returning *GetPerformanceAdvisorsResponse -func (c *ClientWithResponses) GetPerformanceAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPerformanceAdvisorsResponse, error) { - rsp, err := c.GetPerformanceAdvisors(ctx, ref, reqEditors...) +// V1GetPerformanceAdvisorsWithResponse request returning *V1GetPerformanceAdvisorsResponse +func (c *ClientWithResponses) V1GetPerformanceAdvisorsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetPerformanceAdvisorsResponse, error) { + rsp, err := c.V1GetPerformanceAdvisors(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseGetPerformanceAdvisorsResponse(rsp) + return ParseV1GetPerformanceAdvisorsResponse(rsp) } -// GetSecurityAdvisorsWithResponse request returning *GetSecurityAdvisorsResponse -func (c *ClientWithResponses) GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*GetSecurityAdvisorsResponse, error) { - rsp, err := c.GetSecurityAdvisors(ctx, ref, params, reqEditors...) +// V1GetSecurityAdvisorsWithResponse request returning *V1GetSecurityAdvisorsResponse +func (c *ClientWithResponses) V1GetSecurityAdvisorsWithResponse(ctx context.Context, ref string, params *V1GetSecurityAdvisorsParams, reqEditors ...RequestEditorFn) (*V1GetSecurityAdvisorsResponse, error) { + rsp, err := c.V1GetSecurityAdvisors(ctx, ref, params, reqEditors...) if err != nil { return nil, err } - return ParseGetSecurityAdvisorsResponse(rsp) + return ParseV1GetSecurityAdvisorsResponse(rsp) } -// GetLogsWithResponse request returning *GetLogsResponse -func (c *ClientWithResponses) GetLogsWithResponse(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*GetLogsResponse, error) { - rsp, err := c.GetLogs(ctx, ref, params, reqEditors...) +// V1GetProjectLogsWithResponse request returning *V1GetProjectLogsResponse +func (c *ClientWithResponses) V1GetProjectLogsWithResponse(ctx context.Context, ref string, params *V1GetProjectLogsParams, reqEditors ...RequestEditorFn) (*V1GetProjectLogsResponse, error) { + rsp, err := c.V1GetProjectLogs(ctx, ref, params, reqEditors...) if err != nil { return nil, err } - return ParseGetLogsResponse(rsp) + return ParseV1GetProjectLogsResponse(rsp) } -// GetApiCountsWithResponse request returning *GetApiCountsResponse -func (c *ClientWithResponses) GetApiCountsWithResponse(ctx context.Context, ref string, params *GetApiCountsParams, reqEditors ...RequestEditorFn) (*GetApiCountsResponse, error) { - rsp, err := c.GetApiCounts(ctx, ref, params, reqEditors...) +// V1GetProjectUsageApiCountWithResponse request returning *V1GetProjectUsageApiCountResponse +func (c *ClientWithResponses) V1GetProjectUsageApiCountWithResponse(ctx context.Context, ref string, params *V1GetProjectUsageApiCountParams, reqEditors ...RequestEditorFn) (*V1GetProjectUsageApiCountResponse, error) { + rsp, err := c.V1GetProjectUsageApiCount(ctx, ref, params, reqEditors...) if err != nil { return nil, err } - return ParseGetApiCountsResponse(rsp) + return ParseV1GetProjectUsageApiCountResponse(rsp) } -// GetApiRequestsCountWithResponse request returning *GetApiRequestsCountResponse -func (c *ClientWithResponses) GetApiRequestsCountWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetApiRequestsCountResponse, error) { - rsp, err := c.GetApiRequestsCount(ctx, ref, reqEditors...) +// V1GetProjectUsageRequestCountWithResponse request returning *V1GetProjectUsageRequestCountResponse +func (c *ClientWithResponses) V1GetProjectUsageRequestCountWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectUsageRequestCountResponse, error) { + rsp, err := c.V1GetProjectUsageRequestCount(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseGetApiRequestsCountResponse(rsp) + return ParseV1GetProjectUsageRequestCountResponse(rsp) } // V1GetProjectApiKeysWithResponse request returning *V1GetProjectApiKeysResponse @@ -11806,74 +11806,74 @@ func (c *ClientWithResponses) V1GetProjectApiKeysWithResponse(ctx context.Contex return ParseV1GetProjectApiKeysResponse(rsp) } -// CreateApiKeyWithBodyWithResponse request with arbitrary body returning *CreateApiKeyResponse -func (c *ClientWithResponses) CreateApiKeyWithBodyWithResponse(ctx context.Context, ref string, params *CreateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) { - rsp, err := c.CreateApiKeyWithBody(ctx, ref, params, contentType, body, reqEditors...) +// V1CreateProjectApiKeyWithBodyWithResponse request with arbitrary body returning *V1CreateProjectApiKeyResponse +func (c *ClientWithResponses) V1CreateProjectApiKeyWithBodyWithResponse(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectApiKeyResponse, error) { + rsp, err := c.V1CreateProjectApiKeyWithBody(ctx, ref, params, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateApiKeyResponse(rsp) + return ParseV1CreateProjectApiKeyResponse(rsp) } -func (c *ClientWithResponses) CreateApiKeyWithResponse(ctx context.Context, ref string, params *CreateApiKeyParams, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) { - rsp, err := c.CreateApiKey(ctx, ref, params, body, reqEditors...) +func (c *ClientWithResponses) V1CreateProjectApiKeyWithResponse(ctx context.Context, ref string, params *V1CreateProjectApiKeyParams, body V1CreateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectApiKeyResponse, error) { + rsp, err := c.V1CreateProjectApiKey(ctx, ref, params, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateApiKeyResponse(rsp) + return ParseV1CreateProjectApiKeyResponse(rsp) } -// CheckLegacyApiKeysWithResponse request returning *CheckLegacyApiKeysResponse -func (c *ClientWithResponses) CheckLegacyApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*CheckLegacyApiKeysResponse, error) { - rsp, err := c.CheckLegacyApiKeys(ctx, ref, reqEditors...) +// V1GetProjectLegacyApiKeysWithResponse request returning *V1GetProjectLegacyApiKeysResponse +func (c *ClientWithResponses) V1GetProjectLegacyApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectLegacyApiKeysResponse, error) { + rsp, err := c.V1GetProjectLegacyApiKeys(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseCheckLegacyApiKeysResponse(rsp) + return ParseV1GetProjectLegacyApiKeysResponse(rsp) } -// UpdateLegacyApiKeysWithResponse request returning *UpdateLegacyApiKeysResponse -func (c *ClientWithResponses) UpdateLegacyApiKeysWithResponse(ctx context.Context, ref string, params *UpdateLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*UpdateLegacyApiKeysResponse, error) { - rsp, err := c.UpdateLegacyApiKeys(ctx, ref, params, reqEditors...) +// V1UpdateProjectLegacyApiKeysWithResponse request returning *V1UpdateProjectLegacyApiKeysResponse +func (c *ClientWithResponses) V1UpdateProjectLegacyApiKeysWithResponse(ctx context.Context, ref string, params *V1UpdateProjectLegacyApiKeysParams, reqEditors ...RequestEditorFn) (*V1UpdateProjectLegacyApiKeysResponse, error) { + rsp, err := c.V1UpdateProjectLegacyApiKeys(ctx, ref, params, reqEditors...) if err != nil { return nil, err } - return ParseUpdateLegacyApiKeysResponse(rsp) + return ParseV1UpdateProjectLegacyApiKeysResponse(rsp) } -// DeleteApiKeyWithResponse request returning *DeleteApiKeyResponse -func (c *ClientWithResponses) DeleteApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error) { - rsp, err := c.DeleteApiKey(ctx, ref, id, params, reqEditors...) +// V1DeleteProjectApiKeyWithResponse request returning *V1DeleteProjectApiKeyResponse +func (c *ClientWithResponses) V1DeleteProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1DeleteProjectApiKeyParams, reqEditors ...RequestEditorFn) (*V1DeleteProjectApiKeyResponse, error) { + rsp, err := c.V1DeleteProjectApiKey(ctx, ref, id, params, reqEditors...) if err != nil { return nil, err } - return ParseDeleteApiKeyResponse(rsp) + return ParseV1DeleteProjectApiKeyResponse(rsp) } -// GetApiKeyWithResponse request returning *GetApiKeyResponse -func (c *ClientWithResponses) GetApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *GetApiKeyParams, reqEditors ...RequestEditorFn) (*GetApiKeyResponse, error) { - rsp, err := c.GetApiKey(ctx, ref, id, params, reqEditors...) +// V1GetProjectApiKeyWithResponse request returning *V1GetProjectApiKeyResponse +func (c *ClientWithResponses) V1GetProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1GetProjectApiKeyParams, reqEditors ...RequestEditorFn) (*V1GetProjectApiKeyResponse, error) { + rsp, err := c.V1GetProjectApiKey(ctx, ref, id, params, reqEditors...) if err != nil { return nil, err } - return ParseGetApiKeyResponse(rsp) + return ParseV1GetProjectApiKeyResponse(rsp) } -// UpdateApiKeyWithBodyWithResponse request with arbitrary body returning *UpdateApiKeyResponse -func (c *ClientWithResponses) UpdateApiKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateApiKeyResponse, error) { - rsp, err := c.UpdateApiKeyWithBody(ctx, ref, id, params, contentType, body, reqEditors...) +// V1UpdateProjectApiKeyWithBodyWithResponse request with arbitrary body returning *V1UpdateProjectApiKeyResponse +func (c *ClientWithResponses) V1UpdateProjectApiKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateProjectApiKeyResponse, error) { + rsp, err := c.V1UpdateProjectApiKeyWithBody(ctx, ref, id, params, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseUpdateApiKeyResponse(rsp) + return ParseV1UpdateProjectApiKeyResponse(rsp) } -func (c *ClientWithResponses) UpdateApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *UpdateApiKeyParams, body UpdateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateApiKeyResponse, error) { - rsp, err := c.UpdateApiKey(ctx, ref, id, params, body, reqEditors...) +func (c *ClientWithResponses) V1UpdateProjectApiKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, params *V1UpdateProjectApiKeyParams, body V1UpdateProjectApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateProjectApiKeyResponse, error) { + rsp, err := c.V1UpdateProjectApiKey(ctx, ref, id, params, body, reqEditors...) if err != nil { return nil, err } - return ParseUpdateApiKeyResponse(rsp) + return ParseV1UpdateProjectApiKeyResponse(rsp) } // V1ListProjectAddonsWithResponse request returning *V1ListProjectAddonsResponse @@ -11999,65 +11999,65 @@ func (c *ClientWithResponses) V1UpdateAuthServiceConfigWithResponse(ctx context. return ParseV1UpdateAuthServiceConfigResponse(rsp) } -// ListSigningKeysForProjectWithResponse request returning *ListSigningKeysForProjectResponse -func (c *ClientWithResponses) ListSigningKeysForProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListSigningKeysForProjectResponse, error) { - rsp, err := c.ListSigningKeysForProject(ctx, ref, reqEditors...) +// V1GetProjectSigningKeysWithResponse request returning *V1GetProjectSigningKeysResponse +func (c *ClientWithResponses) V1GetProjectSigningKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectSigningKeysResponse, error) { + rsp, err := c.V1GetProjectSigningKeys(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseListSigningKeysForProjectResponse(rsp) + return ParseV1GetProjectSigningKeysResponse(rsp) } -// CreateSigningKeyForProjectWithBodyWithResponse request with arbitrary body returning *CreateSigningKeyForProjectResponse -func (c *ClientWithResponses) CreateSigningKeyForProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSigningKeyForProjectResponse, error) { - rsp, err := c.CreateSigningKeyForProjectWithBody(ctx, ref, contentType, body, reqEditors...) +// V1CreateProjectSigningKeyWithBodyWithResponse request with arbitrary body returning *V1CreateProjectSigningKeyResponse +func (c *ClientWithResponses) V1CreateProjectSigningKeyWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectSigningKeyResponse, error) { + rsp, err := c.V1CreateProjectSigningKeyWithBody(ctx, ref, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateSigningKeyForProjectResponse(rsp) + return ParseV1CreateProjectSigningKeyResponse(rsp) } -func (c *ClientWithResponses) CreateSigningKeyForProjectWithResponse(ctx context.Context, ref string, body CreateSigningKeyForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSigningKeyForProjectResponse, error) { - rsp, err := c.CreateSigningKeyForProject(ctx, ref, body, reqEditors...) +func (c *ClientWithResponses) V1CreateProjectSigningKeyWithResponse(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectSigningKeyResponse, error) { + rsp, err := c.V1CreateProjectSigningKey(ctx, ref, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateSigningKeyForProjectResponse(rsp) + return ParseV1CreateProjectSigningKeyResponse(rsp) } -// DeleteSigningKeyWithResponse request returning *DeleteSigningKeyResponse -func (c *ClientWithResponses) DeleteSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteSigningKeyResponse, error) { - rsp, err := c.DeleteSigningKey(ctx, ref, id, reqEditors...) +// V1RemoveProjectSigningKeyWithResponse request returning *V1RemoveProjectSigningKeyResponse +func (c *ClientWithResponses) V1RemoveProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1RemoveProjectSigningKeyResponse, error) { + rsp, err := c.V1RemoveProjectSigningKey(ctx, ref, id, reqEditors...) if err != nil { return nil, err } - return ParseDeleteSigningKeyResponse(rsp) + return ParseV1RemoveProjectSigningKeyResponse(rsp) } -// GetSigningKeyForProjectWithResponse request returning *GetSigningKeyForProjectResponse -func (c *ClientWithResponses) GetSigningKeyForProjectWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetSigningKeyForProjectResponse, error) { - rsp, err := c.GetSigningKeyForProject(ctx, ref, id, reqEditors...) +// V1GetProjectSigningKeyWithResponse request returning *V1GetProjectSigningKeyResponse +func (c *ClientWithResponses) V1GetProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetProjectSigningKeyResponse, error) { + rsp, err := c.V1GetProjectSigningKey(ctx, ref, id, reqEditors...) if err != nil { return nil, err } - return ParseGetSigningKeyForProjectResponse(rsp) + return ParseV1GetProjectSigningKeyResponse(rsp) } -// PatchSigningKeyWithBodyWithResponse request with arbitrary body returning *PatchSigningKeyResponse -func (c *ClientWithResponses) PatchSigningKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchSigningKeyResponse, error) { - rsp, err := c.PatchSigningKeyWithBody(ctx, ref, id, contentType, body, reqEditors...) +// V1UpdateProjectSigningKeyWithBodyWithResponse request with arbitrary body returning *V1UpdateProjectSigningKeyResponse +func (c *ClientWithResponses) V1UpdateProjectSigningKeyWithBodyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateProjectSigningKeyResponse, error) { + rsp, err := c.V1UpdateProjectSigningKeyWithBody(ctx, ref, id, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchSigningKeyResponse(rsp) + return ParseV1UpdateProjectSigningKeyResponse(rsp) } -func (c *ClientWithResponses) PatchSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, body PatchSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchSigningKeyResponse, error) { - rsp, err := c.PatchSigningKey(ctx, ref, id, body, reqEditors...) +func (c *ClientWithResponses) V1UpdateProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, body V1UpdateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateProjectSigningKeyResponse, error) { + rsp, err := c.V1UpdateProjectSigningKey(ctx, ref, id, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchSigningKeyResponse(rsp) + return ParseV1UpdateProjectSigningKeyResponse(rsp) } // V1ListAllSsoProviderWithResponse request returning *V1ListAllSsoProviderResponse @@ -12121,48 +12121,48 @@ func (c *ClientWithResponses) V1UpdateASsoProviderWithResponse(ctx context.Conte return ParseV1UpdateASsoProviderResponse(rsp) } -// ListTPAForProjectWithResponse request returning *ListTPAForProjectResponse -func (c *ClientWithResponses) ListTPAForProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListTPAForProjectResponse, error) { - rsp, err := c.ListTPAForProject(ctx, ref, reqEditors...) +// V1ListProjectTpaIntegrationsWithResponse request returning *V1ListProjectTpaIntegrationsResponse +func (c *ClientWithResponses) V1ListProjectTpaIntegrationsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListProjectTpaIntegrationsResponse, error) { + rsp, err := c.V1ListProjectTpaIntegrations(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseListTPAForProjectResponse(rsp) + return ParseV1ListProjectTpaIntegrationsResponse(rsp) } -// CreateTPAForProjectWithBodyWithResponse request with arbitrary body returning *CreateTPAForProjectResponse -func (c *ClientWithResponses) CreateTPAForProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTPAForProjectResponse, error) { - rsp, err := c.CreateTPAForProjectWithBody(ctx, ref, contentType, body, reqEditors...) +// V1CreateProjectTpaIntegrationWithBodyWithResponse request with arbitrary body returning *V1CreateProjectTpaIntegrationResponse +func (c *ClientWithResponses) V1CreateProjectTpaIntegrationWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateProjectTpaIntegrationResponse, error) { + rsp, err := c.V1CreateProjectTpaIntegrationWithBody(ctx, ref, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateTPAForProjectResponse(rsp) + return ParseV1CreateProjectTpaIntegrationResponse(rsp) } -func (c *ClientWithResponses) CreateTPAForProjectWithResponse(ctx context.Context, ref string, body CreateTPAForProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTPAForProjectResponse, error) { - rsp, err := c.CreateTPAForProject(ctx, ref, body, reqEditors...) +func (c *ClientWithResponses) V1CreateProjectTpaIntegrationWithResponse(ctx context.Context, ref string, body V1CreateProjectTpaIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectTpaIntegrationResponse, error) { + rsp, err := c.V1CreateProjectTpaIntegration(ctx, ref, body, reqEditors...) if err != nil { return nil, err } - return ParseCreateTPAForProjectResponse(rsp) + return ParseV1CreateProjectTpaIntegrationResponse(rsp) } -// DeleteTPAForProjectWithResponse request returning *DeleteTPAForProjectResponse -func (c *ClientWithResponses) DeleteTPAForProjectWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteTPAForProjectResponse, error) { - rsp, err := c.DeleteTPAForProject(ctx, ref, tpaId, reqEditors...) +// V1DeleteProjectTpaIntegrationWithResponse request returning *V1DeleteProjectTpaIntegrationResponse +func (c *ClientWithResponses) V1DeleteProjectTpaIntegrationWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1DeleteProjectTpaIntegrationResponse, error) { + rsp, err := c.V1DeleteProjectTpaIntegration(ctx, ref, tpaId, reqEditors...) if err != nil { return nil, err } - return ParseDeleteTPAForProjectResponse(rsp) + return ParseV1DeleteProjectTpaIntegrationResponse(rsp) } -// GetTPAForProjectWithResponse request returning *GetTPAForProjectResponse -func (c *ClientWithResponses) GetTPAForProjectWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetTPAForProjectResponse, error) { - rsp, err := c.GetTPAForProject(ctx, ref, tpaId, reqEditors...) +// V1GetProjectTpaIntegrationWithResponse request returning *V1GetProjectTpaIntegrationResponse +func (c *ClientWithResponses) V1GetProjectTpaIntegrationWithResponse(ctx context.Context, ref string, tpaId openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetProjectTpaIntegrationResponse, error) { + rsp, err := c.V1GetProjectTpaIntegration(ctx, ref, tpaId, reqEditors...) if err != nil { return nil, err } - return ParseGetTPAForProjectResponse(rsp) + return ParseV1GetProjectTpaIntegrationResponse(rsp) } // V1GetProjectPgbouncerConfigWithResponse request returning *V1GetProjectPgbouncerConfigResponse @@ -12374,13 +12374,13 @@ func (c *ClientWithResponses) V1UndoWithResponse(ctx context.Context, ref string return ParseV1UndoResponse(rsp) } -// GetDatabaseMetadataWithResponse request returning *GetDatabaseMetadataResponse -func (c *ClientWithResponses) GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) { - rsp, err := c.GetDatabaseMetadata(ctx, ref, reqEditors...) +// V1GetDatabaseMetadataWithResponse request returning *V1GetDatabaseMetadataResponse +func (c *ClientWithResponses) V1GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetDatabaseMetadataResponse, error) { + rsp, err := c.V1GetDatabaseMetadata(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseGetDatabaseMetadataResponse(rsp) + return ParseV1GetDatabaseMetadataResponse(rsp) } // V1ListMigrationHistoryWithResponse request returning *V1ListMigrationHistoryResponse @@ -13446,15 +13446,15 @@ func ParseV1GetProjectResponse(rsp *http.Response) (*V1GetProjectResponse, error return response, nil } -// ParseGetPerformanceAdvisorsResponse parses an HTTP response from a GetPerformanceAdvisorsWithResponse call -func ParseGetPerformanceAdvisorsResponse(rsp *http.Response) (*GetPerformanceAdvisorsResponse, error) { +// ParseV1GetPerformanceAdvisorsResponse parses an HTTP response from a V1GetPerformanceAdvisorsWithResponse call +func ParseV1GetPerformanceAdvisorsResponse(rsp *http.Response) (*V1GetPerformanceAdvisorsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetPerformanceAdvisorsResponse{ + response := &V1GetPerformanceAdvisorsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13472,15 +13472,15 @@ func ParseGetPerformanceAdvisorsResponse(rsp *http.Response) (*GetPerformanceAdv return response, nil } -// ParseGetSecurityAdvisorsResponse parses an HTTP response from a GetSecurityAdvisorsWithResponse call -func ParseGetSecurityAdvisorsResponse(rsp *http.Response) (*GetSecurityAdvisorsResponse, error) { +// ParseV1GetSecurityAdvisorsResponse parses an HTTP response from a V1GetSecurityAdvisorsWithResponse call +func ParseV1GetSecurityAdvisorsResponse(rsp *http.Response) (*V1GetSecurityAdvisorsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetSecurityAdvisorsResponse{ + response := &V1GetSecurityAdvisorsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13498,15 +13498,15 @@ func ParseGetSecurityAdvisorsResponse(rsp *http.Response) (*GetSecurityAdvisorsR return response, nil } -// ParseGetLogsResponse parses an HTTP response from a GetLogsWithResponse call -func ParseGetLogsResponse(rsp *http.Response) (*GetLogsResponse, error) { +// ParseV1GetProjectLogsResponse parses an HTTP response from a V1GetProjectLogsWithResponse call +func ParseV1GetProjectLogsResponse(rsp *http.Response) (*V1GetProjectLogsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetLogsResponse{ + response := &V1GetProjectLogsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13524,15 +13524,15 @@ func ParseGetLogsResponse(rsp *http.Response) (*GetLogsResponse, error) { return response, nil } -// ParseGetApiCountsResponse parses an HTTP response from a GetApiCountsWithResponse call -func ParseGetApiCountsResponse(rsp *http.Response) (*GetApiCountsResponse, error) { +// ParseV1GetProjectUsageApiCountResponse parses an HTTP response from a V1GetProjectUsageApiCountWithResponse call +func ParseV1GetProjectUsageApiCountResponse(rsp *http.Response) (*V1GetProjectUsageApiCountResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiCountsResponse{ + response := &V1GetProjectUsageApiCountResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13550,15 +13550,15 @@ func ParseGetApiCountsResponse(rsp *http.Response) (*GetApiCountsResponse, error return response, nil } -// ParseGetApiRequestsCountResponse parses an HTTP response from a GetApiRequestsCountWithResponse call -func ParseGetApiRequestsCountResponse(rsp *http.Response) (*GetApiRequestsCountResponse, error) { +// ParseV1GetProjectUsageRequestCountResponse parses an HTTP response from a V1GetProjectUsageRequestCountWithResponse call +func ParseV1GetProjectUsageRequestCountResponse(rsp *http.Response) (*V1GetProjectUsageRequestCountResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiRequestsCountResponse{ + response := &V1GetProjectUsageRequestCountResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13602,15 +13602,15 @@ func ParseV1GetProjectApiKeysResponse(rsp *http.Response) (*V1GetProjectApiKeysR return response, nil } -// ParseCreateApiKeyResponse parses an HTTP response from a CreateApiKeyWithResponse call -func ParseCreateApiKeyResponse(rsp *http.Response) (*CreateApiKeyResponse, error) { +// ParseV1CreateProjectApiKeyResponse parses an HTTP response from a V1CreateProjectApiKeyWithResponse call +func ParseV1CreateProjectApiKeyResponse(rsp *http.Response) (*V1CreateProjectApiKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateApiKeyResponse{ + response := &V1CreateProjectApiKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13628,15 +13628,15 @@ func ParseCreateApiKeyResponse(rsp *http.Response) (*CreateApiKeyResponse, error return response, nil } -// ParseCheckLegacyApiKeysResponse parses an HTTP response from a CheckLegacyApiKeysWithResponse call -func ParseCheckLegacyApiKeysResponse(rsp *http.Response) (*CheckLegacyApiKeysResponse, error) { +// ParseV1GetProjectLegacyApiKeysResponse parses an HTTP response from a V1GetProjectLegacyApiKeysWithResponse call +func ParseV1GetProjectLegacyApiKeysResponse(rsp *http.Response) (*V1GetProjectLegacyApiKeysResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CheckLegacyApiKeysResponse{ + response := &V1GetProjectLegacyApiKeysResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13654,15 +13654,15 @@ func ParseCheckLegacyApiKeysResponse(rsp *http.Response) (*CheckLegacyApiKeysRes return response, nil } -// ParseUpdateLegacyApiKeysResponse parses an HTTP response from a UpdateLegacyApiKeysWithResponse call -func ParseUpdateLegacyApiKeysResponse(rsp *http.Response) (*UpdateLegacyApiKeysResponse, error) { +// ParseV1UpdateProjectLegacyApiKeysResponse parses an HTTP response from a V1UpdateProjectLegacyApiKeysWithResponse call +func ParseV1UpdateProjectLegacyApiKeysResponse(rsp *http.Response) (*V1UpdateProjectLegacyApiKeysResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateLegacyApiKeysResponse{ + response := &V1UpdateProjectLegacyApiKeysResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13680,15 +13680,15 @@ func ParseUpdateLegacyApiKeysResponse(rsp *http.Response) (*UpdateLegacyApiKeysR return response, nil } -// ParseDeleteApiKeyResponse parses an HTTP response from a DeleteApiKeyWithResponse call -func ParseDeleteApiKeyResponse(rsp *http.Response) (*DeleteApiKeyResponse, error) { +// ParseV1DeleteProjectApiKeyResponse parses an HTTP response from a V1DeleteProjectApiKeyWithResponse call +func ParseV1DeleteProjectApiKeyResponse(rsp *http.Response) (*V1DeleteProjectApiKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteApiKeyResponse{ + response := &V1DeleteProjectApiKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13706,15 +13706,15 @@ func ParseDeleteApiKeyResponse(rsp *http.Response) (*DeleteApiKeyResponse, error return response, nil } -// ParseGetApiKeyResponse parses an HTTP response from a GetApiKeyWithResponse call -func ParseGetApiKeyResponse(rsp *http.Response) (*GetApiKeyResponse, error) { +// ParseV1GetProjectApiKeyResponse parses an HTTP response from a V1GetProjectApiKeyWithResponse call +func ParseV1GetProjectApiKeyResponse(rsp *http.Response) (*V1GetProjectApiKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetApiKeyResponse{ + response := &V1GetProjectApiKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -13732,15 +13732,15 @@ func ParseGetApiKeyResponse(rsp *http.Response) (*GetApiKeyResponse, error) { return response, nil } -// ParseUpdateApiKeyResponse parses an HTTP response from a UpdateApiKeyWithResponse call -func ParseUpdateApiKeyResponse(rsp *http.Response) (*UpdateApiKeyResponse, error) { +// ParseV1UpdateProjectApiKeyResponse parses an HTTP response from a V1UpdateProjectApiKeyWithResponse call +func ParseV1UpdateProjectApiKeyResponse(rsp *http.Response) (*V1UpdateProjectApiKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateApiKeyResponse{ + response := &V1UpdateProjectApiKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14004,15 +14004,15 @@ func ParseV1UpdateAuthServiceConfigResponse(rsp *http.Response) (*V1UpdateAuthSe return response, nil } -// ParseListSigningKeysForProjectResponse parses an HTTP response from a ListSigningKeysForProjectWithResponse call -func ParseListSigningKeysForProjectResponse(rsp *http.Response) (*ListSigningKeysForProjectResponse, error) { +// ParseV1GetProjectSigningKeysResponse parses an HTTP response from a V1GetProjectSigningKeysWithResponse call +func ParseV1GetProjectSigningKeysResponse(rsp *http.Response) (*V1GetProjectSigningKeysResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListSigningKeysForProjectResponse{ + response := &V1GetProjectSigningKeysResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14030,15 +14030,15 @@ func ParseListSigningKeysForProjectResponse(rsp *http.Response) (*ListSigningKey return response, nil } -// ParseCreateSigningKeyForProjectResponse parses an HTTP response from a CreateSigningKeyForProjectWithResponse call -func ParseCreateSigningKeyForProjectResponse(rsp *http.Response) (*CreateSigningKeyForProjectResponse, error) { +// ParseV1CreateProjectSigningKeyResponse parses an HTTP response from a V1CreateProjectSigningKeyWithResponse call +func ParseV1CreateProjectSigningKeyResponse(rsp *http.Response) (*V1CreateProjectSigningKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateSigningKeyForProjectResponse{ + response := &V1CreateProjectSigningKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14056,15 +14056,15 @@ func ParseCreateSigningKeyForProjectResponse(rsp *http.Response) (*CreateSigning return response, nil } -// ParseDeleteSigningKeyResponse parses an HTTP response from a DeleteSigningKeyWithResponse call -func ParseDeleteSigningKeyResponse(rsp *http.Response) (*DeleteSigningKeyResponse, error) { +// ParseV1RemoveProjectSigningKeyResponse parses an HTTP response from a V1RemoveProjectSigningKeyWithResponse call +func ParseV1RemoveProjectSigningKeyResponse(rsp *http.Response) (*V1RemoveProjectSigningKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteSigningKeyResponse{ + response := &V1RemoveProjectSigningKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14082,15 +14082,15 @@ func ParseDeleteSigningKeyResponse(rsp *http.Response) (*DeleteSigningKeyRespons return response, nil } -// ParseGetSigningKeyForProjectResponse parses an HTTP response from a GetSigningKeyForProjectWithResponse call -func ParseGetSigningKeyForProjectResponse(rsp *http.Response) (*GetSigningKeyForProjectResponse, error) { +// ParseV1GetProjectSigningKeyResponse parses an HTTP response from a V1GetProjectSigningKeyWithResponse call +func ParseV1GetProjectSigningKeyResponse(rsp *http.Response) (*V1GetProjectSigningKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetSigningKeyForProjectResponse{ + response := &V1GetProjectSigningKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14108,15 +14108,15 @@ func ParseGetSigningKeyForProjectResponse(rsp *http.Response) (*GetSigningKeyFor return response, nil } -// ParsePatchSigningKeyResponse parses an HTTP response from a PatchSigningKeyWithResponse call -func ParsePatchSigningKeyResponse(rsp *http.Response) (*PatchSigningKeyResponse, error) { +// ParseV1UpdateProjectSigningKeyResponse parses an HTTP response from a V1UpdateProjectSigningKeyWithResponse call +func ParseV1UpdateProjectSigningKeyResponse(rsp *http.Response) (*V1UpdateProjectSigningKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PatchSigningKeyResponse{ + response := &V1UpdateProjectSigningKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14264,15 +14264,15 @@ func ParseV1UpdateASsoProviderResponse(rsp *http.Response) (*V1UpdateASsoProvide return response, nil } -// ParseListTPAForProjectResponse parses an HTTP response from a ListTPAForProjectWithResponse call -func ParseListTPAForProjectResponse(rsp *http.Response) (*ListTPAForProjectResponse, error) { +// ParseV1ListProjectTpaIntegrationsResponse parses an HTTP response from a V1ListProjectTpaIntegrationsWithResponse call +func ParseV1ListProjectTpaIntegrationsResponse(rsp *http.Response) (*V1ListProjectTpaIntegrationsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListTPAForProjectResponse{ + response := &V1ListProjectTpaIntegrationsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14290,15 +14290,15 @@ func ParseListTPAForProjectResponse(rsp *http.Response) (*ListTPAForProjectRespo return response, nil } -// ParseCreateTPAForProjectResponse parses an HTTP response from a CreateTPAForProjectWithResponse call -func ParseCreateTPAForProjectResponse(rsp *http.Response) (*CreateTPAForProjectResponse, error) { +// ParseV1CreateProjectTpaIntegrationResponse parses an HTTP response from a V1CreateProjectTpaIntegrationWithResponse call +func ParseV1CreateProjectTpaIntegrationResponse(rsp *http.Response) (*V1CreateProjectTpaIntegrationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateTPAForProjectResponse{ + response := &V1CreateProjectTpaIntegrationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14316,15 +14316,15 @@ func ParseCreateTPAForProjectResponse(rsp *http.Response) (*CreateTPAForProjectR return response, nil } -// ParseDeleteTPAForProjectResponse parses an HTTP response from a DeleteTPAForProjectWithResponse call -func ParseDeleteTPAForProjectResponse(rsp *http.Response) (*DeleteTPAForProjectResponse, error) { +// ParseV1DeleteProjectTpaIntegrationResponse parses an HTTP response from a V1DeleteProjectTpaIntegrationWithResponse call +func ParseV1DeleteProjectTpaIntegrationResponse(rsp *http.Response) (*V1DeleteProjectTpaIntegrationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteTPAForProjectResponse{ + response := &V1DeleteProjectTpaIntegrationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14342,15 +14342,15 @@ func ParseDeleteTPAForProjectResponse(rsp *http.Response) (*DeleteTPAForProjectR return response, nil } -// ParseGetTPAForProjectResponse parses an HTTP response from a GetTPAForProjectWithResponse call -func ParseGetTPAForProjectResponse(rsp *http.Response) (*GetTPAForProjectResponse, error) { +// ParseV1GetProjectTpaIntegrationResponse parses an HTTP response from a V1GetProjectTpaIntegrationWithResponse call +func ParseV1GetProjectTpaIntegrationResponse(rsp *http.Response) (*V1GetProjectTpaIntegrationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetTPAForProjectResponse{ + response := &V1GetProjectTpaIntegrationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -14770,15 +14770,15 @@ func ParseV1UndoResponse(rsp *http.Response) (*V1UndoResponse, error) { return response, nil } -// ParseGetDatabaseMetadataResponse parses an HTTP response from a GetDatabaseMetadataWithResponse call -func ParseGetDatabaseMetadataResponse(rsp *http.Response) (*GetDatabaseMetadataResponse, error) { +// ParseV1GetDatabaseMetadataResponse parses an HTTP response from a V1GetDatabaseMetadataWithResponse call +func ParseV1GetDatabaseMetadataResponse(rsp *http.Response) (*V1GetDatabaseMetadataResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetDatabaseMetadataResponse{ + response := &V1GetDatabaseMetadataResponse{ Body: bodyBytes, HTTPResponse: rsp, } diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index b9ec43b0b..c6cfdff10 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -933,20 +933,20 @@ const ( V1OauthAuthorizeProjectClaimParamsCodeChallengeMethodSha256 V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod = "sha256" ) -// Defines values for GetSecurityAdvisorsParamsLintType. +// Defines values for V1GetSecurityAdvisorsParamsLintType. const ( - Sql GetSecurityAdvisorsParamsLintType = "sql" + Sql V1GetSecurityAdvisorsParamsLintType = "sql" ) -// Defines values for GetApiCountsParamsInterval. +// Defines values for V1GetProjectUsageApiCountParamsInterval. const ( - N15min GetApiCountsParamsInterval = "15min" - N1day GetApiCountsParamsInterval = "1day" - N1hr GetApiCountsParamsInterval = "1hr" - N30min GetApiCountsParamsInterval = "30min" - N3day GetApiCountsParamsInterval = "3day" - N3hr GetApiCountsParamsInterval = "3hr" - N7day GetApiCountsParamsInterval = "7day" + N15min V1GetProjectUsageApiCountParamsInterval = "15min" + N1day V1GetProjectUsageApiCountParamsInterval = "1day" + N1hr V1GetProjectUsageApiCountParamsInterval = "1hr" + N30min V1GetProjectUsageApiCountParamsInterval = "30min" + N3day V1GetProjectUsageApiCountParamsInterval = "3day" + N3hr V1GetProjectUsageApiCountParamsInterval = "3hr" + N7day V1GetProjectUsageApiCountParamsInterval = "7day" ) // Defines values for V1GetServicesHealthParamsServices. @@ -2945,28 +2945,28 @@ type V1OauthAuthorizeProjectClaimParamsResponseType string // V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod defines parameters for V1OauthAuthorizeProjectClaim. type V1OauthAuthorizeProjectClaimParamsCodeChallengeMethod string -// GetSecurityAdvisorsParams defines parameters for GetSecurityAdvisors. -type GetSecurityAdvisorsParams struct { - LintType *GetSecurityAdvisorsParamsLintType `form:"lint_type,omitempty" json:"lint_type,omitempty"` +// V1GetSecurityAdvisorsParams defines parameters for V1GetSecurityAdvisors. +type V1GetSecurityAdvisorsParams struct { + LintType *V1GetSecurityAdvisorsParamsLintType `form:"lint_type,omitempty" json:"lint_type,omitempty"` } -// GetSecurityAdvisorsParamsLintType defines parameters for GetSecurityAdvisors. -type GetSecurityAdvisorsParamsLintType string +// V1GetSecurityAdvisorsParamsLintType defines parameters for V1GetSecurityAdvisors. +type V1GetSecurityAdvisorsParamsLintType string -// GetLogsParams defines parameters for GetLogs. -type GetLogsParams struct { +// V1GetProjectLogsParams defines parameters for V1GetProjectLogs. +type V1GetProjectLogsParams struct { Sql *string `form:"sql,omitempty" json:"sql,omitempty"` IsoTimestampStart *time.Time `form:"iso_timestamp_start,omitempty" json:"iso_timestamp_start,omitempty"` IsoTimestampEnd *time.Time `form:"iso_timestamp_end,omitempty" json:"iso_timestamp_end,omitempty"` } -// GetApiCountsParams defines parameters for GetApiCounts. -type GetApiCountsParams struct { - Interval *GetApiCountsParamsInterval `form:"interval,omitempty" json:"interval,omitempty"` +// V1GetProjectUsageApiCountParams defines parameters for V1GetProjectUsageApiCount. +type V1GetProjectUsageApiCountParams struct { + Interval *V1GetProjectUsageApiCountParamsInterval `form:"interval,omitempty" json:"interval,omitempty"` } -// GetApiCountsParamsInterval defines parameters for GetApiCounts. -type GetApiCountsParamsInterval string +// V1GetProjectUsageApiCountParamsInterval defines parameters for V1GetProjectUsageApiCount. +type V1GetProjectUsageApiCountParamsInterval string // V1GetProjectApiKeysParams defines parameters for V1GetProjectApiKeys. type V1GetProjectApiKeysParams struct { @@ -2974,20 +2974,20 @@ type V1GetProjectApiKeysParams struct { Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` } -// CreateApiKeyParams defines parameters for CreateApiKey. -type CreateApiKeyParams struct { +// V1CreateProjectApiKeyParams defines parameters for V1CreateProjectApiKey. +type V1CreateProjectApiKeyParams struct { // Reveal Boolean string, true or false Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` } -// UpdateLegacyApiKeysParams defines parameters for UpdateLegacyApiKeys. -type UpdateLegacyApiKeysParams struct { +// V1UpdateProjectLegacyApiKeysParams defines parameters for V1UpdateProjectLegacyApiKeys. +type V1UpdateProjectLegacyApiKeysParams struct { // Enabled Boolean string, true or false Enabled bool `form:"enabled" json:"enabled"` } -// DeleteApiKeyParams defines parameters for DeleteApiKey. -type DeleteApiKeyParams struct { +// V1DeleteProjectApiKeyParams defines parameters for V1DeleteProjectApiKey. +type V1DeleteProjectApiKeyParams struct { // Reveal Boolean string, true or false Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` @@ -2996,14 +2996,14 @@ type DeleteApiKeyParams struct { Reason *string `form:"reason,omitempty" json:"reason,omitempty"` } -// GetApiKeyParams defines parameters for GetApiKey. -type GetApiKeyParams struct { +// V1GetProjectApiKeyParams defines parameters for V1GetProjectApiKey. +type V1GetProjectApiKeyParams struct { // Reveal Boolean string, true or false Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` } -// UpdateApiKeyParams defines parameters for UpdateApiKey. -type UpdateApiKeyParams struct { +// V1UpdateProjectApiKeyParams defines parameters for V1UpdateProjectApiKey. +type V1UpdateProjectApiKeyParams struct { // Reveal Boolean string, true or false Reveal *bool `form:"reveal,omitempty" json:"reveal,omitempty"` } @@ -3123,11 +3123,11 @@ type V1CreateAnOrganizationJSONRequestBody = CreateOrganizationV1 // V1CreateAProjectJSONRequestBody defines body for V1CreateAProject for application/json ContentType. type V1CreateAProjectJSONRequestBody = V1CreateProjectBody -// CreateApiKeyJSONRequestBody defines body for CreateApiKey for application/json ContentType. -type CreateApiKeyJSONRequestBody = CreateApiKeyBody +// V1CreateProjectApiKeyJSONRequestBody defines body for V1CreateProjectApiKey for application/json ContentType. +type V1CreateProjectApiKeyJSONRequestBody = CreateApiKeyBody -// UpdateApiKeyJSONRequestBody defines body for UpdateApiKey for application/json ContentType. -type UpdateApiKeyJSONRequestBody = UpdateApiKeyBody +// V1UpdateProjectApiKeyJSONRequestBody defines body for V1UpdateProjectApiKey for application/json ContentType. +type V1UpdateProjectApiKeyJSONRequestBody = UpdateApiKeyBody // V1ApplyProjectAddonJSONRequestBody defines body for V1ApplyProjectAddon for application/json ContentType. type V1ApplyProjectAddonJSONRequestBody = ApplyProjectAddonBody @@ -3138,11 +3138,11 @@ type V1CreateABranchJSONRequestBody = CreateBranchBody // V1UpdateAuthServiceConfigJSONRequestBody defines body for V1UpdateAuthServiceConfig for application/json ContentType. type V1UpdateAuthServiceConfigJSONRequestBody = UpdateAuthConfigBody -// CreateSigningKeyForProjectJSONRequestBody defines body for CreateSigningKeyForProject for application/json ContentType. -type CreateSigningKeyForProjectJSONRequestBody = CreateSigningKeyBody +// V1CreateProjectSigningKeyJSONRequestBody defines body for V1CreateProjectSigningKey for application/json ContentType. +type V1CreateProjectSigningKeyJSONRequestBody = CreateSigningKeyBody -// PatchSigningKeyJSONRequestBody defines body for PatchSigningKey for application/json ContentType. -type PatchSigningKeyJSONRequestBody = UpdateSigningKeyBody +// V1UpdateProjectSigningKeyJSONRequestBody defines body for V1UpdateProjectSigningKey for application/json ContentType. +type V1UpdateProjectSigningKeyJSONRequestBody = UpdateSigningKeyBody // V1CreateASsoProviderJSONRequestBody defines body for V1CreateASsoProvider for application/json ContentType. type V1CreateASsoProviderJSONRequestBody = CreateProviderBody @@ -3150,8 +3150,8 @@ type V1CreateASsoProviderJSONRequestBody = CreateProviderBody // V1UpdateASsoProviderJSONRequestBody defines body for V1UpdateASsoProvider for application/json ContentType. type V1UpdateASsoProviderJSONRequestBody = UpdateProviderBody -// CreateTPAForProjectJSONRequestBody defines body for CreateTPAForProject for application/json ContentType. -type CreateTPAForProjectJSONRequestBody = CreateThirdPartyAuthBody +// V1CreateProjectTpaIntegrationJSONRequestBody defines body for V1CreateProjectTpaIntegration for application/json ContentType. +type V1CreateProjectTpaIntegrationJSONRequestBody = CreateThirdPartyAuthBody // V1UpdatePoolerConfigJSONRequestBody defines body for V1UpdatePoolerConfig for application/json ContentType. type V1UpdatePoolerConfigJSONRequestBody = UpdateSupavisorConfigBody From 5a1b6cd3bd9f6c3f2f2696a4cb38c4f573268379 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 18 Jun 2025 18:17:01 +0800 Subject: [PATCH 07/40] fix: use go tool for dev dependencies (#3732) --- .github/workflows/ci.yml | 2 +- go.mod | 18 ++++++++++++------ main.go | 4 ++-- pkg/go.mod | 2 +- tools/tools.go | 14 -------------- 5 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 tools/tools.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d29506a6f..b8f733605 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - uses: t1m0thyj/unlock-keyring@v1 - run: | pkgs=$(go list ./pkg/... | grep -Ev 'pkg/api' | paste -sd ',' -) - go run gotest.tools/gotestsum -- -race -v -count=1 ./... \ + go tool gotestsum -- -race -v -count=1 ./... \ -coverpkg="./cmd/...,./internal/...,${pkgs}" -coverprofile=coverage.out - uses: coverallsapp/github-action@v2 diff --git a/go.mod b/go.mod index 25165cd30..6d1eb4972 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,11 @@ module github.com/supabase/cli -go 1.24.2 +go 1.24.4 require ( github.com/BurntSushi/toml v1.5.0 github.com/Netflix/go-env v0.1.2 + github.com/andybalholm/brotli v1.1.1 github.com/cenkalti/backoff/v4 v4.3.0 github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.25.0 @@ -15,11 +16,11 @@ require ( github.com/docker/cli v28.2.2+incompatible github.com/docker/docker v28.2.2+incompatible github.com/docker/go-connections v0.5.0 + github.com/fsnotify/fsnotify v1.9.0 github.com/getsentry/sentry-go v0.33.0 github.com/go-errors/errors v1.5.1 github.com/go-git/go-git/v5 v5.16.2 github.com/go-xmlfmt/xmlfmt v1.1.3 - github.com/golangci/golangci-lint/v2 v2.1.6 github.com/google/go-github/v62 v62.0.0 github.com/google/go-querystring v1.1.0 github.com/google/uuid v1.6.0 @@ -31,7 +32,6 @@ require ( github.com/joho/godotenv v1.5.1 github.com/mithrandie/csvq-driver v1.7.0 github.com/muesli/reflow v0.3.0 - github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 github.com/slack-go/slack v0.17.1 github.com/spf13/afero v1.14.0 github.com/spf13/cobra v1.9.1 @@ -49,7 +49,6 @@ require ( golang.org/x/term v0.32.0 google.golang.org/grpc v1.73.0 gopkg.in/yaml.v3 v3.0.1 - gotest.tools/gotestsum v1.12.2 ) require ( @@ -75,7 +74,6 @@ require ( github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/alingse/nilnesserr v0.2.0 // indirect - github.com/andybalholm/brotli v1.1.1 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.2.0 // indirect @@ -129,7 +127,6 @@ require ( github.com/fatih/structtag v1.2.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/firefart/nonamedreturns v1.0.6 // indirect - github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/getkin/kin-openapi v0.131.0 // indirect @@ -159,6 +156,7 @@ require ( github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect github.com/golangci/go-printf-func-name v0.1.0 // indirect github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golangci-lint/v2 v2.1.6 // indirect github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect @@ -243,6 +241,7 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.19.1 // indirect github.com/oapi-codegen/nullable v1.1.0 // indirect + github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 // indirect github.com/oapi-codegen/runtime v1.1.1 // indirect github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect @@ -343,9 +342,16 @@ require ( google.golang.org/protobuf v1.36.6 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gotest.tools/gotestsum v1.12.2 // indirect honnef.co/go/tools v0.6.1 // indirect mvdan.cc/gofumpt v0.8.0 // indirect mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect ) replace github.com/supabase/cli/pkg v1.0.0 => ./pkg + +tool ( + github.com/golangci/golangci-lint/v2/cmd/golangci-lint + github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen + gotest.tools/gotestsum +) diff --git a/main.go b/main.go index 17774e656..825dde835 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,8 @@ import ( "github.com/supabase/cli/cmd" ) -//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=pkg/api/types.cfg.yaml https://api.supabase.green/api/v1-yaml -//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=pkg/api/client.cfg.yaml https://api.supabase.green/api/v1-yaml +//go:generate go tool oapi-codegen -config pkg/api/types.cfg.yaml https://api.supabase.green/api/v1-yaml +//go:generate go tool oapi-codegen -config pkg/api/client.cfg.yaml https://api.supabase.green/api/v1-yaml func main() { cmd.Execute() diff --git a/pkg/go.mod b/pkg/go.mod index 0340f3cba..297aee7e5 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -1,6 +1,6 @@ module github.com/supabase/cli/pkg -go 1.24.2 +go 1.24.4 require ( github.com/BurntSushi/toml v1.5.0 diff --git a/tools/tools.go b/tools/tools.go deleted file mode 100644 index e0ae60a6c..000000000 --- a/tools/tools.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build tools - -package tools - -import ( - // Import all required tools so that they can be version controlled via go.mod & go.sum. - // These imports are tracked a sub package so as to not impact the dependencies of clients of - // the library. - // This should be migrated directly to go.mod when the following is complete: - // https://github.com/golang/go/issues/48429 - _ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" - _ "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" - _ "gotest.tools/gotestsum" -) From 58a366da2ab04c3a192d2e37a8c6180215ea168e Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:40:51 +0200 Subject: [PATCH 08/40] chore: sync API types from infrastructure (#3735) Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> --- pkg/api/client.gen.go | 218 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index a00065344..b1180c329 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -256,6 +256,12 @@ type ClientInterface interface { V1CreateProjectSigningKey(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetLegacySigningKey request + V1GetLegacySigningKey(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CreateLegacySigningKey request + V1CreateLegacySigningKey(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1RemoveProjectSigningKey request V1RemoveProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1266,6 +1272,30 @@ func (c *Client) V1CreateProjectSigningKey(ctx context.Context, ref string, body return c.Client.Do(req) } +func (c *Client) V1GetLegacySigningKey(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetLegacySigningKeyRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateLegacySigningKey(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateLegacySigningKeyRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1RemoveProjectSigningKey(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1RemoveProjectSigningKeyRequest(c.Server, ref, id) if err != nil { @@ -4790,6 +4820,74 @@ func NewV1CreateProjectSigningKeyRequestWithBody(server string, ref string, cont return req, nil } +// NewV1GetLegacySigningKeyRequest generates requests for V1GetLegacySigningKey +func NewV1GetLegacySigningKeyRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/signing-keys/legacy", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1CreateLegacySigningKeyRequest generates requests for V1CreateLegacySigningKey +func NewV1CreateLegacySigningKeyRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/signing-keys/legacy", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1RemoveProjectSigningKeyRequest generates requests for V1RemoveProjectSigningKey func NewV1RemoveProjectSigningKeyRequest(server string, ref string, id openapi_types.UUID) (*http.Request, error) { var err error @@ -8531,6 +8629,12 @@ type ClientWithResponsesInterface interface { V1CreateProjectSigningKeyWithResponse(ctx context.Context, ref string, body V1CreateProjectSigningKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateProjectSigningKeyResponse, error) + // V1GetLegacySigningKeyWithResponse request + V1GetLegacySigningKeyWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetLegacySigningKeyResponse, error) + + // V1CreateLegacySigningKeyWithResponse request + V1CreateLegacySigningKeyWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CreateLegacySigningKeyResponse, error) + // V1RemoveProjectSigningKeyWithResponse request V1RemoveProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1RemoveProjectSigningKeyResponse, error) @@ -9824,6 +9928,50 @@ func (r V1CreateProjectSigningKeyResponse) StatusCode() int { return 0 } +type V1GetLegacySigningKeyResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SigningKeyResponse +} + +// Status returns HTTPResponse.Status +func (r V1GetLegacySigningKeyResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetLegacySigningKeyResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1CreateLegacySigningKeyResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *SigningKeyResponse +} + +// Status returns HTTPResponse.Status +func (r V1CreateLegacySigningKeyResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1CreateLegacySigningKeyResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1RemoveProjectSigningKeyResponse struct { Body []byte HTTPResponse *http.Response @@ -12025,6 +12173,24 @@ func (c *ClientWithResponses) V1CreateProjectSigningKeyWithResponse(ctx context. return ParseV1CreateProjectSigningKeyResponse(rsp) } +// V1GetLegacySigningKeyWithResponse request returning *V1GetLegacySigningKeyResponse +func (c *ClientWithResponses) V1GetLegacySigningKeyWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetLegacySigningKeyResponse, error) { + rsp, err := c.V1GetLegacySigningKey(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1GetLegacySigningKeyResponse(rsp) +} + +// V1CreateLegacySigningKeyWithResponse request returning *V1CreateLegacySigningKeyResponse +func (c *ClientWithResponses) V1CreateLegacySigningKeyWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CreateLegacySigningKeyResponse, error) { + rsp, err := c.V1CreateLegacySigningKey(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1CreateLegacySigningKeyResponse(rsp) +} + // V1RemoveProjectSigningKeyWithResponse request returning *V1RemoveProjectSigningKeyResponse func (c *ClientWithResponses) V1RemoveProjectSigningKeyWithResponse(ctx context.Context, ref string, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1RemoveProjectSigningKeyResponse, error) { rsp, err := c.V1RemoveProjectSigningKey(ctx, ref, id, reqEditors...) @@ -14056,6 +14222,58 @@ func ParseV1CreateProjectSigningKeyResponse(rsp *http.Response) (*V1CreateProjec return response, nil } +// ParseV1GetLegacySigningKeyResponse parses an HTTP response from a V1GetLegacySigningKeyWithResponse call +func ParseV1GetLegacySigningKeyResponse(rsp *http.Response) (*V1GetLegacySigningKeyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetLegacySigningKeyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SigningKeyResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1CreateLegacySigningKeyResponse parses an HTTP response from a V1CreateLegacySigningKeyWithResponse call +func ParseV1CreateLegacySigningKeyResponse(rsp *http.Response) (*V1CreateLegacySigningKeyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CreateLegacySigningKeyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest SigningKeyResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + // ParseV1RemoveProjectSigningKeyResponse parses an HTTP response from a V1RemoveProjectSigningKeyWithResponse call func ParseV1RemoveProjectSigningKeyResponse(rsp *http.Response) (*V1RemoveProjectSigningKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) From 9c3a439f6a9b0a8d3dc776f70f0b6ac8d3af94fb Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Thu, 19 Jun 2025 11:59:22 +0200 Subject: [PATCH 09/40] chore(ci): add pr automerge on approval (#3736) --- .github/workflows/api-sync.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/api-sync.yml b/.github/workflows/api-sync.yml index 8193d927a..764de088c 100644 --- a/.github/workflows/api-sync.yml +++ b/.github/workflows/api-sync.yml @@ -38,6 +38,7 @@ jobs: - name: Create Pull Request if: steps.check.outputs.has_changes == 'true' + id: cpr uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GH_PAT }} @@ -52,3 +53,9 @@ jobs: labels: | automated pr api-sync + + - name: Enable Pull Request Automerge + if: steps.check.outputs.has_changes == 'true' + run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GH_PAT }} From ff1056486937039acf2ca6ef8842efc5f94d0ebc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 10:03:47 +0000 Subject: [PATCH 10/40] chore(deps): bump supabase/realtime from v2.36.20 to v2.37.2 in /pkg/config/templates (#3734) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.36.20 to v2.37.2. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.37.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Han Qiao --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index e8073571c..b873530d4 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.2 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.36.20 AS realtime +FROM supabase/realtime:v2.37.2 AS realtime FROM supabase/storage-api:v1.24.6 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From 3e8220f176b29ebfb254949651f14d0b2009d500 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 05:08:47 +0000 Subject: [PATCH 11/40] chore(deps): bump supabase/supavisor from 2.5.2 to 2.5.3 in /pkg/config/templates (#3740) chore(deps): bump supabase/supavisor in /pkg/config/templates Bumps supabase/supavisor from 2.5.2 to 2.5.3. --- updated-dependencies: - dependency-name: supabase/supavisor dependency-version: 2.5.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index b873530d4..96c6babf3 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -9,7 +9,7 @@ FROM supabase/studio:2025.06.16-sha-c4316c3 AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector -FROM supabase/supavisor:2.5.2 AS supavisor +FROM supabase/supavisor:2.5.3 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue FROM supabase/realtime:v2.37.2 AS realtime FROM supabase/storage-api:v1.24.6 AS storage From a1f79b444f9c4db7c21d284669418fc780d5045a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 04:52:55 +0000 Subject: [PATCH 12/40] chore(deps): bump supabase/realtime from v2.37.2 to v2.37.3 in /pkg/config/templates (#3745) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.37.2 to v2.37.3. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.37.3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 96c6babf3..e11e0b223 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.3 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.37.2 AS realtime +FROM supabase/realtime:v2.37.3 AS realtime FROM supabase/storage-api:v1.24.6 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From 8ca836afc38af8b812b4c66a440d8cee1ce84b34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 04:57:50 +0000 Subject: [PATCH 13/40] chore(deps): bump supabase/supavisor from 2.5.3 to 2.5.5 in /pkg/config/templates (#3746) chore(deps): bump supabase/supavisor in /pkg/config/templates Bumps supabase/supavisor from 2.5.3 to 2.5.5. --- updated-dependencies: - dependency-name: supabase/supavisor dependency-version: 2.5.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index e11e0b223..5007c70b1 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -9,7 +9,7 @@ FROM supabase/studio:2025.06.16-sha-c4316c3 AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector -FROM supabase/supavisor:2.5.3 AS supavisor +FROM supabase/supavisor:2.5.5 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue FROM supabase/realtime:v2.37.3 AS realtime FROM supabase/storage-api:v1.24.6 AS storage From f3aaa49640a3a592d172f6537e5d5bd77af3fdf1 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Mon, 23 Jun 2025 18:01:42 +0800 Subject: [PATCH 14/40] fix: diff declarative schemas without supabase stop (#3747) * fix: diff declarative schemas without supabase stop * fix: refactor entrypoint for older pg images * chore: update unit tests * chore: show stacktrace when developing locally --- cmd/root.go | 3 ++ internal/db/diff/diff.go | 87 +++++++++++++++-------------------- internal/db/diff/diff_test.go | 10 +++- internal/db/start/start.go | 37 ++++++++------- 4 files changed, 67 insertions(+), 70 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 54d88b0b8..a2cc6f0a7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -200,6 +200,9 @@ func recoverAndExit() { !viper.GetBool("DEBUG") { utils.CmdSuggestion = utils.SuggestDebugFlag } + if e, ok := err.(*errors.Error); ok && len(utils.Version) == 0 { + fmt.Fprintln(os.Stderr, string(e.Stack())) + } msg = err.Error() default: msg = fmt.Sprintf("%#v", err) diff --git a/internal/db/diff/diff.go b/internal/db/diff/diff.go index 646ee005d..01ce857ee 100644 --- a/internal/db/diff/diff.go +++ b/internal/db/diff/diff.go @@ -31,22 +31,6 @@ import ( type DiffFunc func(context.Context, string, string, []string) (string, error) func Run(ctx context.Context, schema []string, file string, config pgconn.Config, differ DiffFunc, fsys afero.Fs, options ...func(*pgx.ConnConfig)) (err error) { - // Sanity checks. - if utils.IsLocalDatabase(config) { - if declared, err := loadDeclaredSchemas(fsys); err != nil { - return err - } else if container, err := createShadowIfNotExists(ctx, declared); err != nil { - return err - } else if len(container) > 0 { - defer utils.DockerRemove(container) - if err := start.WaitForHealthyService(ctx, start.HealthTimeout, container); err != nil { - return err - } - if err := migrateBaseDatabase(ctx, container, declared, fsys, options...); err != nil { - return err - } - } - } // 1. Load all user defined schemas if len(schema) == 0 { schema, err = loadSchema(ctx, config, options...) @@ -72,22 +56,6 @@ func Run(ctx context.Context, schema []string, file string, config pgconn.Config return nil } -func createShadowIfNotExists(ctx context.Context, migrations []string) (string, error) { - if len(migrations) == 0 { - return "", nil - } - if err := utils.AssertSupabaseDbIsRunning(); !errors.Is(err, utils.ErrNotRunning) { - return "", err - } - fmt.Fprintln(os.Stderr, "Creating local database from declarative schemas:") - msg := make([]string, len(migrations)) - for i, m := range migrations { - msg[i] = fmt.Sprintf(" • %s", utils.Bold(m)) - } - fmt.Fprintln(os.Stderr, strings.Join(msg, "\n")) - return CreateShadowDatabase(ctx, utils.Config.Db.Port) -} - func loadDeclaredSchemas(fsys afero.Fs) ([]string, error) { if schemas := utils.Config.Db.Migrations.SchemaPaths; len(schemas) > 0 { return schemas.Files(afero.NewIOFS(fsys)) @@ -140,7 +108,8 @@ func loadSchema(ctx context.Context, config pgconn.Config, options ...func(*pgx. } func CreateShadowDatabase(ctx context.Context, port uint16) (string, error) { - config := start.NewContainerConfig() + // Disable background workers in shadow database + config := start.NewContainerConfig("-c", "max_worker_processes=0") hostPort := strconv.FormatUint(uint64(port), 10) hostConfig := container.HostConfig{ PortBindings: nat.PortMap{"5432/tcp": []nat.PortBinding{{HostPort: hostPort}}}, @@ -148,7 +117,6 @@ func CreateShadowDatabase(ctx context.Context, port uint16) (string, error) { } networkingConfig := network.NetworkingConfig{} if utils.Config.Db.MajorVersion <= 14 { - config.Entrypoint = nil hostConfig.Tmpfs = map[string]string{"/docker-entrypoint-initdb.d": ""} } return utils.DockerStart(ctx, config, hostConfig, networkingConfig, "") @@ -164,6 +132,9 @@ func ConnectShadowDatabase(ctx context.Context, timeout time.Duration, options . return backoff.RetryWithData(connect, policy) } +// Required to bypass pg_cron check: https://github.com/citusdata/pg_cron/blob/main/pg_cron.sql#L3 +const CREATE_TEMPLATE = "CREATE DATABASE contrib_regression TEMPLATE postgres" + func MigrateShadowDatabase(ctx context.Context, container string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { migrations, err := migration.ListLocalMigrations(utils.MigrationsDir, afero.NewIOFS(fsys)) if err != nil { @@ -177,19 +148,10 @@ func MigrateShadowDatabase(ctx context.Context, container string, fsys afero.Fs, if err := start.SetupDatabase(ctx, conn, container[:12], os.Stderr, fsys); err != nil { return err } - return migration.ApplyMigrations(ctx, migrations, conn, afero.NewIOFS(fsys)) -} - -func migrateBaseDatabase(ctx context.Context, container string, migrations []string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { - conn, err := utils.ConnectLocalPostgres(ctx, pgconn.Config{}, options...) - if err != nil { - return err - } - defer conn.Close(context.Background()) - if err := start.SetupDatabase(ctx, conn, container[:12], os.Stderr, fsys); err != nil { - return err + if _, err := conn.Exec(ctx, CREATE_TEMPLATE); err != nil { + return errors.Errorf("failed to create template database: %w", err) } - return migration.SeedGlobals(ctx, migrations, conn, afero.NewIOFS(fsys)) + return migration.ApplyMigrations(ctx, migrations, conn, afero.NewIOFS(fsys)) } func DiffDatabase(ctx context.Context, schema []string, config pgconn.Config, w io.Writer, fsys afero.Fs, differ func(context.Context, string, string, []string) (string, error), options ...func(*pgx.ConnConfig)) (string, error) { @@ -205,14 +167,41 @@ func DiffDatabase(ctx context.Context, schema []string, config pgconn.Config, w if err := MigrateShadowDatabase(ctx, shadow, fsys, options...); err != nil { return "", err } - fmt.Fprintln(w, "Diffing schemas:", strings.Join(schema, ",")) - source := utils.ToPostgresURL(pgconn.Config{ + shadowConfig := pgconn.Config{ Host: utils.Config.Hostname, Port: utils.Config.Db.ShadowPort, User: "postgres", Password: utils.Config.Db.Password, Database: "postgres", - }) + } + if utils.IsLocalDatabase(config) { + if declared, err := loadDeclaredSchemas(fsys); err != nil { + return "", err + } else if len(declared) > 0 { + config = shadowConfig + config.Database = "contrib_regression" + if err := migrateBaseDatabase(ctx, config, declared, fsys, options...); err != nil { + return "", err + } + } + } + fmt.Fprintln(w, "Diffing schemas:", strings.Join(schema, ",")) + source := utils.ToPostgresURL(shadowConfig) target := utils.ToPostgresURL(config) return differ(ctx, source, target, schema) } + +func migrateBaseDatabase(ctx context.Context, config pgconn.Config, migrations []string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error { + fmt.Fprintln(os.Stderr, "Creating local database from declarative schemas:") + msg := make([]string, len(migrations)) + for i, m := range migrations { + msg[i] = fmt.Sprintf(" • %s", utils.Bold(m)) + } + fmt.Fprintln(os.Stderr, strings.Join(msg, "\n")) + conn, err := utils.ConnectLocalPostgres(ctx, config, options...) + if err != nil { + return err + } + defer conn.Close(context.Background()) + return migration.SeedGlobals(ctx, migrations, conn, afero.NewIOFS(fsys)) +} diff --git a/internal/db/diff/diff_test.go b/internal/db/diff/diff_test.go index 498c88da1..daadaf6bb 100644 --- a/internal/db/diff/diff_test.go +++ b/internal/db/diff/diff_test.go @@ -69,6 +69,8 @@ func TestRun(t *testing.T) { require.NoError(t, apitest.MockDockerLogs(utils.Docker, "test-migra", diff)) // Setup mock postgres conn := pgtest.NewConn() + conn.Query(CREATE_TEMPLATE). + Reply("CREATE DATABASE") defer conn.Close(t) // Run test err := Run(context.Background(), []string{"public"}, "file", dbConfig, DiffSchemaMigra, fsys, conn.Intercept) @@ -134,7 +136,9 @@ func TestMigrateShadow(t *testing.T) { conn.Query(utils.GlobalsSql). Reply("CREATE SCHEMA"). Query(utils.InitialSchemaPg14Sql). - Reply("CREATE SCHEMA") + Reply("CREATE SCHEMA"). + Query(CREATE_TEMPLATE). + Reply("CREATE DATABASE") helper.MockMigrationHistory(conn). Query(sql). Reply("CREATE SCHEMA"). @@ -308,7 +312,9 @@ create schema public`) conn.Query(utils.GlobalsSql). Reply("CREATE SCHEMA"). Query(utils.InitialSchemaPg14Sql). - Reply("CREATE SCHEMA") + Reply("CREATE SCHEMA"). + Query(CREATE_TEMPLATE). + Reply("CREATE DATABASE") helper.MockMigrationHistory(conn). Query(sql). Reply("CREATE SCHEMA"). diff --git a/internal/db/start/start.go b/internal/db/start/start.go index ff4b237f0..665c5f4f7 100644 --- a/internal/db/start/start.go +++ b/internal/db/start/start.go @@ -60,7 +60,11 @@ func Run(ctx context.Context, fromBackup string, fsys afero.Fs) error { return err } -func NewContainerConfig() container.Config { +func NewContainerConfig(args ...string) container.Config { + if utils.Config.Db.MajorVersion >= 14 { + // Extensions schema does not exist on PG13 and below + args = append(args, "-c", "search_path='$user,public,extensions'") + } env := []string{ "POSTGRES_PASSWORD=" + utils.Config.Db.Password, "POSTGRES_HOST=/var/run/postgresql", @@ -92,7 +96,7 @@ func NewContainerConfig() container.Config { cat <<'EOF' > /etc/postgresql.schema.sql && \ cat <<'EOF' > /etc/postgresql-custom/pgsodium_root.key && \ cat <<'EOF' >> /etc/postgresql/postgresql.conf && \ -docker-entrypoint.sh postgres -D /etc/postgresql +docker-entrypoint.sh postgres -D /etc/postgresql ` + strings.Join(args, " ") + ` ` + initialSchema + ` ` + webhookSchema + ` ` + _supabaseSchema + ` @@ -102,12 +106,15 @@ EOF ` + utils.Config.Db.Settings.ToPostgresConfig() + ` EOF`}, } - if utils.Config.Db.MajorVersion >= 14 { - config.Cmd = []string{"postgres", - "-c", "config_file=/etc/postgresql/postgresql.conf", - // Ref: https://postgrespro.com/list/thread-id/2448092 - "-c", `search_path="$user",public,extensions`, - } + if utils.Config.Db.MajorVersion <= 14 { + config.Entrypoint = []string{"sh", "-c", ` +cat <<'EOF' > /docker-entrypoint-initdb.d/supabase_schema.sql && \ +cat <<'EOF' >> /etc/postgresql/postgresql.conf && \ +docker-entrypoint.sh postgres -D /etc/postgresql ` + strings.Join(args, " ") + ` +` + _supabaseSchema + ` +EOF +` + utils.Config.Db.Settings.ToPostgresConfig() + ` +EOF`} } return config } @@ -122,6 +129,9 @@ func NewHostConfig() container.HostConfig { utils.ConfigId + ":/etc/postgresql-custom", }, } + if utils.Config.Db.MajorVersion <= 14 { + hostConfig.Tmpfs = map[string]string{"/docker-entrypoint-initdb.d": ""} + } return hostConfig } @@ -135,17 +145,6 @@ func StartDatabase(ctx context.Context, fromBackup string, fsys afero.Fs, w io.W }, }, } - if utils.Config.Db.MajorVersion <= 14 { - config.Entrypoint = []string{"sh", "-c", ` -cat <<'EOF' > /docker-entrypoint-initdb.d/supabase_schema.sql && \ -cat <<'EOF' >> /etc/postgresql/postgresql.conf && \ -docker-entrypoint.sh postgres -D /etc/postgresql -` + _supabaseSchema + ` -EOF -` + utils.Config.Db.Settings.ToPostgresConfig() + ` -EOF`} - hostConfig.Tmpfs = map[string]string{"/docker-entrypoint-initdb.d": ""} - } if len(fromBackup) > 0 { config.Entrypoint = []string{"sh", "-c", ` cat <<'EOF' > /etc/postgresql.schema.sql && \ From d609eac68913f1143eda8014163859d47fd21df9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 04:41:30 +0000 Subject: [PATCH 15/40] chore(deps): bump github.com/andybalholm/brotli from 1.1.1 to 1.2.0 (#3751) Bumps [github.com/andybalholm/brotli](https://github.com/andybalholm/brotli) from 1.1.1 to 1.2.0. - [Commits](https://github.com/andybalholm/brotli/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: github.com/andybalholm/brotli dependency-version: 1.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6d1eb4972..f4a078d97 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.4 require ( github.com/BurntSushi/toml v1.5.0 github.com/Netflix/go-env v0.1.2 - github.com/andybalholm/brotli v1.1.1 + github.com/andybalholm/brotli v1.2.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.25.0 diff --git a/go.sum b/go.sum index 40b6ea8ee..844e9e776 100644 --- a/go.sum +++ b/go.sum @@ -94,8 +94,8 @@ github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/alingse/nilnesserr v0.2.0 h1:raLem5KG7EFVb4UIDAXgrv3N2JIaffeKNtcEXkEWd/w= github.com/alingse/nilnesserr v0.2.0/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= -github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= -github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= +github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= +github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= From 48236f22b815df37f2cde15b6ef4334af9d62a90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 05:07:19 +0000 Subject: [PATCH 16/40] chore(deps): bump github.com/andybalholm/brotli from 1.1.1 to 1.2.0 in /pkg (#3756) chore(deps): bump github.com/andybalholm/brotli in /pkg Bumps [github.com/andybalholm/brotli](https://github.com/andybalholm/brotli) from 1.1.1 to 1.2.0. - [Commits](https://github.com/andybalholm/brotli/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: github.com/andybalholm/brotli dependency-version: 1.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/go.mod | 2 +- pkg/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/go.mod b/pkg/go.mod index 297aee7e5..f1a9f408d 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -4,7 +4,7 @@ go 1.24.4 require ( github.com/BurntSushi/toml v1.5.0 - github.com/andybalholm/brotli v1.1.1 + github.com/andybalholm/brotli v1.2.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/docker/go-units v0.5.0 github.com/ecies/go/v2 v2.0.11 diff --git a/pkg/go.sum b/pkg/go.sum index c25f97883..344d50b33 100644 --- a/pkg/go.sum +++ b/pkg/go.sum @@ -3,8 +3,8 @@ github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= -github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= -github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= +github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= +github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= From ad03264cfcaf986b5f8952d0370a7609db2a9a48 Mon Sep 17 00:00:00 2001 From: Chris Stockton <180184+cstockton@users.noreply.github.com> Date: Tue, 24 Jun 2025 07:39:22 -0700 Subject: [PATCH 17/40] feat: add support for before-user-created hook (#3749) --- internal/start/start.go | 8 +++++ pkg/config/auth.go | 19 ++++++++++++ pkg/config/auth_test.go | 29 +++++++++++++++++++ pkg/config/config.go | 9 ++++++ pkg/config/templates/config.toml | 5 ++++ .../local_disabled_remote_enabled.diff | 7 ++++- .../local_enabled_remote_disabled.diff | 10 ++++++- pkg/config/testdata/config.toml | 5 ++++ 8 files changed, 90 insertions(+), 2 deletions(-) diff --git a/internal/start/start.go b/internal/start/start.go index 122080c58..fcf654fe6 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -641,6 +641,14 @@ EOF "GOTRUE_HOOK_SEND_EMAIL_SECRETS="+hook.Secrets.Value, ) } + if hook := utils.Config.Auth.Hook.BeforeUserCreated; hook != nil && hook.Enabled { + env = append( + env, + "GOTRUE_HOOK_BEFORE_USER_CREATED_ENABLED=true", + "GOTRUE_HOOK_BEFORE_USER_CREATED_URI="+hook.URI, + "GOTRUE_HOOK_BEFORE_USER_CREATED_SECRETS="+hook.Secrets.Value, + ) + } if utils.Config.Auth.MFA.Phone.EnrollEnabled || utils.Config.Auth.MFA.Phone.VerifyEnabled { env = append( diff --git a/pkg/config/auth.go b/pkg/config/auth.go index 50194af1b..9aa026315 100644 --- a/pkg/config/auth.go +++ b/pkg/config/auth.go @@ -201,6 +201,7 @@ type ( CustomAccessToken *hookConfig `toml:"custom_access_token"` SendSMS *hookConfig `toml:"send_sms"` SendEmail *hookConfig `toml:"send_email"` + BeforeUserCreated *hookConfig `toml:"before_user_created"` } factorTypeConfiguration struct { @@ -381,6 +382,14 @@ func (c *captcha) fromAuthConfig(remoteConfig v1API.AuthConfigResponse) { func (h hook) toAuthConfigBody(body *v1API.UpdateAuthConfigBody) { // When local config is not set, we assume platform defaults should not change + if hook := h.BeforeUserCreated; hook != nil { + if body.HookBeforeUserCreatedEnabled = nullable.NewNullableWithValue(hook.Enabled); hook.Enabled { + body.HookBeforeUserCreatedUri = nullable.NewNullableWithValue(hook.URI) + if len(hook.Secrets.SHA256) > 0 { + body.HookBeforeUserCreatedSecrets = nullable.NewNullableWithValue(hook.Secrets.Value) + } + } + } if hook := h.CustomAccessToken; hook != nil { if body.HookCustomAccessTokenEnabled = nullable.NewNullableWithValue(hook.Enabled); hook.Enabled { body.HookCustomAccessTokenUri = nullable.NewNullableWithValue(hook.URI) @@ -425,6 +434,16 @@ func (h hook) toAuthConfigBody(body *v1API.UpdateAuthConfigBody) { } func (h *hook) fromAuthConfig(remoteConfig v1API.AuthConfigResponse) { // When local config is not set, we assume platform defaults should not change + if hook := h.BeforeUserCreated; hook != nil { + // Ignore disabled hooks because their envs are not loaded + if hook.Enabled { + hook.URI = ValOrDefault(remoteConfig.HookBeforeUserCreatedUri, "") + if len(hook.Secrets.SHA256) > 0 { + hook.Secrets.SHA256 = ValOrDefault(remoteConfig.HookBeforeUserCreatedSecrets, "") + } + } + hook.Enabled = ValOrDefault(remoteConfig.HookBeforeUserCreatedEnabled, false) + } if hook := h.CustomAccessToken; hook != nil { // Ignore disabled hooks because their envs are not loaded if hook.Enabled { diff --git a/pkg/config/auth_test.go b/pkg/config/auth_test.go index 1bab29847..bba212383 100644 --- a/pkg/config/auth_test.go +++ b/pkg/config/auth_test.go @@ -215,6 +215,14 @@ func TestHookDiff(t *testing.T) { t.Run("local and remote enabled", func(t *testing.T) { c := newWithDefaults() c.Hook = hook{ + BeforeUserCreated: &hookConfig{ + Enabled: true, + URI: "http://example.com", + Secrets: Secret{ + Value: "test-secret", + SHA256: "ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252", + }, + }, CustomAccessToken: &hookConfig{ Enabled: true, URI: "http://example.com", @@ -254,6 +262,9 @@ func TestHookDiff(t *testing.T) { } // Run test diff, err := c.DiffWithRemote(v1API.AuthConfigResponse{ + HookBeforeUserCreatedEnabled: nullable.NewNullableWithValue(true), + HookBeforeUserCreatedUri: nullable.NewNullableWithValue("http://example.com"), + HookBeforeUserCreatedSecrets: nullable.NewNullableWithValue("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"), HookCustomAccessTokenEnabled: nullable.NewNullableWithValue(true), HookCustomAccessTokenUri: nullable.NewNullableWithValue("http://example.com"), HookCustomAccessTokenSecrets: nullable.NewNullableWithValue("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"), @@ -277,6 +288,9 @@ func TestHookDiff(t *testing.T) { t.Run("local disabled remote enabled", func(t *testing.T) { c := newWithDefaults() c.Hook = hook{ + BeforeUserCreated: &hookConfig{ + Enabled: false, + }, CustomAccessToken: &hookConfig{ Enabled: false, }, @@ -296,6 +310,9 @@ func TestHookDiff(t *testing.T) { } // Run test diff, err := c.DiffWithRemote(v1API.AuthConfigResponse{ + HookBeforeUserCreatedEnabled: nullable.NewNullableWithValue(true), + HookBeforeUserCreatedUri: nullable.NewNullableWithValue("http://example.com"), + HookBeforeUserCreatedSecrets: nullable.NewNullableWithValue("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"), HookCustomAccessTokenEnabled: nullable.NewNullableWithValue(true), HookCustomAccessTokenUri: nullable.NewNullableWithValue("http://example.com"), HookCustomAccessTokenSecrets: nullable.NewNullableWithValue("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"), @@ -318,6 +335,14 @@ func TestHookDiff(t *testing.T) { t.Run("local enabled remote disabled", func(t *testing.T) { c := newWithDefaults() c.Hook = hook{ + BeforeUserCreated: &hookConfig{ + Enabled: true, + URI: "http://example.com", + Secrets: Secret{ + Value: "test-secret", + SHA256: "ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252", + }, + }, CustomAccessToken: &hookConfig{ Enabled: true, URI: "http://example.com", @@ -346,6 +371,8 @@ func TestHookDiff(t *testing.T) { } // Run test diff, err := c.DiffWithRemote(v1API.AuthConfigResponse{ + HookBeforeUserCreatedEnabled: nullable.NewNullableWithValue(false), + HookBeforeUserCreatedUri: nullable.NewNullableWithValue("pg-functions://postgres/public/beforeUserCreated"), HookCustomAccessTokenEnabled: nullable.NewNullableWithValue(false), HookCustomAccessTokenUri: nullable.NewNullableWithValue("pg-functions://postgres/public/customToken"), HookSendSmsEnabled: nullable.NewNullableWithValue(false), @@ -366,6 +393,7 @@ func TestHookDiff(t *testing.T) { t.Run("local and remote disabled", func(t *testing.T) { c := newWithDefaults() c.Hook = hook{ + BeforeUserCreated: &hookConfig{Enabled: false}, CustomAccessToken: &hookConfig{Enabled: false}, SendSMS: &hookConfig{Enabled: false}, SendEmail: &hookConfig{Enabled: false}, @@ -374,6 +402,7 @@ func TestHookDiff(t *testing.T) { } // Run test diff, err := c.DiffWithRemote(v1API.AuthConfigResponse{ + HookBeforeUserCreatedEnabled: nullable.NewNullableWithValue(false), HookCustomAccessTokenEnabled: nullable.NewNullableWithValue(false), HookSendSmsEnabled: nullable.NewNullableWithValue(false), HookSendEmailEnabled: nullable.NewNullableWithValue(false), diff --git a/pkg/config/config.go b/pkg/config/config.go index 75bf61fcd..9f9e05ee9 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -301,6 +301,10 @@ func (a *auth) Clone() auth { hook := *a.Hook.SendEmail copy.Hook.SendEmail = &hook } + if a.Hook.BeforeUserCreated != nil { + hook := *a.Hook.BeforeUserCreated + copy.Hook.BeforeUserCreated = &hook + } copy.Sms.TestOTP = maps.Clone(a.Sms.TestOTP) return copy } @@ -1161,6 +1165,11 @@ func (h *hook) validate() error { return err } } + if hook := h.BeforeUserCreated; hook != nil { + if err := hook.validate("before_user_created"); err != nil { + return err + } + } return nil } diff --git a/pkg/config/templates/config.toml b/pkg/config/templates/config.toml index d72ae5045..92a5367c1 100644 --- a/pkg/config/templates/config.toml +++ b/pkg/config/templates/config.toml @@ -204,6 +204,11 @@ max_frequency = "5s" # Force log out if the user has been inactive longer than the specified duration. # inactivity_timeout = "8h" +# This hook runs before a new user is created and allows developers to reject the request based on the incoming user object. +# [auth.hook.before_user_created] +# enabled = true +# uri = "pg-functions://postgres/auth/before-user-created-hook" + # This hook runs before a token is issued and allows you to add additional claims based on the authentication method used. # [auth.hook.custom_access_token] # enabled = true diff --git a/pkg/config/testdata/TestHookDiff/local_disabled_remote_enabled.diff b/pkg/config/testdata/TestHookDiff/local_disabled_remote_enabled.diff index 459c58f42..43bab9e10 100644 --- a/pkg/config/testdata/TestHookDiff/local_disabled_remote_enabled.diff +++ b/pkg/config/testdata/TestHookDiff/local_disabled_remote_enabled.diff @@ -1,7 +1,7 @@ diff remote[auth] local[auth] --- remote[auth] +++ local[auth] -@@ -24,19 +24,19 @@ +@@ -24,23 +24,23 @@ [hook] [hook.mfa_verification_attempt] @@ -24,4 +24,9 @@ diff remote[auth] local[auth] +enabled = false uri = "" secrets = "" + [hook.before_user_created] +-enabled = true ++enabled = false + uri = "" + secrets = "" diff --git a/pkg/config/testdata/TestHookDiff/local_enabled_remote_disabled.diff b/pkg/config/testdata/TestHookDiff/local_enabled_remote_disabled.diff index 6065f9d20..ed61a4cdb 100644 --- a/pkg/config/testdata/TestHookDiff/local_enabled_remote_disabled.diff +++ b/pkg/config/testdata/TestHookDiff/local_enabled_remote_disabled.diff @@ -1,7 +1,7 @@ diff remote[auth] local[auth] --- remote[auth] +++ local[auth] -@@ -24,20 +24,20 @@ +@@ -24,25 +24,25 @@ [hook] [hook.mfa_verification_attempt] @@ -27,5 +27,13 @@ diff remote[auth] local[auth] +enabled = true +uri = "pg-functions://postgres/public/sendEmail" secrets = "" + [hook.before_user_created] +-enabled = false +-uri = "pg-functions://postgres/public/beforeUserCreated" +-secrets = "" ++enabled = true ++uri = "http://example.com" ++secrets = "hash:ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252" [mfa] + max_enrolled_factors = 0 diff --git a/pkg/config/testdata/config.toml b/pkg/config/testdata/config.toml index ed0d508fc..0077ec956 100644 --- a/pkg/config/testdata/config.toml +++ b/pkg/config/testdata/config.toml @@ -204,6 +204,11 @@ timebox = "24h" # Force log out if the user has been inactive longer than the specified duration. inactivity_timeout = "8h" +# This hook runs before a new user is created and allows developers to reject the request based on the incoming user object. +[auth.hook.before_user_created] +enabled = true +uri = "pg-functions://postgres/auth/before-user-created-hook" + # This hook runs before a token is issued and allows you to add additional claims based on the authentication method used. [auth.hook.custom_access_token] enabled = true From 7f19e04cf53eba1b196c4c8d93889c5f1ad61f07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 04:22:54 +0000 Subject: [PATCH 18/40] chore(deps): bump github.com/docker/cli from 28.2.2+incompatible to 28.3.0+incompatible (#3761) chore(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 28.2.2+incompatible to 28.3.0+incompatible. - [Commits](https://github.com/docker/cli/compare/v28.2.2...v28.3.0) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-version: 28.3.0+incompatible dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f4a078d97..a0decb5fc 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/charmbracelet/lipgloss v1.1.0 github.com/containerd/errdefs v1.0.0 github.com/containers/common v0.63.1 - github.com/docker/cli v28.2.2+incompatible + github.com/docker/cli v28.3.0+incompatible github.com/docker/docker v28.2.2+incompatible github.com/docker/go-connections v0.5.0 github.com/fsnotify/fsnotify v1.9.0 diff --git a/go.sum b/go.sum index 844e9e776..ac806a52b 100644 --- a/go.sum +++ b/go.sum @@ -237,8 +237,8 @@ github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZ github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= -github.com/docker/cli v28.2.2+incompatible h1:qzx5BNUDFqlvyq4AHzdNB7gSyVTmU4cgsyN9SdInc1A= -github.com/docker/cli v28.2.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v28.3.0+incompatible h1:s+ttruVLhB5ayeuf2BciwDVxYdKi+RoUlxmwNHV3Vfo= +github.com/docker/cli v28.3.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= From 33123b9525762742dca46b89949d65bfecfab375 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 05:22:12 +0000 Subject: [PATCH 19/40] chore(deps): bump supabase/postgres from 17.4.1.043 to 17.4.1.45 in /pkg/config/templates (#3764) chore(deps): bump supabase/postgres in /pkg/config/templates Bumps supabase/postgres from 17.4.1.043 to 17.4.1.45. --- updated-dependencies: - dependency-name: supabase/postgres dependency-version: 17.4.1.45 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 5007c70b1..863aa1467 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -1,5 +1,5 @@ # Exposed for updates by .github/dependabot.yml -FROM supabase/postgres:17.4.1.043 AS pg +FROM supabase/postgres:17.4.1.45 AS pg # Append to ServiceImages when adding new dependencies below FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit From e731cb5add16ce3b1d3812c8266fbc3007216e57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 05:27:16 +0000 Subject: [PATCH 20/40] chore(deps): bump supabase/studio from 2025.06.16-sha-c4316c3 to 2025.06.23-sha-17632f7 in /pkg/config/templates (#3753) chore(deps): bump supabase/studio in /pkg/config/templates Bumps supabase/studio from 2025.06.16-sha-c4316c3 to 2025.06.23-sha-17632f7. --- updated-dependencies: - dependency-name: supabase/studio dependency-version: 2025.06.23-sha-17632f7 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 863aa1467..8b9a84594 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -5,7 +5,7 @@ FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit FROM postgrest/postgrest:v12.2.12 AS postgrest FROM supabase/postgres-meta:v0.89.3 AS pgmeta -FROM supabase/studio:2025.06.16-sha-c4316c3 AS studio +FROM supabase/studio:2025.06.23-sha-17632f7 AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector From c552900274a6aaa25a44a36aeb52476ae9cc1df1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 05:32:18 +0000 Subject: [PATCH 21/40] chore(deps): bump supabase/realtime from v2.37.3 to v2.37.7 in /pkg/config/templates (#3763) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.37.3 to v2.37.7. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.37.7 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 8b9a84594..7aafa12ee 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.5 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.37.3 AS realtime +FROM supabase/realtime:v2.37.7 AS realtime FROM supabase/storage-api:v1.24.6 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From 67d36eec3482c9f8c573befbbc22b68f6cef888c Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Wed, 25 Jun 2025 11:30:50 +0200 Subject: [PATCH 22/40] chore: sync API types from infrastructure (#3765) Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> --- pkg/api/types.gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index c6cfdff10..726ccf532 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -1954,15 +1954,15 @@ type ProjectUpgradeEligibilityResponse struct { CurrentAppVersionReleaseChannel ProjectUpgradeEligibilityResponseCurrentAppVersionReleaseChannel `json:"current_app_version_release_channel"` DurationEstimateHours float32 `json:"duration_estimate_hours"` Eligible bool `json:"eligible"` - ExtensionDependentObjects []string `json:"extension_dependent_objects"` LatestAppVersion string `json:"latest_app_version"` LegacyAuthCustomRoles []string `json:"legacy_auth_custom_roles"` - PotentialBreakingChanges []string `json:"potential_breaking_changes"` + ObjectsToBeDropped []string `json:"objects_to_be_dropped"` TargetUpgradeVersions []struct { AppVersion string `json:"app_version"` PostgresVersion ProjectUpgradeEligibilityResponseTargetUpgradeVersionsPostgresVersion `json:"postgres_version"` ReleaseChannel ProjectUpgradeEligibilityResponseTargetUpgradeVersionsReleaseChannel `json:"release_channel"` } `json:"target_upgrade_versions"` + UnsupportedExtensions []string `json:"unsupported_extensions"` } // ProjectUpgradeEligibilityResponseCurrentAppVersionReleaseChannel defines model for ProjectUpgradeEligibilityResponse.CurrentAppVersionReleaseChannel. From 372ed92af1b1da0221e9b412a23d849e8344d470 Mon Sep 17 00:00:00 2001 From: "Idris M. Celik" Date: Wed, 25 Jun 2025 19:09:22 +0200 Subject: [PATCH 23/40] feat: add --prune option to remove orphaned functions after deploy (#3720) * Fix #3719 (Add --prune option to 'supabase functions deploy' to remove orphaned functions) * chore: address PR comments * chore: simplify unit tests * chore: update api spec --------- Co-authored-by: Qiao Han Co-authored-by: Han Qiao --- api/overlay.yaml | 3 + cmd/functions.go | 4 +- cmd/root.go | 1 + internal/functions/delete/delete.go | 26 +-- internal/functions/delete/delete_test.go | 4 +- internal/functions/deploy/deploy.go | 58 +++++- internal/functions/deploy/deploy_test.go | 104 ++++++++++- internal/utils/console.go | 5 + pkg/api/types.gen.go | 219 ++++++++++++++++++++++- 9 files changed, 396 insertions(+), 28 deletions(-) diff --git a/api/overlay.yaml b/api/overlay.yaml index 92b28afae..b455dcc79 100644 --- a/api/overlay.yaml +++ b/api/overlay.yaml @@ -26,3 +26,6 @@ actions: - target: $.components.schemas.*.properties.connectionString description: Removes deprecated field that conflicts with naming convention remove: true +- target: $.components.schemas.*.properties.private_jwk.discriminator + description: Replaces discriminated union with concrete type + remove: true diff --git a/cmd/functions.go b/cmd/functions.go index cc5ffa53d..6b5684bc2 100644 --- a/cmd/functions.go +++ b/cmd/functions.go @@ -58,6 +58,7 @@ var ( useLegacyBundle bool noVerifyJWT = new(bool) importMapPath string + prune bool functionsDeployCmd = &cobra.Command{ Use: "deploy [Function name]", @@ -73,7 +74,7 @@ var ( } else if maxJobs > 1 { return errors.New("--jobs must be used together with --use-api") } - return deploy.Run(cmd.Context(), args, useDocker, noVerifyJWT, importMapPath, maxJobs, afero.NewOsFs()) + return deploy.Run(cmd.Context(), args, useDocker, noVerifyJWT, importMapPath, maxJobs, prune, afero.NewOsFs()) }, } @@ -139,6 +140,7 @@ func init() { cobra.CheckErr(deployFlags.MarkHidden("legacy-bundle")) deployFlags.UintVarP(&maxJobs, "jobs", "j", 1, "Maximum number of parallel jobs.") deployFlags.BoolVar(noVerifyJWT, "no-verify-jwt", false, "Disable JWT verification for the Function.") + deployFlags.BoolVar(&prune, "prune", false, "Delete Functions that exist in Supabase project but not locally.") deployFlags.StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.") deployFlags.StringVar(&importMapPath, "import-map", "", "Path to import map file.") functionsServeCmd.Flags().BoolVar(noVerifyJWT, "no-verify-jwt", false, "Disable JWT verification for the Function.") diff --git a/cmd/root.go b/cmd/root.go index a2cc6f0a7..d053045e8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -232,6 +232,7 @@ func init() { }) flags := rootCmd.PersistentFlags() + flags.Bool("yes", false, "answer yes to all prompts") flags.Bool("debug", false, "output debug logs to stderr") flags.String("workdir", "", "path to a Supabase project directory") flags.Bool("experimental", false, "enable experimental features") diff --git a/internal/functions/delete/delete.go b/internal/functions/delete/delete.go index 47d5957ef..5e087e71e 100644 --- a/internal/functions/delete/delete.go +++ b/internal/functions/delete/delete.go @@ -11,27 +11,29 @@ import ( ) func Run(ctx context.Context, slug string, projectRef string, fsys afero.Fs) error { - // 1. Sanity checks. - { - if err := utils.ValidateFunctionSlug(slug); err != nil { - return err - } + if err := utils.ValidateFunctionSlug(slug); err != nil { + return err } + if err := Undeploy(ctx, projectRef, slug); err != nil { + return err + } + fmt.Printf("Deleted Function %s from project %s.\n", utils.Aqua(slug), utils.Aqua(projectRef)) + return nil +} - // 2. Delete Function. +var ErrNoDelete = errors.New("nothing to delete") + +func Undeploy(ctx context.Context, projectRef string, slug string) error { resp, err := utils.GetSupabase().V1DeleteAFunctionWithResponse(ctx, projectRef, slug) if err != nil { return errors.Errorf("failed to delete function: %w", err) } switch resp.StatusCode() { case http.StatusNotFound: - return errors.New("Function " + utils.Aqua(slug) + " does not exist on the Supabase project.") + return errors.Errorf("Function %s does not exist on the Supabase project: %w", slug, ErrNoDelete) case http.StatusOK: - break + return nil default: - return errors.New("Failed to delete Function " + utils.Aqua(slug) + " on the Supabase project: " + string(resp.Body)) + return errors.Errorf("unexpected delete function status %d: %s", resp.StatusCode(), string(resp.Body)) } - - fmt.Println("Deleted Function " + utils.Aqua(slug) + " from project " + utils.Aqua(projectRef) + ".") - return nil } diff --git a/internal/functions/delete/delete_test.go b/internal/functions/delete/delete_test.go index 110208ea9..79bd2bb5a 100644 --- a/internal/functions/delete/delete_test.go +++ b/internal/functions/delete/delete_test.go @@ -73,7 +73,7 @@ func TestDeleteCommand(t *testing.T) { // Run test err := Run(context.Background(), slug, project, fsys) // Check error - assert.ErrorContains(t, err, "Function test-func does not exist on the Supabase project.") + assert.ErrorIs(t, err, ErrNoDelete) assert.Empty(t, apitest.ListUnmatchedRequests()) }) @@ -88,7 +88,7 @@ func TestDeleteCommand(t *testing.T) { // Run test err := Run(context.Background(), slug, project, fsys) // Check error - assert.ErrorContains(t, err, "Failed to delete Function test-func on the Supabase project:") + assert.ErrorContains(t, err, "unexpected delete function status 503:") assert.Empty(t, apitest.ListUnmatchedRequests()) }) } diff --git a/internal/functions/deploy/deploy.go b/internal/functions/deploy/deploy.go index 470a54304..8c815e779 100644 --- a/internal/functions/deploy/deploy.go +++ b/internal/functions/deploy/deploy.go @@ -9,13 +9,15 @@ import ( "github.com/go-errors/errors" "github.com/spf13/afero" + "github.com/supabase/cli/internal/functions/delete" "github.com/supabase/cli/internal/utils" "github.com/supabase/cli/internal/utils/flags" + "github.com/supabase/cli/pkg/api" "github.com/supabase/cli/pkg/config" "github.com/supabase/cli/pkg/function" ) -func Run(ctx context.Context, slugs []string, useDocker bool, noVerifyJWT *bool, importMapPath string, maxJobs uint, fsys afero.Fs) error { +func Run(ctx context.Context, slugs []string, useDocker bool, noVerifyJWT *bool, importMapPath string, maxJobs uint, prune bool, fsys afero.Fs) error { // Load function config and project id if err := flags.LoadConfig(fsys); err != nil { return err @@ -49,6 +51,7 @@ func Run(ctx context.Context, slugs []string, useDocker bool, noVerifyJWT *bool, if err != nil { return err } + // Deploy new and updated functions opt := function.WithMaxJobs(maxJobs) if useDocker { if utils.IsDockerRunning(ctx) { @@ -67,7 +70,10 @@ func Run(ctx context.Context, slugs []string, useDocker bool, noVerifyJWT *bool, fmt.Printf("Deployed Functions on project %s: %s\n", utils.Aqua(flags.ProjectRef), strings.Join(slugs, ", ")) url := fmt.Sprintf("%s/project/%v/functions", utils.GetSupabaseDashboardURL(), flags.ProjectRef) fmt.Println("You can inspect your deployment in the Dashboard: " + url) - return nil + if !prune { + return nil + } + return pruneFunctions(ctx, functionConfig) } func GetFunctionSlugs(fsys afero.Fs) (slugs []string, err error) { @@ -155,3 +161,51 @@ func GetFunctionConfig(slugs []string, importMapPath string, noVerifyJWT *bool, } return functionConfig, nil } + +// pruneFunctions deletes functions that exist remotely but not locally +func pruneFunctions(ctx context.Context, functionConfig config.FunctionConfig) error { + resp, err := utils.GetSupabase().V1ListAllFunctionsWithResponse(ctx, flags.ProjectRef) + if err != nil { + return errors.Errorf("failed to list functions: %w", err) + } else if resp.JSON200 == nil { + return errors.Errorf("unexpected list functions status %d: %s", resp.StatusCode(), string(resp.Body)) + } + // No need to delete disabled functions + var toDelete []string + for _, deployed := range *resp.JSON200 { + if deployed.Status == api.FunctionResponseStatusREMOVED { + continue + } else if _, exists := functionConfig[deployed.Slug]; exists { + continue + } + toDelete = append(toDelete, deployed.Slug) + } + if len(toDelete) == 0 { + fmt.Fprintln(os.Stderr, "No functions to prune.") + return nil + } + // Confirm before pruning functions + msg := fmt.Sprintln(confirmPruneAll(toDelete)) + if shouldDelete, err := utils.NewConsole().PromptYesNo(ctx, msg, false); err != nil { + return err + } else if !shouldDelete { + return errors.New(context.Canceled) + } + for _, slug := range toDelete { + fmt.Fprintln(os.Stderr, "Deleting Function:", slug) + if err := delete.Undeploy(ctx, flags.ProjectRef, slug); errors.Is(err, delete.ErrNoDelete) { + fmt.Fprintln(utils.GetDebugLogger(), err) + } else if err != nil { + return err + } + } + return nil +} + +func confirmPruneAll(pending []string) string { + msg := fmt.Sprintln("Do you want to delete the following functions?") + for _, slug := range pending { + msg += fmt.Sprintf(" • %s\n", utils.Bold(slug)) + } + return msg +} diff --git a/internal/functions/deploy/deploy_test.go b/internal/functions/deploy/deploy_test.go index 9f0fb79db..e746da927 100644 --- a/internal/functions/deploy/deploy_test.go +++ b/internal/functions/deploy/deploy_test.go @@ -11,6 +11,7 @@ import ( "github.com/h2non/gock" "github.com/spf13/afero" + "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/supabase/cli/internal/testing/apitest" @@ -74,7 +75,7 @@ func TestDeployCommand(t *testing.T) { } // Run test noVerifyJWT := true - err = Run(context.Background(), functions, true, &noVerifyJWT, "", 1, fsys) + err = Run(context.Background(), functions, true, &noVerifyJWT, "", 1, false, fsys) // Check error assert.NoError(t, err) assert.Empty(t, apitest.ListUnmatchedRequests()) @@ -129,7 +130,7 @@ import_map = "./import_map.json" outputDir := filepath.Join(utils.TempDir, fmt.Sprintf(".output_%s", slug)) require.NoError(t, afero.WriteFile(fsys, filepath.Join(outputDir, "output.eszip"), []byte(""), 0644)) // Run test - err = Run(context.Background(), nil, true, nil, "", 1, fsys) + err = Run(context.Background(), nil, true, nil, "", 1, false, fsys) // Check error assert.NoError(t, err) assert.Empty(t, apitest.ListUnmatchedRequests()) @@ -182,7 +183,7 @@ import_map = "./import_map.json" outputDir := filepath.Join(utils.TempDir, ".output_enabled-func") require.NoError(t, afero.WriteFile(fsys, filepath.Join(outputDir, "output.eszip"), []byte(""), 0644)) // Run test - err = Run(context.Background(), nil, true, nil, "", 1, fsys) + err = Run(context.Background(), nil, true, nil, "", 1, false, fsys) // Check error assert.NoError(t, err) assert.Empty(t, apitest.ListUnmatchedRequests()) @@ -193,7 +194,7 @@ import_map = "./import_map.json" fsys := afero.NewMemMapFs() require.NoError(t, utils.WriteConfig(fsys, false)) // Run test - err := Run(context.Background(), []string{"_invalid"}, true, nil, "", 1, fsys) + err := Run(context.Background(), []string{"_invalid"}, true, nil, "", 1, false, fsys) // Check error assert.ErrorContains(t, err, "Invalid Function name.") }) @@ -203,7 +204,7 @@ import_map = "./import_map.json" fsys := afero.NewMemMapFs() require.NoError(t, utils.WriteConfig(fsys, false)) // Run test - err := Run(context.Background(), nil, true, nil, "", 1, fsys) + err := Run(context.Background(), nil, true, nil, "", 1, false, fsys) // Check error assert.ErrorContains(t, err, "No Functions specified or found in supabase/functions") }) @@ -249,7 +250,7 @@ verify_jwt = false outputDir := filepath.Join(utils.TempDir, fmt.Sprintf(".output_%s", slug)) require.NoError(t, afero.WriteFile(fsys, filepath.Join(outputDir, "output.eszip"), []byte(""), 0644)) // Run test - assert.NoError(t, Run(context.Background(), []string{slug}, true, nil, "", 1, fsys)) + assert.NoError(t, Run(context.Background(), []string{slug}, true, nil, "", 1, false, fsys)) // Validate api assert.Empty(t, apitest.ListUnmatchedRequests()) }) @@ -295,8 +296,8 @@ verify_jwt = false outputDir := filepath.Join(utils.TempDir, fmt.Sprintf(".output_%s", slug)) require.NoError(t, afero.WriteFile(fsys, filepath.Join(outputDir, "output.eszip"), []byte(""), 0644)) // Run test - noVerifyJwt := false - assert.NoError(t, Run(context.Background(), []string{slug}, true, &noVerifyJwt, "", 1, fsys)) + noVerifyJWT := false + assert.NoError(t, Run(context.Background(), []string{slug}, true, &noVerifyJWT, "", 1, false, fsys)) // Validate api assert.Empty(t, apitest.ListUnmatchedRequests()) }) @@ -372,3 +373,90 @@ func TestImportMapPath(t *testing.T) { assert.Equal(t, path, fc["test"].ImportMap) }) } + +func TestPruneFunctions(t *testing.T) { + flags.ProjectRef = apitest.RandomProjectRef() + token := apitest.RandomAccessToken(t) + t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + viper.Set("YES", true) + + t.Run("prunes functions not in local directory", func(t *testing.T) { + // Setup function entrypoints + localFunctions := config.FunctionConfig{ + "local-func-1": {Enabled: true}, + "local-func-2": {Enabled: true}, + } + // Setup mock api - remote functions include local ones plus orphaned ones + defer gock.OffAll() + remoteFunctions := []api.FunctionResponse{ + {Slug: "local-func-1"}, + {Slug: "local-func-2"}, + {Slug: "orphaned-func-1"}, + {Slug: "orphaned-func-2"}, + } + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef + "/functions"). + Reply(http.StatusOK). + JSON(remoteFunctions) + gock.New(utils.DefaultApiHost). + Delete("/v1/projects/" + flags.ProjectRef + "/functions/orphaned-func-1"). + Reply(http.StatusOK) + gock.New(utils.DefaultApiHost). + Delete("/v1/projects/" + flags.ProjectRef + "/functions/orphaned-func-2"). + Reply(http.StatusOK) + // Run test with prune and force (to skip confirmation) + err := pruneFunctions(context.Background(), localFunctions) + // Check error + assert.NoError(t, err) + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("skips pruning when no orphaned functions", func(t *testing.T) { + // Setup function entrypoints + localFunctions := config.FunctionConfig{ + "local-func-1": {}, + "local-func-2": {}, + } + // Setup mock api - remote functions match local ones exactly + defer gock.OffAll() + remoteFunctions := []api.FunctionResponse{ + {Slug: "local-func-1"}, + {Slug: "local-func-2"}, + {Slug: "orphaned-func-1", Status: api.FunctionResponseStatusREMOVED}, + {Slug: "orphaned-func-2", Status: api.FunctionResponseStatusREMOVED}, + } + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef + "/functions"). + Reply(http.StatusOK). + JSON(remoteFunctions) + // Run test with prune and force + err := pruneFunctions(context.Background(), localFunctions) + // Check error + assert.NoError(t, err) + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("handles 404 on delete gracefully", func(t *testing.T) { + // Setup function entrypoints + localFunctions := config.FunctionConfig{"local-func": {}} + // Setup mock api + defer gock.OffAll() + remoteFunctions := []api.FunctionResponse{ + {Slug: "local-func"}, + {Slug: "orphaned-func"}, + } + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef + "/functions"). + Reply(http.StatusOK). + JSON(remoteFunctions) + // Mock delete endpoint with 404 (function already deleted) + gock.New(utils.DefaultApiHost). + Delete("/v1/projects/" + flags.ProjectRef + "/functions/orphaned-func"). + Reply(http.StatusNotFound) + // Run test with prune and force + err := pruneFunctions(context.Background(), localFunctions) + // Check error + assert.NoError(t, err) + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) +} diff --git a/internal/utils/console.go b/internal/utils/console.go index 85bebdc1e..f80099aa3 100644 --- a/internal/utils/console.go +++ b/internal/utils/console.go @@ -10,6 +10,7 @@ import ( "time" "github.com/go-errors/errors" + "github.com/spf13/viper" "github.com/supabase/cli/pkg/cast" "golang.org/x/term" ) @@ -66,6 +67,10 @@ func (c *Console) PromptYesNo(ctx context.Context, label string, def bool) (bool choices = "y/N" } labelWithChoice := fmt.Sprintf("%s [%s] ", label, choices) + if viper.GetBool("YES") { + fmt.Fprintln(os.Stderr, labelWithChoice+"y") + return true, nil + } // Any error will be handled as default value input, err := c.PromptText(ctx, labelWithChoice) if len(input) > 0 { diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 726ccf532..1509530e3 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -211,6 +211,41 @@ const ( CreateSigningKeyBodyAlgorithmRS256 CreateSigningKeyBodyAlgorithm = "RS256" ) +// Defines values for CreateSigningKeyBodyPrivateJwk0E. +const ( + AQAB CreateSigningKeyBodyPrivateJwk0E = "AQAB" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk0Kty. +const ( + RSA CreateSigningKeyBodyPrivateJwk0Kty = "RSA" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk1Crv. +const ( + P256 CreateSigningKeyBodyPrivateJwk1Crv = "P-256" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk1Kty. +const ( + EC CreateSigningKeyBodyPrivateJwk1Kty = "EC" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk2Crv. +const ( + Ed25519 CreateSigningKeyBodyPrivateJwk2Crv = "Ed25519" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk2Kty. +const ( + OKP CreateSigningKeyBodyPrivateJwk2Kty = "OKP" +) + +// Defines values for CreateSigningKeyBodyPrivateJwk3Kty. +const ( + Oct CreateSigningKeyBodyPrivateJwk3Kty = "oct" +) + // Defines values for CreateSigningKeyBodyStatus. const ( CreateSigningKeyBodyStatusInUse CreateSigningKeyBodyStatus = "in_use" @@ -1444,13 +1479,76 @@ type CreateSecretBody = []struct { // CreateSigningKeyBody defines model for CreateSigningKeyBody. type CreateSigningKeyBody struct { - Algorithm CreateSigningKeyBodyAlgorithm `json:"algorithm"` - Status *CreateSigningKeyBodyStatus `json:"status,omitempty"` + Algorithm CreateSigningKeyBodyAlgorithm `json:"algorithm"` + PrivateJwk *CreateSigningKeyBody_PrivateJwk `json:"private_jwk,omitempty"` + Status *CreateSigningKeyBodyStatus `json:"status,omitempty"` } // CreateSigningKeyBodyAlgorithm defines model for CreateSigningKeyBody.Algorithm. type CreateSigningKeyBodyAlgorithm string +// CreateSigningKeyBodyPrivateJwk0 defines model for . +type CreateSigningKeyBodyPrivateJwk0 struct { + D string `json:"d"` + Dp string `json:"dp"` + Dq string `json:"dq"` + E CreateSigningKeyBodyPrivateJwk0E `json:"e"` + Kty CreateSigningKeyBodyPrivateJwk0Kty `json:"kty"` + N string `json:"n"` + P string `json:"p"` + Q string `json:"q"` + Qi string `json:"qi"` +} + +// CreateSigningKeyBodyPrivateJwk0E defines model for CreateSigningKeyBody.PrivateJwk.0.E. +type CreateSigningKeyBodyPrivateJwk0E string + +// CreateSigningKeyBodyPrivateJwk0Kty defines model for CreateSigningKeyBody.PrivateJwk.0.Kty. +type CreateSigningKeyBodyPrivateJwk0Kty string + +// CreateSigningKeyBodyPrivateJwk1 defines model for . +type CreateSigningKeyBodyPrivateJwk1 struct { + Crv CreateSigningKeyBodyPrivateJwk1Crv `json:"crv"` + D string `json:"d"` + Kty CreateSigningKeyBodyPrivateJwk1Kty `json:"kty"` + X string `json:"x"` + Y string `json:"y"` +} + +// CreateSigningKeyBodyPrivateJwk1Crv defines model for CreateSigningKeyBody.PrivateJwk.1.Crv. +type CreateSigningKeyBodyPrivateJwk1Crv string + +// CreateSigningKeyBodyPrivateJwk1Kty defines model for CreateSigningKeyBody.PrivateJwk.1.Kty. +type CreateSigningKeyBodyPrivateJwk1Kty string + +// CreateSigningKeyBodyPrivateJwk2 defines model for . +type CreateSigningKeyBodyPrivateJwk2 struct { + Crv CreateSigningKeyBodyPrivateJwk2Crv `json:"crv"` + D string `json:"d"` + Kty CreateSigningKeyBodyPrivateJwk2Kty `json:"kty"` + X string `json:"x"` +} + +// CreateSigningKeyBodyPrivateJwk2Crv defines model for CreateSigningKeyBody.PrivateJwk.2.Crv. +type CreateSigningKeyBodyPrivateJwk2Crv string + +// CreateSigningKeyBodyPrivateJwk2Kty defines model for CreateSigningKeyBody.PrivateJwk.2.Kty. +type CreateSigningKeyBodyPrivateJwk2Kty string + +// CreateSigningKeyBodyPrivateJwk3 defines model for . +type CreateSigningKeyBodyPrivateJwk3 struct { + K string `json:"k"` + Kty CreateSigningKeyBodyPrivateJwk3Kty `json:"kty"` +} + +// CreateSigningKeyBodyPrivateJwk3Kty defines model for CreateSigningKeyBody.PrivateJwk.3.Kty. +type CreateSigningKeyBodyPrivateJwk3Kty string + +// CreateSigningKeyBody_PrivateJwk defines model for CreateSigningKeyBody.PrivateJwk. +type CreateSigningKeyBody_PrivateJwk struct { + union json.RawMessage +} + // CreateSigningKeyBodyStatus defines model for CreateSigningKeyBody.Status. type CreateSigningKeyBodyStatus string @@ -1962,7 +2060,8 @@ type ProjectUpgradeEligibilityResponse struct { PostgresVersion ProjectUpgradeEligibilityResponseTargetUpgradeVersionsPostgresVersion `json:"postgres_version"` ReleaseChannel ProjectUpgradeEligibilityResponseTargetUpgradeVersionsReleaseChannel `json:"release_channel"` } `json:"target_upgrade_versions"` - UnsupportedExtensions []string `json:"unsupported_extensions"` + UnsupportedExtensions []string `json:"unsupported_extensions"` + UserDefinedObjectsInInternalSchemas []string `json:"user_defined_objects_in_internal_schemas"` } // ProjectUpgradeEligibilityResponseCurrentAppVersionReleaseChannel defines model for ProjectUpgradeEligibilityResponse.CurrentAppVersionReleaseChannel. @@ -3552,6 +3651,120 @@ func (t *ApplyProjectAddonBody_AddonVariant) UnmarshalJSON(b []byte) error { return err } +// AsCreateSigningKeyBodyPrivateJwk0 returns the union data inside the CreateSigningKeyBody_PrivateJwk as a CreateSigningKeyBodyPrivateJwk0 +func (t CreateSigningKeyBody_PrivateJwk) AsCreateSigningKeyBodyPrivateJwk0() (CreateSigningKeyBodyPrivateJwk0, error) { + var body CreateSigningKeyBodyPrivateJwk0 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromCreateSigningKeyBodyPrivateJwk0 overwrites any union data inside the CreateSigningKeyBody_PrivateJwk as the provided CreateSigningKeyBodyPrivateJwk0 +func (t *CreateSigningKeyBody_PrivateJwk) FromCreateSigningKeyBodyPrivateJwk0(v CreateSigningKeyBodyPrivateJwk0) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeCreateSigningKeyBodyPrivateJwk0 performs a merge with any union data inside the CreateSigningKeyBody_PrivateJwk, using the provided CreateSigningKeyBodyPrivateJwk0 +func (t *CreateSigningKeyBody_PrivateJwk) MergeCreateSigningKeyBodyPrivateJwk0(v CreateSigningKeyBodyPrivateJwk0) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsCreateSigningKeyBodyPrivateJwk1 returns the union data inside the CreateSigningKeyBody_PrivateJwk as a CreateSigningKeyBodyPrivateJwk1 +func (t CreateSigningKeyBody_PrivateJwk) AsCreateSigningKeyBodyPrivateJwk1() (CreateSigningKeyBodyPrivateJwk1, error) { + var body CreateSigningKeyBodyPrivateJwk1 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromCreateSigningKeyBodyPrivateJwk1 overwrites any union data inside the CreateSigningKeyBody_PrivateJwk as the provided CreateSigningKeyBodyPrivateJwk1 +func (t *CreateSigningKeyBody_PrivateJwk) FromCreateSigningKeyBodyPrivateJwk1(v CreateSigningKeyBodyPrivateJwk1) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeCreateSigningKeyBodyPrivateJwk1 performs a merge with any union data inside the CreateSigningKeyBody_PrivateJwk, using the provided CreateSigningKeyBodyPrivateJwk1 +func (t *CreateSigningKeyBody_PrivateJwk) MergeCreateSigningKeyBodyPrivateJwk1(v CreateSigningKeyBodyPrivateJwk1) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsCreateSigningKeyBodyPrivateJwk2 returns the union data inside the CreateSigningKeyBody_PrivateJwk as a CreateSigningKeyBodyPrivateJwk2 +func (t CreateSigningKeyBody_PrivateJwk) AsCreateSigningKeyBodyPrivateJwk2() (CreateSigningKeyBodyPrivateJwk2, error) { + var body CreateSigningKeyBodyPrivateJwk2 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromCreateSigningKeyBodyPrivateJwk2 overwrites any union data inside the CreateSigningKeyBody_PrivateJwk as the provided CreateSigningKeyBodyPrivateJwk2 +func (t *CreateSigningKeyBody_PrivateJwk) FromCreateSigningKeyBodyPrivateJwk2(v CreateSigningKeyBodyPrivateJwk2) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeCreateSigningKeyBodyPrivateJwk2 performs a merge with any union data inside the CreateSigningKeyBody_PrivateJwk, using the provided CreateSigningKeyBodyPrivateJwk2 +func (t *CreateSigningKeyBody_PrivateJwk) MergeCreateSigningKeyBodyPrivateJwk2(v CreateSigningKeyBodyPrivateJwk2) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsCreateSigningKeyBodyPrivateJwk3 returns the union data inside the CreateSigningKeyBody_PrivateJwk as a CreateSigningKeyBodyPrivateJwk3 +func (t CreateSigningKeyBody_PrivateJwk) AsCreateSigningKeyBodyPrivateJwk3() (CreateSigningKeyBodyPrivateJwk3, error) { + var body CreateSigningKeyBodyPrivateJwk3 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromCreateSigningKeyBodyPrivateJwk3 overwrites any union data inside the CreateSigningKeyBody_PrivateJwk as the provided CreateSigningKeyBodyPrivateJwk3 +func (t *CreateSigningKeyBody_PrivateJwk) FromCreateSigningKeyBodyPrivateJwk3(v CreateSigningKeyBodyPrivateJwk3) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeCreateSigningKeyBodyPrivateJwk3 performs a merge with any union data inside the CreateSigningKeyBody_PrivateJwk, using the provided CreateSigningKeyBodyPrivateJwk3 +func (t *CreateSigningKeyBody_PrivateJwk) MergeCreateSigningKeyBodyPrivateJwk3(v CreateSigningKeyBodyPrivateJwk3) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t CreateSigningKeyBody_PrivateJwk) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *CreateSigningKeyBody_PrivateJwk) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsListProjectAddonsResponseAvailableAddonsVariantsId0 returns the union data inside the ListProjectAddonsResponse_AvailableAddons_Variants_Id as a ListProjectAddonsResponseAvailableAddonsVariantsId0 func (t ListProjectAddonsResponse_AvailableAddons_Variants_Id) AsListProjectAddonsResponseAvailableAddonsVariantsId0() (ListProjectAddonsResponseAvailableAddonsVariantsId0, error) { var body ListProjectAddonsResponseAvailableAddonsVariantsId0 From 0a95b8cffbe10e63e13682d46a1940c507204a5d Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 26 Jun 2025 04:59:32 +0200 Subject: [PATCH 24/40] chore: sync API types from infrastructure (#3769) Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> --- pkg/api/client.gen.go | 32 ++++++++++++++++++++++++++++++++ pkg/api/types.gen.go | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index b1180c329..8903bf4b8 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -6538,6 +6538,22 @@ func NewV1CreateAFunctionRequestWithBody(server string, ref string, params *V1Cr } + if params.EzbrSha256 != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ezbr_sha256", runtime.ParamLocationQuery, *params.EzbrSha256); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + queryURL.RawQuery = queryValues.Encode() } @@ -6897,6 +6913,22 @@ func NewV1UpdateAFunctionRequestWithBody(server string, ref string, functionSlug } + if params.EzbrSha256 != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ezbr_sha256", runtime.ParamLocationQuery, *params.EzbrSha256); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + queryURL.RawQuery = queryValues.Encode() } diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 1509530e3..cd96838f1 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -1337,6 +1337,7 @@ type BranchUpdateResponseMessage string type BulkUpdateFunctionBody = []struct { CreatedAt *int64 `json:"created_at,omitempty"` EntrypointPath *string `json:"entrypoint_path,omitempty"` + EzbrSha256 *string `json:"ezbr_sha256,omitempty"` Id string `json:"id"` ImportMap *bool `json:"import_map,omitempty"` ImportMapPath *string `json:"import_map_path,omitempty"` @@ -1355,6 +1356,7 @@ type BulkUpdateFunctionResponse struct { Functions []struct { CreatedAt int64 `json:"created_at"` EntrypointPath *string `json:"entrypoint_path,omitempty"` + EzbrSha256 *string `json:"ezbr_sha256,omitempty"` Id string `json:"id"` ImportMap *bool `json:"import_map,omitempty"` ImportMapPath *string `json:"import_map_path,omitempty"` @@ -1638,6 +1640,7 @@ type FunctionDeployBody struct { type FunctionResponse struct { CreatedAt int64 `json:"created_at"` EntrypointPath *string `json:"entrypoint_path,omitempty"` + EzbrSha256 *string `json:"ezbr_sha256,omitempty"` Id string `json:"id"` ImportMap *bool `json:"import_map,omitempty"` ImportMapPath *string `json:"import_map_path,omitempty"` @@ -1656,6 +1659,7 @@ type FunctionResponseStatus string type FunctionSlugResponse struct { CreatedAt int64 `json:"created_at"` EntrypointPath *string `json:"entrypoint_path,omitempty"` + EzbrSha256 *string `json:"ezbr_sha256,omitempty"` Id string `json:"id"` ImportMap *bool `json:"import_map,omitempty"` ImportMapPath *string `json:"import_map_path,omitempty"` @@ -3136,6 +3140,7 @@ type V1CreateAFunctionParams struct { ImportMap *bool `form:"import_map,omitempty" json:"import_map,omitempty"` EntrypointPath *string `form:"entrypoint_path,omitempty" json:"entrypoint_path,omitempty"` ImportMapPath *string `form:"import_map_path,omitempty" json:"import_map_path,omitempty"` + EzbrSha256 *string `form:"ezbr_sha256,omitempty" json:"ezbr_sha256,omitempty"` } // V1DeployAFunctionParams defines parameters for V1DeployAFunction. @@ -3158,6 +3163,7 @@ type V1UpdateAFunctionParams struct { ImportMap *bool `form:"import_map,omitempty" json:"import_map,omitempty"` EntrypointPath *string `form:"entrypoint_path,omitempty" json:"entrypoint_path,omitempty"` ImportMapPath *string `form:"import_map_path,omitempty" json:"import_map_path,omitempty"` + EzbrSha256 *string `form:"ezbr_sha256,omitempty" json:"ezbr_sha256,omitempty"` } // V1GetServicesHealthParams defines parameters for V1GetServicesHealth. From 25425659fd11c1c22de4943e65aff6e75473add3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 04:33:23 +0000 Subject: [PATCH 25/40] chore(deps): bump supabase/postgres from 17.4.1.45 to 17.4.1.47 in /pkg/config/templates (#3772) chore(deps): bump supabase/postgres in /pkg/config/templates Bumps supabase/postgres from 17.4.1.45 to 17.4.1.47. --- updated-dependencies: - dependency-name: supabase/postgres dependency-version: 17.4.1.47 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 7aafa12ee..1e1e85801 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -1,5 +1,5 @@ # Exposed for updates by .github/dependabot.yml -FROM supabase/postgres:17.4.1.45 AS pg +FROM supabase/postgres:17.4.1.47 AS pg # Append to ServiceImages when adding new dependencies below FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit From f5bc1f8cdce6adb80d7664461711c998ba016bcd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 04:38:23 +0000 Subject: [PATCH 26/40] chore(deps): bump supabase/realtime from v2.37.7 to v2.37.9 in /pkg/config/templates (#3770) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.37.7 to v2.37.9. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.37.9 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 1e1e85801..afc9627e9 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.5 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.37.7 AS realtime +FROM supabase/realtime:v2.37.9 AS realtime FROM supabase/storage-api:v1.24.6 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From d8b76b1fce018fa38ecba34170d90eb17e69462d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 04:43:46 +0000 Subject: [PATCH 27/40] chore(deps): bump supabase/storage-api from v1.24.6 to v1.24.7 in /pkg/config/templates (#3771) chore(deps): bump supabase/storage-api in /pkg/config/templates Bumps supabase/storage-api from v1.24.6 to v1.24.7. --- updated-dependencies: - dependency-name: supabase/storage-api dependency-version: v1.24.7 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index afc9627e9..b7d491095 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -12,7 +12,7 @@ FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.5 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue FROM supabase/realtime:v2.37.9 AS realtime -FROM supabase/storage-api:v1.24.6 AS storage +FROM supabase/storage-api:v1.24.7 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below FROM supabase/pgadmin-schema-diff:cli-0.0.5 AS differ From 3c15def1074abe0d2dc8e0e4e2f311df5a125ae1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 13:17:25 +0800 Subject: [PATCH 28/40] chore(deps): bump github.com/getsentry/sentry-go from 0.33.0 to 0.34.0 (#3755) Bumps [github.com/getsentry/sentry-go](https://github.com/getsentry/sentry-go) from 0.33.0 to 0.34.0. - [Release notes](https://github.com/getsentry/sentry-go/releases) - [Changelog](https://github.com/getsentry/sentry-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-go/compare/v0.33.0...v0.34.0) --- updated-dependencies: - dependency-name: github.com/getsentry/sentry-go dependency-version: 0.34.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a0decb5fc..0c10bf67b 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/docker/docker v28.2.2+incompatible github.com/docker/go-connections v0.5.0 github.com/fsnotify/fsnotify v1.9.0 - github.com/getsentry/sentry-go v0.33.0 + github.com/getsentry/sentry-go v0.34.0 github.com/go-errors/errors v1.5.1 github.com/go-git/go-git/v5 v5.16.2 github.com/go-xmlfmt/xmlfmt v1.1.3 diff --git a/go.sum b/go.sum index ac806a52b..e67fccde4 100644 --- a/go.sum +++ b/go.sum @@ -296,8 +296,8 @@ github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/getkin/kin-openapi v0.131.0 h1:NO2UeHnFKRYhZ8wg6Nyh5Cq7dHk4suQQr72a4pMrDxE= github.com/getkin/kin-openapi v0.131.0/go.mod h1:3OlG51PCYNsPByuiMB0t4fjnNlIDnaEDsjiKUV8nL58= -github.com/getsentry/sentry-go v0.33.0 h1:YWyDii0KGVov3xOaamOnF0mjOrqSjBqwv48UEzn7QFg= -github.com/getsentry/sentry-go v0.33.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE= +github.com/getsentry/sentry-go v0.34.0 h1:1FCHBVp8TfSc8L10zqSwXUZNiOSF+10qw4czjarTiY4= +github.com/getsentry/sentry-go v0.34.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE= github.com/ghostiam/protogetter v0.3.15 h1:1KF5sXel0HE48zh1/vn0Loiw25A9ApyseLzQuif1mLY= github.com/ghostiam/protogetter v0.3.15/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= From 7f98a219f3fc3110ba535f1536acdf66f45bd00e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 05:23:45 +0000 Subject: [PATCH 29/40] chore(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.0+incompatible (#3762) chore(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 28.2.2+incompatible to 28.3.0+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v28.2.2...v28.3.0) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-version: 28.3.0+incompatible dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0c10bf67b..fd50f54a3 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/containerd/errdefs v1.0.0 github.com/containers/common v0.63.1 github.com/docker/cli v28.3.0+incompatible - github.com/docker/docker v28.2.2+incompatible + github.com/docker/docker v28.3.0+incompatible github.com/docker/go-connections v0.5.0 github.com/fsnotify/fsnotify v1.9.0 github.com/getsentry/sentry-go v0.34.0 diff --git a/go.sum b/go.sum index e67fccde4..05091cd49 100644 --- a/go.sum +++ b/go.sum @@ -242,8 +242,8 @@ github.com/docker/cli v28.3.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvM github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw= -github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.3.0+incompatible h1:ffS62aKWupCWdvcee7nBU9fhnmknOqDPaJAMtfK0ImQ= +github.com/docker/docker v28.3.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= From 348d018c1d27ac57e052ecbe3e5a3e6bfddcbabd Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 26 Jun 2025 14:19:52 +0800 Subject: [PATCH 30/40] fix: skip unchanged functions when deploying (#3768) * fix: skip unchanged functions when deploying * chore: rename checksum for clarity --- internal/functions/deploy/deploy.go | 4 ++-- pkg/function/api.go | 1 + pkg/function/batch.go | 22 ++++++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/internal/functions/deploy/deploy.go b/internal/functions/deploy/deploy.go index 8c815e779..bcee53c55 100644 --- a/internal/functions/deploy/deploy.go +++ b/internal/functions/deploy/deploy.go @@ -181,7 +181,7 @@ func pruneFunctions(ctx context.Context, functionConfig config.FunctionConfig) e toDelete = append(toDelete, deployed.Slug) } if len(toDelete) == 0 { - fmt.Fprintln(os.Stderr, "No functions to prune.") + fmt.Fprintln(os.Stderr, "No Functions to prune.") return nil } // Confirm before pruning functions @@ -203,7 +203,7 @@ func pruneFunctions(ctx context.Context, functionConfig config.FunctionConfig) e } func confirmPruneAll(pending []string) string { - msg := fmt.Sprintln("Do you want to delete the following functions?") + msg := fmt.Sprintln("Do you want to delete the following Functions from your project?") for _, slug := range pending { msg += fmt.Sprintf(" • %s\n", utils.Bold(slug)) } diff --git a/pkg/function/api.go b/pkg/function/api.go index 9b3aa50e7..df4443240 100644 --- a/pkg/function/api.go +++ b/pkg/function/api.go @@ -20,6 +20,7 @@ type FunctionDeployMetadata struct { Name *string `json:"name,omitempty"` StaticPatterns *[]string `json:"static_patterns,omitempty"` VerifyJwt *bool `json:"verify_jwt,omitempty"` + SHA256 string `json:"sha256,omitempty"` } type EszipBundler interface { diff --git a/pkg/function/batch.go b/pkg/function/batch.go index 19aa4818a..69754f978 100644 --- a/pkg/function/batch.go +++ b/pkg/function/batch.go @@ -3,6 +3,8 @@ package function import ( "bytes" "context" + "crypto/sha256" + "encoding/hex" "fmt" "io" "net/http" @@ -14,6 +16,7 @@ import ( "github.com/docker/go-units" "github.com/go-errors/errors" "github.com/supabase/cli/pkg/api" + "github.com/supabase/cli/pkg/cast" "github.com/supabase/cli/pkg/config" ) @@ -41,9 +44,9 @@ func (s *EdgeRuntimeAPI) UpsertFunctions(ctx context.Context, functionConfig con return err } policy.Reset() - exists := make(map[string]struct{}, len(result)) + checksum := make(map[string]string, len(result)) for _, f := range result { - exists[f.Slug] = struct{}{} + checksum[f.Slug] = cast.Val(f.EzbrSha256, "") } var toUpdate api.BulkUpdateFunctionBody OUTER: @@ -63,9 +66,16 @@ OUTER: return err } meta.VerifyJwt = &function.VerifyJWT + bodyHash := sha256.Sum256(body.Bytes()) + meta.SHA256 = hex.EncodeToString(bodyHash[:]) + // Skip if function has not changed + if checksum[slug] == meta.SHA256 { + fmt.Fprintln(os.Stderr, "No change found in Function:", slug) + continue + } // Update if function already exists upsert := func() (api.BulkUpdateFunctionBody, error) { - if _, ok := exists[slug]; ok { + if _, ok := checksum[slug]; ok { return s.updateFunction(ctx, slug, meta, bytes.NewReader(body.Bytes())) } return s.createFunction(ctx, slug, meta, bytes.NewReader(body.Bytes())) @@ -74,7 +84,7 @@ OUTER: fmt.Fprintf(os.Stderr, "Deploying Function: %s (script size: %s)\n", slug, functionSize) result, err := backoff.RetryNotifyWithData(upsert, policy, func(err error, d time.Duration) { if strings.Contains(err.Error(), "Duplicated function slug") { - exists[slug] = struct{}{} + checksum[slug] = "" } }) if err != nil { @@ -103,6 +113,7 @@ func (s *EdgeRuntimeAPI) updateFunction(ctx context.Context, slug string, meta F VerifyJwt: meta.VerifyJwt, ImportMapPath: meta.ImportMapPath, EntrypointPath: &meta.EntrypointPath, + EzbrSha256: &meta.SHA256, }, eszipContentType, body) if err != nil { return api.BulkUpdateFunctionBody{}, errors.Errorf("failed to update function: %w", err) @@ -120,6 +131,7 @@ func (s *EdgeRuntimeAPI) updateFunction(ctx context.Context, slug string, meta F VerifyJwt: resp.JSON200.VerifyJwt, Status: api.BulkUpdateFunctionBodyStatus(resp.JSON200.Status), CreatedAt: &resp.JSON200.CreatedAt, + EzbrSha256: resp.JSON200.EzbrSha256, }}, nil } @@ -130,6 +142,7 @@ func (s *EdgeRuntimeAPI) createFunction(ctx context.Context, slug string, meta F VerifyJwt: meta.VerifyJwt, ImportMapPath: meta.ImportMapPath, EntrypointPath: &meta.EntrypointPath, + EzbrSha256: &meta.SHA256, }, eszipContentType, body) if err != nil { return api.BulkUpdateFunctionBody{}, errors.Errorf("failed to create function: %w", err) @@ -147,5 +160,6 @@ func (s *EdgeRuntimeAPI) createFunction(ctx context.Context, slug string, meta F VerifyJwt: resp.JSON201.VerifyJwt, Status: api.BulkUpdateFunctionBodyStatus(resp.JSON201.Status), CreatedAt: &resp.JSON201.CreatedAt, + EzbrSha256: resp.JSON201.EzbrSha256, }}, nil } From 2e8672d925496be4a438bc086ed2ab990a603349 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 26 Jun 2025 23:13:18 +0800 Subject: [PATCH 31/40] fix: include scopes from deno.json (#3773) --- internal/utils/deno.go | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/internal/utils/deno.go b/internal/utils/deno.go index 5bece3a5a..86d12da0d 100644 --- a/internal/utils/deno.go +++ b/internal/utils/deno.go @@ -225,12 +225,7 @@ func BindHostModules(cwd, relEntrypointPath, relImportMapPath string, fsys afero } // Resolving all Import Graph addModule := func(unixPath string, w io.Writer) error { - hostPath := filepath.FromSlash(unixPath) - if path.IsAbs(unixPath) { - hostPath = filepath.VolumeName(cwd) + hostPath - } else { - hostPath = filepath.Join(cwd, hostPath) - } + hostPath := toHostPath(cwd, unixPath) f, err := fsys.Open(hostPath) if err != nil { return errors.Errorf("failed to read file: %w", err) @@ -247,10 +242,29 @@ func BindHostModules(cwd, relEntrypointPath, relImportMapPath string, fsys afero if err := importMap.WalkImportPaths(unixPath, addModule); err != nil { return nil, err } - // TODO: support scopes + // Also mount local directories declared in scopes + for _, scope := range importMap.Scopes { + for _, unixPath := range scope { + hostPath := toHostPath(cwd, unixPath) + // Ref: https://docs.deno.com/runtime/fundamentals/modules/#overriding-https-imports + if _, err := fsys.Stat(hostPath); err != nil { + return nil, errors.Errorf("failed to resolve scope: %w", err) + } + dockerPath := ToDockerPath(hostPath) + modules = append(modules, hostPath+":"+dockerPath+":ro") + } + } return modules, nil } +func toHostPath(cwd, unixPath string) string { + hostPath := filepath.FromSlash(unixPath) + if path.IsAbs(unixPath) { + return filepath.VolumeName(cwd) + hostPath + } + return filepath.Join(cwd, hostPath) +} + func ToDockerPath(absHostPath string) string { prefix := filepath.VolumeName(absHostPath) dockerPath := filepath.ToSlash(absHostPath) From 9317de3310c8ff6d3649058fd0eb9a20ae28b449 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 12:49:50 +0800 Subject: [PATCH 32/40] chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0 (#3779) chore(deps): bump github.com/go-viper/mapstructure/v2 Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/go-viper/mapstructure/releases) - [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md) - [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0) --- updated-dependencies: - dependency-name: github.com/go-viper/mapstructure/v2 dependency-version: 2.3.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fd50f54a3..b1082363f 100644 --- a/go.mod +++ b/go.mod @@ -145,7 +145,7 @@ require ( github.com/go-toolsmith/astp v1.1.0 // indirect github.com/go-toolsmith/strparse v1.1.0 // indirect github.com/go-toolsmith/typep v1.1.0 // indirect - github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/go-viper/mapstructure/v2 v2.3.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gofrs/flock v0.12.1 // indirect diff --git a/go.sum b/go.sum index 05091cd49..189341d3d 100644 --- a/go.sum +++ b/go.sum @@ -361,8 +361,8 @@ github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQi github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= -github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= -github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk= +github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-xmlfmt/xmlfmt v1.1.3 h1:t8Ey3Uy7jDSEisW2K3somuMKIpzktkWptA0iFCnRUWY= github.com/go-xmlfmt/xmlfmt v1.1.3/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= From bd308753ca5d382e9523541924bc979dbca079f1 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Mon, 30 Jun 2025 06:54:18 +0200 Subject: [PATCH 33/40] fix: handle nullable api key (#3774) * chore: sync API types from infrastructure * chore: handle nullable api key --------- Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> Co-authored-by: Qiao Han --- go.mod | 2 +- internal/bootstrap/bootstrap.go | 12 +++------ internal/bootstrap/bootstrap_test.go | 5 ++-- internal/link/link_test.go | 7 ++--- internal/projects/apiKeys/api_keys.go | 14 ++++++++-- internal/projects/apiKeys/api_keys_test.go | 6 ++++- internal/storage/cp/cp_test.go | 30 ++++++++-------------- internal/storage/ls/ls_test.go | 15 +++++------ internal/storage/mv/mv_test.go | 15 +++++------ internal/storage/rm/rm_test.go | 20 ++++++--------- internal/utils/tenant/client.go | 12 ++++++--- internal/utils/tenant/client_test.go | 15 ++++++----- pkg/api/types.gen.go | 2 +- 13 files changed, 78 insertions(+), 77 deletions(-) diff --git a/go.mod b/go.mod index b1082363f..f1b587cc3 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/joho/godotenv v1.5.1 github.com/mithrandie/csvq-driver v1.7.0 github.com/muesli/reflow v0.3.0 + github.com/oapi-codegen/nullable v1.1.0 github.com/slack-go/slack v0.17.1 github.com/spf13/afero v1.14.0 github.com/spf13/cobra v1.9.1 @@ -240,7 +241,6 @@ require ( github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.19.1 // indirect - github.com/oapi-codegen/nullable v1.1.0 // indirect github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 // indirect github.com/oapi-codegen/runtime v1.1.1 // indirect github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go index 9615256ca..ac04146fe 100644 --- a/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -215,17 +215,11 @@ const ( func writeDotEnv(keys []api.ApiKeyResponse, config pgconn.Config, fsys afero.Fs) error { // Initialise default envs + initial := apiKeys.ToEnv(keys) + initial[SUPABASE_URL] = "https://" + utils.GetSupabaseHost(flags.ProjectRef) transactionMode := *config.Copy() transactionMode.Port = 6543 - initial := map[string]string{ - SUPABASE_URL: "https://" + utils.GetSupabaseHost(flags.ProjectRef), - POSTGRES_URL: utils.ToPostgresURL(transactionMode), - } - for _, entry := range keys { - name := strings.ToUpper(entry.Name) - key := fmt.Sprintf("SUPABASE_%s_KEY", name) - initial[key] = entry.ApiKey - } + initial[POSTGRES_URL] = utils.ToPostgresURL(transactionMode) // Populate from .env.example if exists envs, err := parseExampleEnv(fsys) if err != nil { diff --git a/internal/bootstrap/bootstrap_test.go b/internal/bootstrap/bootstrap_test.go index 6cf6eb6e4..ab12d1268 100644 --- a/internal/bootstrap/bootstrap_test.go +++ b/internal/bootstrap/bootstrap_test.go @@ -7,6 +7,7 @@ import ( "github.com/jackc/pgconn" "github.com/joho/godotenv" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -46,11 +47,11 @@ func TestSuggestAppStart(t *testing.T) { func TestWriteEnv(t *testing.T) { var apiKeys = []api.ApiKeyResponse{{ - ApiKey: "anonkey", Name: "anon", + ApiKey: nullable.NewNullableWithValue("anonkey"), }, { - ApiKey: "servicekey", Name: "service_role", + ApiKey: nullable.NewNullableWithValue("servicekey"), }} var dbConfig = pgconn.Config{ diff --git a/internal/link/link_test.go b/internal/link/link_test.go index 376886ff3..8e47d8cc2 100644 --- a/internal/link/link_test.go +++ b/internal/link/link_test.go @@ -10,6 +10,7 @@ import ( "github.com/jackc/pgconn" "github.com/jackc/pgerrcode" "github.com/jackc/pgx/v4" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/testing/apitest" @@ -65,7 +66,7 @@ func TestLinkCommand(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/api-keys"). Reply(200). - JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: "anon-key"}}) + JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}}) // Link configs gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/config/database/postgres"). @@ -134,7 +135,7 @@ func TestLinkCommand(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/api-keys"). Reply(200). - JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: "anon-key"}}) + JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}}) // Link configs gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/config/database/postgres"). @@ -184,7 +185,7 @@ func TestLinkCommand(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/api-keys"). Reply(200). - JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: "anon-key"}}) + JSON([]api.ApiKeyResponse{{Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}}) // Link configs gock.New(utils.DefaultApiHost). Get("/v1/projects/" + project + "/config/database/postgres"). diff --git a/internal/projects/apiKeys/api_keys.go b/internal/projects/apiKeys/api_keys.go index 5d5af351c..32a6d1cf0 100644 --- a/internal/projects/apiKeys/api_keys.go +++ b/internal/projects/apiKeys/api_keys.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/go-errors/errors" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/supabase/cli/internal/migration/list" "github.com/supabase/cli/internal/utils" @@ -25,7 +26,9 @@ func Run(ctx context.Context, projectRef string, fsys afero.Fs) error { |-|-| ` for _, entry := range keys { - table += fmt.Sprintf("|`%s`|`%s`|\n", strings.ReplaceAll(entry.Name, "|", "\\|"), entry.ApiKey) + k := strings.ReplaceAll(entry.Name, "|", "\\|") + v := toValue(entry.ApiKey) + table += fmt.Sprintf("|`%s`|`%s`|\n", k, v) } return list.RenderTable(table) @@ -51,7 +54,14 @@ func ToEnv(keys []api.ApiKeyResponse) map[string]string { for _, entry := range keys { name := strings.ToUpper(entry.Name) key := fmt.Sprintf("SUPABASE_%s_KEY", name) - envs[key] = entry.ApiKey + envs[key] = toValue(entry.ApiKey) } return envs } + +func toValue(v nullable.Nullable[string]) string { + if value, err := v.Get(); err == nil { + return value + } + return "******" +} diff --git a/internal/projects/apiKeys/api_keys_test.go b/internal/projects/apiKeys/api_keys_test.go index 48730a0a7..82030c003 100644 --- a/internal/projects/apiKeys/api_keys_test.go +++ b/internal/projects/apiKeys/api_keys_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/testing/apitest" @@ -31,7 +32,10 @@ func TestProjectApiKeysCommand(t *testing.T) { Reply(200). JSON([]api.ApiKeyResponse{{ Name: "Test ApiKey", - ApiKey: "dummy-api-key-value", + ApiKey: nullable.NewNullableWithValue("dummy-api-key-value"), + }, { + Name: "Test NullKey", + ApiKey: nullable.NewNullNullable[string](), }}) // Run test err := Run(context.Background(), project, fsys) diff --git a/internal/storage/cp/cp_test.go b/internal/storage/cp/cp_test.go index 75a0cf3cd..9223c88d3 100644 --- a/internal/storage/cp/cp_test.go +++ b/internal/storage/cp/cp_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -45,6 +46,10 @@ func TestStorageCP(t *testing.T) { // Setup valid access token token := apitest.RandomAccessToken(t) t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + apiKeys := []api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }} t.Run("copy local to remote", func(t *testing.T) { // Setup in-memory fs @@ -55,10 +60,7 @@ func TestStorageCP(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Post("/storage/v1/object/private/file"). Reply(http.StatusOK) @@ -77,10 +79,7 @@ func TestStorageCP(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Get("/storage/v1/bucket"). Reply(http.StatusOK). @@ -100,10 +99,7 @@ func TestStorageCP(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Get("/storage/v1/object/private/file"). Reply(http.StatusOK) @@ -125,10 +121,7 @@ func TestStorageCP(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Get("/storage/v1/bucket"). Reply(http.StatusOK). @@ -166,10 +159,7 @@ func TestStorageCP(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) // Run test err := Run(context.Background(), ".", ".", false, 1, fsys) // Check error diff --git a/internal/storage/ls/ls_test.go b/internal/storage/ls/ls_test.go index e0e2cd207..27c388f5f 100644 --- a/internal/storage/ls/ls_test.go +++ b/internal/storage/ls/ls_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/storage/client" @@ -45,6 +46,10 @@ func TestStorageLS(t *testing.T) { // Setup valid access token token := apitest.RandomAccessToken(t) t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + apiKeys := []api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }} t.Run("lists buckets", func(t *testing.T) { // Setup in-memory fs @@ -54,10 +59,7 @@ func TestStorageLS(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Get("/storage/v1/bucket"). Reply(http.StatusOK). @@ -85,10 +87,7 @@ func TestStorageLS(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Get("/storage/v1/bucket"). Reply(http.StatusOK). diff --git a/internal/storage/mv/mv_test.go b/internal/storage/mv/mv_test.go index fd8ecfbcc..b22ed4d15 100644 --- a/internal/storage/mv/mv_test.go +++ b/internal/storage/mv/mv_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/testing/apitest" @@ -43,6 +44,10 @@ func TestStorageMV(t *testing.T) { // Setup valid access token token := apitest.RandomAccessToken(t) t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + apiKeys := []api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }} t.Run("moves single object", func(t *testing.T) { // Setup in-memory fs @@ -52,10 +57,7 @@ func TestStorageMV(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Post("/storage/v1/object/move"). JSON(storage.MoveObjectRequest{ @@ -80,10 +82,7 @@ func TestStorageMV(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Post("/storage/v1/object/move"). JSON(storage.MoveObjectRequest{ diff --git a/internal/storage/rm/rm_test.go b/internal/storage/rm/rm_test.go index 46d204cf0..cc02418cf 100644 --- a/internal/storage/rm/rm_test.go +++ b/internal/storage/rm/rm_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/testing/apitest" @@ -44,6 +45,10 @@ func TestStorageRM(t *testing.T) { // Setup valid access token token := apitest.RandomAccessToken(t) t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + apiKeys := []api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }} t.Run("throws error on invalid url", func(t *testing.T) { // Setup in-memory fs @@ -81,10 +86,7 @@ func TestStorageRM(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Delete("/storage/v1/object/private"). JSON(storage.DeleteObjectsRequest{Prefixes: []string{ @@ -120,10 +122,7 @@ func TestStorageRM(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) // Delete /test/ bucket gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Post("/storage/v1/object/list/test"). @@ -190,10 +189,7 @@ func TestStorageRM(t *testing.T) { gock.New(utils.DefaultApiHost). Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). Reply(http.StatusOK). - JSON([]api.ApiKeyResponse{{ - Name: "service_role", - ApiKey: "service-key", - }}) + JSON(apiKeys) gock.New("https://" + utils.GetSupabaseHost(flags.ProjectRef)). Delete("/storage/v1/object/private"). Reply(http.StatusServiceUnavailable) diff --git a/internal/utils/tenant/client.go b/internal/utils/tenant/client.go index ad0ef6aa7..c94696701 100644 --- a/internal/utils/tenant/client.go +++ b/internal/utils/tenant/client.go @@ -28,11 +28,15 @@ func (a ApiKey) IsEmpty() bool { func NewApiKey(resp []api.ApiKeyResponse) ApiKey { var result ApiKey for _, key := range resp { - if key.Name == "anon" { - result.Anon = key.ApiKey + value, err := key.ApiKey.Get() + if err != nil { + continue } - if key.Name == "service_role" { - result.ServiceRole = key.ApiKey + switch key.Name { + case "anon": + result.Anon = value + case "service_role": + result.ServiceRole = value } } return result diff --git a/internal/utils/tenant/client_test.go b/internal/utils/tenant/client_test.go index 6057f502f..183485fbe 100644 --- a/internal/utils/tenant/client_test.go +++ b/internal/utils/tenant/client_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" "github.com/stretchr/testify/assert" "github.com/supabase/cli/internal/testing/apitest" "github.com/supabase/cli/internal/utils" @@ -15,8 +16,8 @@ import ( func TestApiKey(t *testing.T) { t.Run("creates api key from response", func(t *testing.T) { resp := []api.ApiKeyResponse{ - {Name: "anon", ApiKey: "anon-key"}, - {Name: "service_role", ApiKey: "service-key"}, + {Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}, + {Name: "service_role", ApiKey: nullable.NewNullableWithValue("service-key")}, } keys := NewApiKey(resp) @@ -27,7 +28,9 @@ func TestApiKey(t *testing.T) { }) t.Run("handles empty response", func(t *testing.T) { - resp := []api.ApiKeyResponse{} + resp := []api.ApiKeyResponse{ + {Name: "service_role", ApiKey: nullable.NewNullNullable[string]()}, + } keys := NewApiKey(resp) @@ -38,7 +41,7 @@ func TestApiKey(t *testing.T) { t.Run("handles partial response", func(t *testing.T) { resp := []api.ApiKeyResponse{ - {Name: "anon", ApiKey: "anon-key"}, + {Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}, } keys := NewApiKey(resp) @@ -60,8 +63,8 @@ func TestGetApiKeys(t *testing.T) { Get("/v1/projects/" + projectRef + "/api-keys"). Reply(http.StatusOK). JSON([]api.ApiKeyResponse{ - {Name: "anon", ApiKey: "anon-key"}, - {Name: "service_role", ApiKey: "service-key"}, + {Name: "anon", ApiKey: nullable.NewNullableWithValue("anon-key")}, + {Name: "service_role", ApiKey: nullable.NewNullableWithValue("service-key")}, }) keys, err := GetApiKeys(context.Background(), projectRef) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index cd96838f1..25fa2ccf0 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -1041,7 +1041,7 @@ type AnalyticsResponse_Error struct { // ApiKeyResponse defines model for ApiKeyResponse. type ApiKeyResponse struct { - ApiKey string `json:"api_key"` + ApiKey nullable.Nullable[string] `json:"api_key,omitempty"` Description nullable.Nullable[string] `json:"description,omitempty"` Hash nullable.Nullable[string] `json:"hash,omitempty"` Id nullable.Nullable[string] `json:"id,omitempty"` From 6fe4fad1415b985af008cee21e39e026ec7d4518 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 05:01:58 +0000 Subject: [PATCH 34/40] chore(deps): bump go.opentelemetry.io/otel from 1.36.0 to 1.37.0 (#3776) * chore(deps): bump go.opentelemetry.io/otel from 1.36.0 to 1.37.0 Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.36.0 to 1.37.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.36.0...v1.37.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-version: 1.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * chore: update pkg deps --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Qiao Han --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- pkg/go.mod | 2 +- pkg/go.sum | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index f1b587cc3..4be814728 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/tidwall/jsonc v0.3.2 github.com/withfig/autocomplete-tools/packages/cobra v1.2.0 github.com/zalando/go-keyring v0.2.6 - go.opentelemetry.io/otel v1.36.0 + go.opentelemetry.io/otel v1.37.0 golang.org/x/mod v0.25.0 golang.org/x/oauth2 v0.30.0 golang.org/x/term v0.32.0 @@ -135,7 +135,7 @@ require ( github.com/go-critic/go-critic v0.13.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.6.2 // indirect - github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.1 // indirect @@ -321,10 +321,10 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect - go.opentelemetry.io/otel/metric v1.36.0 // indirect + go.opentelemetry.io/otel/metric v1.37.0 // indirect go.opentelemetry.io/otel/sdk v1.35.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect - go.opentelemetry.io/otel/trace v1.36.0 // indirect + go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.5.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect diff --git a/go.sum b/go.sum index 189341d3d..9995fde04 100644 --- a/go.sum +++ b/go.sum @@ -324,8 +324,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= @@ -1046,8 +1046,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I= -go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg= -go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= @@ -1056,14 +1056,14 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0u go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4= -go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE= -go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= -go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w= -go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/pkg/go.mod b/pkg/go.mod index f1a9f408d..e722b673a 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -9,7 +9,7 @@ require ( github.com/docker/go-units v0.5.0 github.com/ecies/go/v2 v2.0.11 github.com/go-errors/errors v1.5.1 - github.com/go-viper/mapstructure/v2 v2.2.1 + github.com/go-viper/mapstructure/v2 v2.3.0 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/h2non/gock v1.2.0 github.com/jackc/pgconn v1.14.3 diff --git a/pkg/go.sum b/pkg/go.sum index 344d50b33..6086ffd66 100644 --- a/pkg/go.sum +++ b/pkg/go.sum @@ -36,8 +36,8 @@ github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= -github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk= +github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= From 09d2f1b52fd9a1a56784946bea82501fead4f8b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 05:08:19 +0000 Subject: [PATCH 35/40] chore(deps): bump supabase/realtime from v2.37.9 to v2.37.11 in /pkg/config/templates (#3778) chore(deps): bump supabase/realtime in /pkg/config/templates Bumps supabase/realtime from v2.37.9 to v2.37.11. --- updated-dependencies: - dependency-name: supabase/realtime dependency-version: v2.37.11 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index b7d491095..5caa9b16d 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -11,7 +11,7 @@ FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.5.5 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue -FROM supabase/realtime:v2.37.9 AS realtime +FROM supabase/realtime:v2.38.0 AS realtime FROM supabase/storage-api:v1.24.7 AS storage FROM supabase/logflare:1.14.2 AS logflare # Append to JobImages when adding new dependencies below From 1f889d8364c0b1a55ae437db23a9c02cebf04ea4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 05:14:35 +0000 Subject: [PATCH 36/40] chore(deps): bump supabase/postgres from 17.4.1.47 to 17.4.1.048 in /pkg/config/templates (#3777) chore(deps): bump supabase/postgres in /pkg/config/templates Bumps supabase/postgres from 17.4.1.47 to 17.4.1.048. --- updated-dependencies: - dependency-name: supabase/postgres dependency-version: 17.4.1.048 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 5caa9b16d..3b51a8ad2 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -1,5 +1,5 @@ # Exposed for updates by .github/dependabot.yml -FROM supabase/postgres:17.4.1.47 AS pg +FROM supabase/postgres:17.4.1.048 AS pg # Append to ServiceImages when adding new dependencies below FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit From f321e1ebeed2e391f6832ef70501be83875a1007 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 05:20:46 +0000 Subject: [PATCH 37/40] chore(deps): bump supabase/supavisor from 2.5.5 to 2.5.6 in /pkg/config/templates (#3784) chore(deps): bump supabase/supavisor in /pkg/config/templates Bumps supabase/supavisor from 2.5.5 to 2.5.6. --- updated-dependencies: - dependency-name: supabase/supavisor dependency-version: 2.5.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 3b51a8ad2..1ab8520f4 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -9,7 +9,7 @@ FROM supabase/studio:2025.06.23-sha-17632f7 AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector -FROM supabase/supavisor:2.5.5 AS supavisor +FROM supabase/supavisor:2.5.6 AS supavisor FROM supabase/gotrue:v2.176.1 AS gotrue FROM supabase/realtime:v2.38.0 AS realtime FROM supabase/storage-api:v1.24.7 AS storage From b8838999ee8e2902660d05cee6aa2cd67191a890 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 05:25:57 +0000 Subject: [PATCH 38/40] chore(deps): bump supabase/studio from 2025.06.23-sha-17632f7 to 2025.06.30-sha-6f5982d in /pkg/config/templates (#3785) chore(deps): bump supabase/studio in /pkg/config/templates Bumps supabase/studio from 2025.06.23-sha-17632f7 to 2025.06.30-sha-6f5982d. --- updated-dependencies: - dependency-name: supabase/studio dependency-version: 2025.06.30-sha-6f5982d dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 1ab8520f4..af7cd18df 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -5,7 +5,7 @@ FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit FROM postgrest/postgrest:v12.2.12 AS postgrest FROM supabase/postgres-meta:v0.89.3 AS pgmeta -FROM supabase/studio:2025.06.23-sha-17632f7 AS studio +FROM supabase/studio:2025.06.30-sha-6f5982d AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy FROM supabase/edge-runtime:v1.67.4 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector From 938ff4665bbb5e0b43f1da1fcf36a0e586ad01a0 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Mon, 30 Jun 2025 18:02:26 +0800 Subject: [PATCH 39/40] fix: handle windows path separator when globbing (#3788) --- pkg/config/config.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 9f9e05ee9..38db3d50f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -114,9 +114,10 @@ func (g Glob) Files(fsys fs.FS) ([]string, error) { sort.Strings(matches) // Remove duplicates for _, item := range matches { - if _, exists := set[item]; !exists { - set[item] = struct{}{} - result = append(result, item) + fp := filepath.ToSlash(item) + if _, exists := set[fp]; !exists { + set[fp] = struct{}{} + result = append(result, fp) } } } From d3760882ba2f6877fb56fd1ee4c1aa82ed9c0bf3 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 1 Jul 2025 06:44:13 +0200 Subject: [PATCH 40/40] chore: sync API types from infrastructure (#3789) Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> --- pkg/api/types.gen.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 25fa2ccf0..e96f13242 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -1390,6 +1390,7 @@ type CreateBranchBody struct { BranchName string `json:"branch_name"` DesiredInstanceSize *CreateBranchBodyDesiredInstanceSize `json:"desired_instance_size,omitempty"` GitBranch *string `json:"git_branch,omitempty"` + IsDefault *bool `json:"is_default,omitempty"` Persistent *bool `json:"persistent,omitempty"` // PostgresEngine Postgres engine version. If not provided, the latest version will be used.