Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/planetscale/neki_admins.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func nekiAdminAPIPath(org, database, branch string) string {
}

func nekiAdminChangesAPIPath(org, database, branch string) string {
return path.Join(nekiAdminAPIPath(org, database, branch), "changes")
return path.Join(nekiAdminAPIPath(org, database, branch), "change-requests")
}

func nekiAdminChangeAPIPath(org, database, branch, change string) string {
Expand Down
6 changes: 3 additions & 3 deletions internal/planetscale/neki_admins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ func TestNekiAdminsService(t *testing.T) {
case r.Method == http.MethodGet && r.URL.Path == adminPath+"/parameters":
_, _ = w.Write([]byte(`[{"name":"recovery-poll-interval","display_name":"Recovery poll interval","namespace":"admin","advanced":false,"category":null,"description":"How often the admin runs recovery analysis and repairs.","parameter_type":"time","default_value":"10s","value":"20s","required":false,"created_at":"2026-08-04T12:00:00Z","updated_at":null,"restart":false,"url":"https://example.test/parameter"}]`))

case r.Method == http.MethodGet && r.URL.Path == adminPath+"/changes":
case r.Method == http.MethodGet && r.URL.Path == adminPath+"/change-requests":
c.Assert(r.URL.Query().Get("period"), qt.Equals, "24h")
c.Assert(r.URL.Query().Get("completed_at"), qt.Equals, "2026-08-04")
c.Assert(r.URL.Query().Get("page"), qt.Equals, "2")
c.Assert(r.URL.Query().Get("per_page"), qt.Equals, "25")
_, _ = w.Write([]byte(`{"data":[{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","admin_size":"NKA_1","admin_size_display_name":"NKA-1","previous_admin_size":"NKA_0","previous_admin_size_display_name":"NKA-0","parameters":{"admin":{"recovery-poll-interval":"20s"}},"previous_parameters":{"admin":{"recovery-poll-interval":"10s"}}}]}`))

case r.Method == http.MethodGet && r.URL.Path == adminPath+"/changes/change-1":
case r.Method == http.MethodGet && r.URL.Path == adminPath+"/change-requests/change-1":
_, _ = w.Write([]byte(`{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","admin_size":"NKA_1","admin_size_display_name":"NKA-1","previous_admin_size":"NKA_0","previous_admin_size_display_name":"NKA-0","parameters":{"admin":{"recovery-poll-interval":"20s"}},"previous_parameters":{"admin":{"recovery-poll-interval":"10s"}}}`))

case r.Method == http.MethodDelete && r.URL.Path == adminPath+"/changes/change-1":
case r.Method == http.MethodDelete && r.URL.Path == adminPath+"/change-requests/change-1":
w.WriteHeader(http.StatusNoContent)

case r.Method == http.MethodPost && r.URL.Path == adminPath:
Expand Down
2 changes: 1 addition & 1 deletion internal/planetscale/neki_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *nekiChangesService) Cancel(ctx context.Context, r *CancelNekiChangeRequ
}

func nekiChangesAPIPath(org, database, branch string) string {
return path.Join(databaseBranchAPIPath(org, database, branch), "neki-changes")
return path.Join(databaseBranchAPIPath(org, database, branch), "change-requests")
}

func nekiChangeAPIPath(org, database, branch, change string) string {
Expand Down
2 changes: 1 addition & 1 deletion internal/planetscale/neki_changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestNekiChangesService(t *testing.T) {
c := qt.New(t)
const basePath = "/v1/organizations/acme/databases/app/branches/main/neki-changes"
const basePath = "/v1/organizations/acme/databases/app/branches/main/change-requests"

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
Expand Down
2 changes: 1 addition & 1 deletion internal/planetscale/neki_routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func nekiRouterAPIPath(org, database, branch, router string) string {
}

func nekiRouterChangesAPIPath(org, database, branch, router string) string {
return path.Join(nekiRouterAPIPath(org, database, branch, router), "changes")
return path.Join(nekiRouterAPIPath(org, database, branch, router), "change-requests")
}

func nekiRouterChangeAPIPath(org, database, branch, router, change string) string {
Expand Down
6 changes: 3 additions & 3 deletions internal/planetscale/neki_routers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ func TestNekiRoutersService(t *testing.T) {
"url":"https://planetscale.com/docs"
}]`))

case r.Method == http.MethodGet && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/changes":
case r.Method == http.MethodGet && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/change-requests":
c.Assert(r.URL.Query().Get("period"), qt.Equals, "24h")
c.Assert(r.URL.Query().Get("completed_at"), qt.Equals, "2026-08-04")
c.Assert(r.URL.Query().Get("page"), qt.Equals, "2")
c.Assert(r.URL.Query().Get("per_page"), qt.Equals, "25")
_, _ = w.Write([]byte(`{"data":[{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","router_size":"NKR_10","previous_router_size":"NKR_5","replicas_per_cell":2,"previous_replicas_per_cell":1,"parameters":{"router":{"replication-lag-tolerable-max":"15m"}},"previous_parameters":{"router":{"replication-lag-tolerable-max":"10m"}}}]}`))

case r.Method == http.MethodGet && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/changes/change-1":
case r.Method == http.MethodGet && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/change-requests/change-1":
_, _ = w.Write([]byte(`{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","router_size":"NKR_10","previous_router_size":"NKR_5","replicas_per_cell":2,"previous_replicas_per_cell":1}`))

case r.Method == http.MethodDelete && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/changes/change-1":
case r.Method == http.MethodDelete && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics/change-requests/change-1":
w.WriteHeader(http.StatusNoContent)

case r.Method == http.MethodDelete && r.URL.Path == "/v1/organizations/acme/databases/app/branches/main/routers/analytics":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func nekiDefaultShardConfigurationProfileAPIPath(org, database, branch string) s
}

func nekiShardConfigurationProfileChangesAPIPath(org, database, branch, profile string) string {
return path.Join(nekiShardConfigurationProfileAPIPath(org, database, branch, profile), "changes")
return path.Join(nekiShardConfigurationProfileAPIPath(org, database, branch, profile), "change-requests")
}

func nekiShardConfigurationProfileChangeAPIPath(org, database, branch, profile, change string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ func TestNekiShardConfigurationProfilesService(t *testing.T) {
case r.Method == http.MethodGet && r.URL.Path == profilePath+"/extensions":
_, _ = w.Write([]byte(`[{"name":"pg_stat_statements","description":"Stats","enabled":true,"can_enable":true,"internal":false,"loader":"shared_preload_libraries","url":"https://example.test/extension","parameters":[]}]`))

case r.Method == http.MethodGet && r.URL.Path == profilePath+"/changes":
case r.Method == http.MethodGet && r.URL.Path == profilePath+"/change-requests":
c.Assert(r.URL.Query().Get("period"), qt.Equals, "24h")
c.Assert(r.URL.Query().Get("completed_at"), qt.Equals, "2026-08-04")
c.Assert(r.URL.Query().Get("page"), qt.Equals, "2")
c.Assert(r.URL.Query().Get("per_page"), qt.Equals, "25")
_, _ = w.Write([]byte(`{"data":[{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","name":"metal","previous_name":"default","cluster_size":"M1-10","cluster_display_name":"Metal 10","metal":true,"cluster_rank":1,"replicas":2,"read_only_replicas":3,"previous_read_only_replicas":1,"parameters":{},"previous_cluster_size":"PS-10","previous_cluster_display_name":"PS 10","previous_metal":false,"previous_cluster_rank":2,"previous_replicas":0,"previous_parameters":{}}]}`))

case r.Method == http.MethodGet && r.URL.Path == profilePath+"/changes/change-1":
case r.Method == http.MethodGet && r.URL.Path == profilePath+"/change-requests/change-1":
_, _ = w.Write([]byte(`{"id":"change-1","state":"pending","created_at":"2026-08-04T12:00:00Z","updated_at":"2026-08-04T12:00:00Z","name":"metal","cluster_size":"M1-10","replicas":2,"read_only_replicas":0,"previous_read_only_replicas":3,"parameters":{},"previous_parameters":{}}`))

case r.Method == http.MethodDelete && r.URL.Path == profilePath+"/changes/change-1":
case r.Method == http.MethodDelete && r.URL.Path == profilePath+"/change-requests/change-1":
w.WriteHeader(http.StatusNoContent)

default:
Expand Down
Loading