Skip to content

Commit 3f27f3a

Browse files
authored
V3 Upgrade App Configuration API (#2981)
1 parent cf9645a commit 3f27f3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1611
-435
lines changed

api/client/client.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,32 @@ type Client interface {
1616
ConfigureLinuxInstallation(config types.LinuxInstallationConfig) (types.Status, error)
1717
SetupLinuxInfra(ignoreHostPreflights bool) (types.Infra, error)
1818
GetLinuxInfraStatus() (types.Infra, error)
19-
GetLinuxAppConfigValues() (types.AppConfigValues, error)
20-
PatchLinuxAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
21-
TemplateLinuxAppConfig(values types.AppConfigValues) (types.AppConfig, error)
22-
RunLinuxAppPreflights() (types.InstallAppPreflightsStatusResponse, error)
23-
GetLinuxAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error)
19+
GetLinuxInstallAppConfigValues() (types.AppConfigValues, error)
20+
PatchLinuxInstallAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
21+
TemplateLinuxInstallAppConfig(values types.AppConfigValues) (types.AppConfig, error)
22+
RunLinuxInstallAppPreflights() (types.InstallAppPreflightsStatusResponse, error)
23+
GetLinuxInstallAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error)
2424
InstallLinuxApp() (types.AppInstall, error)
2525
GetLinuxAppInstallStatus() (types.AppInstall, error)
26+
GetLinuxUpgradeAppConfigValues() (types.AppConfigValues, error)
27+
PatchLinuxUpgradeAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
28+
TemplateLinuxUpgradeAppConfig(values types.AppConfigValues) (types.AppConfig, error)
2629

2730
GetKubernetesInstallationConfig() (types.KubernetesInstallationConfigResponse, error)
2831
ConfigureKubernetesInstallation(config types.KubernetesInstallationConfig) (types.Status, error)
2932
GetKubernetesInstallationStatus() (types.Status, error)
3033
SetupKubernetesInfra() (types.Infra, error)
3134
GetKubernetesInfraStatus() (types.Infra, error)
32-
GetKubernetesAppConfigValues() (types.AppConfigValues, error)
33-
PatchKubernetesAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
34-
TemplateKubernetesAppConfig(values types.AppConfigValues) (types.AppConfig, error)
35-
RunKubernetesAppPreflights() (types.InstallAppPreflightsStatusResponse, error)
36-
GetKubernetesAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error)
35+
GetKubernetesInstallAppConfigValues() (types.AppConfigValues, error)
36+
PatchKubernetesInstallAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
37+
TemplateKubernetesInstallAppConfig(values types.AppConfigValues) (types.AppConfig, error)
38+
RunKubernetesInstallAppPreflights() (types.InstallAppPreflightsStatusResponse, error)
39+
GetKubernetesInstallAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error)
3740
InstallKubernetesApp() (types.AppInstall, error)
3841
GetKubernetesAppInstallStatus() (types.AppInstall, error)
42+
GetKubernetesUpgradeAppConfigValues() (types.AppConfigValues, error)
43+
PatchKubernetesUpgradeAppConfigValues(types.AppConfigValues) (types.AppConfigValues, error)
44+
TemplateKubernetesUpgradeAppConfig(values types.AppConfigValues) (types.AppConfig, error)
3945
}
4046

4147
type client struct {

api/client/client_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ func TestLinuxGetAppConfigValues(t *testing.T) {
614614

615615
// Test successful get
616616
c := New(server.URL, WithToken("test-token"))
617-
values, err := c.GetLinuxAppConfigValues()
617+
values, err := c.GetLinuxInstallAppConfigValues()
618618
assert.NoError(t, err)
619619
assert.Equal(t, expectedValues, values)
620620

@@ -635,7 +635,7 @@ func TestLinuxGetAppConfigValues(t *testing.T) {
635635
defer authServer.Close()
636636

637637
c = New(authServer.URL)
638-
values, err = c.GetLinuxAppConfigValues()
638+
values, err = c.GetLinuxInstallAppConfigValues()
639639
assert.Error(t, err)
640640
assert.Nil(t, values)
641641

@@ -655,7 +655,7 @@ func TestLinuxGetAppConfigValues(t *testing.T) {
655655
defer errorServer.Close()
656656

657657
c = New(errorServer.URL, WithToken("test-token"))
658-
values, err = c.GetLinuxAppConfigValues()
658+
values, err = c.GetLinuxInstallAppConfigValues()
659659
assert.Error(t, err)
660660
assert.Nil(t, values)
661661

@@ -690,7 +690,7 @@ func TestKubernetesGetAppConfigValues(t *testing.T) {
690690

691691
// Test successful get
692692
c := New(server.URL, WithToken("test-token"))
693-
values, err := c.GetKubernetesAppConfigValues()
693+
values, err := c.GetKubernetesInstallAppConfigValues()
694694
assert.NoError(t, err)
695695
assert.Equal(t, expectedValues, values)
696696

@@ -711,7 +711,7 @@ func TestKubernetesGetAppConfigValues(t *testing.T) {
711711
defer authServer.Close()
712712

713713
c = New(authServer.URL)
714-
values, err = c.GetKubernetesAppConfigValues()
714+
values, err = c.GetKubernetesInstallAppConfigValues()
715715
assert.Error(t, err)
716716
assert.Nil(t, values)
717717

@@ -731,7 +731,7 @@ func TestKubernetesGetAppConfigValues(t *testing.T) {
731731
defer errorServer.Close()
732732

733733
c = New(errorServer.URL, WithToken("test-token"))
734-
values, err = c.GetKubernetesAppConfigValues()
734+
values, err = c.GetKubernetesInstallAppConfigValues()
735735
assert.Error(t, err)
736736
assert.Nil(t, values)
737737

@@ -779,7 +779,7 @@ func TestLinuxPatchAppConfigValues(t *testing.T) {
779779
"test-item": types.AppConfigValue{Value: "new-value"},
780780
"required-item": types.AppConfigValue{Value: "required-value"},
781781
}
782-
config, err := c.PatchLinuxAppConfigValues(configValues)
782+
config, err := c.PatchLinuxInstallAppConfigValues(configValues)
783783
require.NoError(t, err)
784784
assert.Equal(t, expectedValues, config)
785785

@@ -794,7 +794,7 @@ func TestLinuxPatchAppConfigValues(t *testing.T) {
794794
defer errorServer.Close()
795795

796796
c = New(errorServer.URL, WithToken("test-token"))
797-
configValues, err = c.PatchLinuxAppConfigValues(configValues)
797+
configValues, err = c.PatchLinuxInstallAppConfigValues(configValues)
798798
assert.Error(t, err)
799799
assert.Equal(t, types.AppConfigValues{}, configValues)
800800

@@ -842,7 +842,7 @@ func TestKubernetesPatchAppConfigValues(t *testing.T) {
842842
"test-item": types.AppConfigValue{Value: "new-value"},
843843
"required-item": types.AppConfigValue{Value: "required-value"},
844844
}
845-
configValuesResponse, err := c.PatchKubernetesAppConfigValues(configValues)
845+
configValuesResponse, err := c.PatchKubernetesInstallAppConfigValues(configValues)
846846
assert.NoError(t, err)
847847
assert.Equal(t, expectedValues, configValuesResponse)
848848

@@ -857,7 +857,7 @@ func TestKubernetesPatchAppConfigValues(t *testing.T) {
857857
defer errorServer.Close()
858858

859859
c = New(errorServer.URL, WithToken("test-token"))
860-
configValuesResponse, err = c.PatchKubernetesAppConfigValues(configValues)
860+
configValuesResponse, err = c.PatchKubernetesInstallAppConfigValues(configValues)
861861
assert.Error(t, err)
862862
assert.Equal(t, types.AppConfigValues{}, configValuesResponse)
863863

@@ -907,7 +907,7 @@ func TestLinuxTemplateAppConfig(t *testing.T) {
907907
"db_host": types.AppConfigValue{Value: "localhost"},
908908
}
909909

910-
config, err := c.TemplateLinuxAppConfig(values)
910+
config, err := c.TemplateLinuxInstallAppConfig(values)
911911
require.NoError(t, err)
912912
assert.Equal(t, "database", config.Groups[0].Name)
913913
assert.Equal(t, "DATABASE CONFIGURATION", config.Groups[0].Title)
@@ -955,7 +955,7 @@ func TestKubernetesTemplateAppConfig(t *testing.T) {
955955
"app_name": types.AppConfigValue{Value: "myapp"},
956956
}
957957

958-
config, err := c.TemplateKubernetesAppConfig(values)
958+
config, err := c.TemplateKubernetesInstallAppConfig(values)
959959
require.NoError(t, err)
960960
assert.Equal(t, "application", config.Groups[0].Name)
961961
assert.Equal(t, "Application Settings", config.Groups[0].Title)
@@ -994,7 +994,7 @@ func TestRunLinuxAppPreflights(t *testing.T) {
994994

995995
// Test successful run
996996
c := New(server.URL, WithToken("test-token"))
997-
status, err := c.RunLinuxAppPreflights()
997+
status, err := c.RunLinuxInstallAppPreflights()
998998
assert.NoError(t, err)
999999
assert.Equal(t, types.StateRunning, status.Status.State)
10001000
assert.Equal(t, "App preflights running", status.Status.Description)
@@ -1013,7 +1013,7 @@ func TestRunLinuxAppPreflights(t *testing.T) {
10131013
defer errorServer.Close()
10141014

10151015
c = New(errorServer.URL, WithToken("test-token"))
1016-
status, err = c.RunLinuxAppPreflights()
1016+
status, err = c.RunLinuxInstallAppPreflights()
10171017
assert.Error(t, err)
10181018
assert.Equal(t, types.InstallAppPreflightsStatusResponse{}, status)
10191019

@@ -1060,7 +1060,7 @@ func TestGetLinuxAppPreflightsStatus(t *testing.T) {
10601060

10611061
// Test successful get
10621062
c := New(server.URL, WithToken("test-token"))
1063-
status, err := c.GetLinuxAppPreflightsStatus()
1063+
status, err := c.GetLinuxInstallAppPreflightsStatus()
10641064
assert.NoError(t, err)
10651065
assert.Equal(t, types.StateSucceeded, status.Status.State)
10661066
assert.Equal(t, "App preflights succeeded", status.Status.Description)
@@ -1081,7 +1081,7 @@ func TestGetLinuxAppPreflightsStatus(t *testing.T) {
10811081
defer errorServer.Close()
10821082

10831083
c = New(errorServer.URL, WithToken("test-token"))
1084-
status, err = c.GetLinuxAppPreflightsStatus()
1084+
status, err = c.GetLinuxInstallAppPreflightsStatus()
10851085
assert.Error(t, err)
10861086
assert.Equal(t, types.InstallAppPreflightsStatusResponse{}, status)
10871087

@@ -1122,7 +1122,7 @@ func TestRunKubernetesAppPreflights(t *testing.T) {
11221122

11231123
// Test successful run
11241124
c := New(server.URL, WithToken("test-token"))
1125-
status, err := c.RunKubernetesAppPreflights()
1125+
status, err := c.RunKubernetesInstallAppPreflights()
11261126
assert.NoError(t, err)
11271127
assert.Equal(t, types.StateRunning, status.Status.State)
11281128
assert.Equal(t, "App preflights running on Kubernetes", status.Status.Description)
@@ -1141,7 +1141,7 @@ func TestRunKubernetesAppPreflights(t *testing.T) {
11411141
defer errorServer.Close()
11421142

11431143
c = New(errorServer.URL, WithToken("test-token"))
1144-
status, err = c.RunKubernetesAppPreflights()
1144+
status, err = c.RunKubernetesInstallAppPreflights()
11451145
assert.Error(t, err)
11461146
assert.Equal(t, types.InstallAppPreflightsStatusResponse{}, status)
11471147

@@ -1188,7 +1188,7 @@ func TestGetKubernetesAppPreflightsStatus(t *testing.T) {
11881188

11891189
// Test successful get
11901190
c := New(server.URL, WithToken("test-token"))
1191-
status, err := c.GetKubernetesAppPreflightsStatus()
1191+
status, err := c.GetKubernetesInstallAppPreflightsStatus()
11921192
assert.NoError(t, err)
11931193
assert.Equal(t, types.StateFailed, status.Status.State)
11941194
assert.Equal(t, "App preflights failed on Kubernetes", status.Status.Description)
@@ -1209,7 +1209,7 @@ func TestGetKubernetesAppPreflightsStatus(t *testing.T) {
12091209
defer errorServer.Close()
12101210

12111211
c = New(errorServer.URL, WithToken("test-token"))
1212-
status, err = c.GetKubernetesAppPreflightsStatus()
1212+
status, err = c.GetKubernetesInstallAppPreflightsStatus()
12131213
assert.Error(t, err)
12141214
assert.Equal(t, types.InstallAppPreflightsStatusResponse{}, status)
12151215

api/client/install.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func (c *client) GetKubernetesInfraStatus() (types.Infra, error) {
295295
return infra, nil
296296
}
297297

298-
func (c *client) GetLinuxAppConfigValues() (types.AppConfigValues, error) {
298+
func (c *client) GetLinuxInstallAppConfigValues() (types.AppConfigValues, error) {
299299
req, err := http.NewRequest("GET", c.apiURL+"/api/linux/install/app/config/values", nil)
300300
if err != nil {
301301
return nil, err
@@ -322,7 +322,7 @@ func (c *client) GetLinuxAppConfigValues() (types.AppConfigValues, error) {
322322
return response.Values, nil
323323
}
324324

325-
func (c *client) PatchLinuxAppConfigValues(values types.AppConfigValues) (types.AppConfigValues, error) {
325+
func (c *client) PatchLinuxInstallAppConfigValues(values types.AppConfigValues) (types.AppConfigValues, error) {
326326
req := types.PatchAppConfigValuesRequest{
327327
Values: values,
328328
}
@@ -357,7 +357,7 @@ func (c *client) PatchLinuxAppConfigValues(values types.AppConfigValues) (types.
357357
return config.Values, nil
358358
}
359359

360-
func (c *client) GetKubernetesAppConfigValues() (types.AppConfigValues, error) {
360+
func (c *client) GetKubernetesInstallAppConfigValues() (types.AppConfigValues, error) {
361361
req, err := http.NewRequest("GET", c.apiURL+"/api/kubernetes/install/app/config/values", nil)
362362
if err != nil {
363363
return nil, err
@@ -384,7 +384,7 @@ func (c *client) GetKubernetesAppConfigValues() (types.AppConfigValues, error) {
384384
return response.Values, nil
385385
}
386386

387-
func (c *client) PatchKubernetesAppConfigValues(values types.AppConfigValues) (types.AppConfigValues, error) {
387+
func (c *client) PatchKubernetesInstallAppConfigValues(values types.AppConfigValues) (types.AppConfigValues, error) {
388388
request := types.PatchAppConfigValuesRequest{
389389
Values: values,
390390
}
@@ -420,7 +420,7 @@ func (c *client) PatchKubernetesAppConfigValues(values types.AppConfigValues) (t
420420
return config.Values, nil
421421
}
422422

423-
func (c *client) TemplateLinuxAppConfig(values types.AppConfigValues) (types.AppConfig, error) {
423+
func (c *client) TemplateLinuxInstallAppConfig(values types.AppConfigValues) (types.AppConfig, error) {
424424
request := types.TemplateAppConfigRequest{
425425
Values: values,
426426
}
@@ -456,7 +456,7 @@ func (c *client) TemplateLinuxAppConfig(values types.AppConfigValues) (types.App
456456
return config, nil
457457
}
458458

459-
func (c *client) TemplateKubernetesAppConfig(values types.AppConfigValues) (types.AppConfig, error) {
459+
func (c *client) TemplateKubernetesInstallAppConfig(values types.AppConfigValues) (types.AppConfig, error) {
460460
request := types.TemplateAppConfigRequest{
461461
Values: values,
462462
}
@@ -492,7 +492,7 @@ func (c *client) TemplateKubernetesAppConfig(values types.AppConfigValues) (type
492492
return config, nil
493493
}
494494

495-
func (c *client) RunLinuxAppPreflights() (types.InstallAppPreflightsStatusResponse, error) {
495+
func (c *client) RunLinuxInstallAppPreflights() (types.InstallAppPreflightsStatusResponse, error) {
496496
req, err := http.NewRequest("POST", c.apiURL+"/api/linux/install/app-preflights/run", nil)
497497
if err != nil {
498498
return types.InstallAppPreflightsStatusResponse{}, err
@@ -519,7 +519,7 @@ func (c *client) RunLinuxAppPreflights() (types.InstallAppPreflightsStatusRespon
519519
return status, nil
520520
}
521521

522-
func (c *client) GetLinuxAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error) {
522+
func (c *client) GetLinuxInstallAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error) {
523523
req, err := http.NewRequest("GET", c.apiURL+"/api/linux/install/app-preflights/status", nil)
524524
if err != nil {
525525
return types.InstallAppPreflightsStatusResponse{}, err
@@ -546,7 +546,7 @@ func (c *client) GetLinuxAppPreflightsStatus() (types.InstallAppPreflightsStatus
546546
return status, nil
547547
}
548548

549-
func (c *client) RunKubernetesAppPreflights() (types.InstallAppPreflightsStatusResponse, error) {
549+
func (c *client) RunKubernetesInstallAppPreflights() (types.InstallAppPreflightsStatusResponse, error) {
550550
req, err := http.NewRequest("POST", c.apiURL+"/api/kubernetes/install/app-preflights/run", nil)
551551
if err != nil {
552552
return types.InstallAppPreflightsStatusResponse{}, err
@@ -573,7 +573,7 @@ func (c *client) RunKubernetesAppPreflights() (types.InstallAppPreflightsStatusR
573573
return status, nil
574574
}
575575

576-
func (c *client) GetKubernetesAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error) {
576+
func (c *client) GetKubernetesInstallAppPreflightsStatus() (types.InstallAppPreflightsStatusResponse, error) {
577577
req, err := http.NewRequest("GET", c.apiURL+"/api/kubernetes/install/app-preflights/status", nil)
578578
if err != nil {
579579
return types.InstallAppPreflightsStatusResponse{}, err

0 commit comments

Comments
 (0)