Skip to content

Commit

Permalink
PMM-12913 merge external, haproxy & rds to management/service
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Feb 17, 2024
1 parent d1d6487 commit 9755375
Show file tree
Hide file tree
Showing 47 changed files with 1,313 additions and 1,990 deletions.
10 changes: 5 additions & 5 deletions admin/commands/management/add_external.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/percona/pmm/admin/agentlocal"
"github.com/percona/pmm/admin/commands"
"github.com/percona/pmm/api/management/v1/json/client"
external "github.com/percona/pmm/api/management/v1/json/client/external_service"
"github.com/percona/pmm/api/management/v1/json/client/service"
)

const (
Expand All @@ -42,7 +42,7 @@ Group : {{ .Service.Group }}
`)

type addExternalResult struct {
Service *external.AddExternalOKBodyService `json:"service"`
Service *service.AddExternalOKBodyService `json:"service"`
}

func (res *addExternalResult) Result() {}
Expand Down Expand Up @@ -118,8 +118,8 @@ func (cmd *AddExternalCommand) RunCmd() (commands.Result, error) {
}
}

params := &external.AddExternalParams{
Body: external.AddExternalBody{
params := &service.AddExternalParams{
Body: service.AddExternalBody{
RunsOnNodeID: cmd.RunsOnNodeID,
ServiceName: cmd.ServiceName,
Username: cmd.Username,
Expand All @@ -138,7 +138,7 @@ func (cmd *AddExternalCommand) RunCmd() (commands.Result, error) {
},
Context: commands.Ctx,
}
resp, err := client.Default.ExternalService.AddExternal(params)
resp, err := client.Default.Service.AddExternal(params)
if err != nil {
return nil, err
}
Expand Down
16 changes: 8 additions & 8 deletions admin/commands/management/add_external_serverless.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

"github.com/percona/pmm/admin/commands"
"github.com/percona/pmm/api/management/v1/json/client"
external "github.com/percona/pmm/api/management/v1/json/client/external_service"
"github.com/percona/pmm/api/management/v1/json/client/service"
)

var addExternalServerlessResultT = commands.ParseTemplate(`
Expand All @@ -37,7 +37,7 @@ Group : {{ .Service.Group }}
`)

type addExternalServerlessResult struct {
Service *external.AddExternalOKBodyService `json:"service"`
Service *service.AddExternalOKBodyService `json:"service"`
}

func (res *addExternalServerlessResult) Result() {}
Expand Down Expand Up @@ -123,10 +123,10 @@ func (cmd *AddExternalServerlessCommand) RunCmd() (commands.Result, error) {
}
}

params := &external.AddExternalParams{
Body: external.AddExternalBody{
AddNode: &external.AddExternalParamsBodyAddNode{
NodeType: pointer.ToString(external.AddExternalParamsBodyAddNodeNodeTypeNODETYPEREMOTENODE),
params := &service.AddExternalParams{
Body: service.AddExternalBody{
AddNode: &service.AddExternalParamsBodyAddNode{
NodeType: pointer.ToString(service.AddExternalParamsBodyAddNodeNodeTypeNODETYPEREMOTENODE),
NodeName: serviceName,
MachineID: cmd.MachineID,
Distro: cmd.Distro,
Expand All @@ -148,13 +148,13 @@ func (cmd *AddExternalServerlessCommand) RunCmd() (commands.Result, error) {
Cluster: cmd.Cluster,
ReplicationSet: cmd.ReplicationSet,
CustomLabels: customLabels,
MetricsMode: pointer.ToString(external.AddExternalBodyMetricsModeMETRICSMODEPULL),
MetricsMode: pointer.ToString(service.AddExternalBodyMetricsModeMETRICSMODEPULL),
Group: cmd.Group,
SkipConnectionCheck: cmd.SkipConnectionCheck,
},
Context: commands.Ctx,
}
resp, err := client.Default.ExternalService.AddExternal(params)
resp, err := client.Default.Service.AddExternal(params)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/management/add_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (

"github.com/stretchr/testify/assert"

external "github.com/percona/pmm/api/management/v1/json/client/external_service"
"github.com/percona/pmm/api/management/v1/json/client/service"
)

func TestAddExternal(t *testing.T) {
t.Run("Basic", func(t *testing.T) {
res := &addExternalResult{
Service: &external.AddExternalOKBodyService{
Service: &service.AddExternalOKBodyService{
ServiceID: "/service_id/1",
ServiceName: "myhost-redis",
Group: "redis",
Expand Down
10 changes: 5 additions & 5 deletions admin/commands/management/add_haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/percona/pmm/admin/commands"
"github.com/percona/pmm/admin/helpers"
"github.com/percona/pmm/api/management/v1/json/client"
ha_proxy "github.com/percona/pmm/api/management/v1/json/client/ha_proxy_service"
"github.com/percona/pmm/api/management/v1/json/client/service"
)

var addHAProxyResultT = commands.ParseTemplate(`
Expand All @@ -34,7 +34,7 @@ Service name: {{ .Service.ServiceName }}
`)

type addHAProxyResult struct {
Service *ha_proxy.AddHAProxyOKBodyService `json:"service"`
Service *service.AddHAProxyOKBodyService `json:"service"`
}

func (res *addHAProxyResult) Result() {}
Expand Down Expand Up @@ -103,8 +103,8 @@ func (cmd *AddHAProxyCommand) RunCmd() (commands.Result, error) {
}
}

params := &ha_proxy.AddHAProxyParams{
Body: ha_proxy.AddHAProxyBody{
params := &service.AddHAProxyParams{
Body: service.AddHAProxyBody{
ServiceName: cmd.ServiceName,
Username: cmd.Username,
Password: cmd.Password,
Expand All @@ -121,7 +121,7 @@ func (cmd *AddHAProxyCommand) RunCmd() (commands.Result, error) {
},
Context: commands.Ctx,
}
resp, err := client.Default.HAProxyService.AddHAProxy(params)
resp, err := client.Default.Service.AddHAProxy(params)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/management/add_haproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (

"github.com/stretchr/testify/assert"

ha_proxy "github.com/percona/pmm/api/management/v1/json/client/ha_proxy_service"
"github.com/percona/pmm/api/management/v1/json/client/service"
)

func TestAddHAProxy(t *testing.T) {
t.Run("Basic", func(t *testing.T) {
res := &addHAProxyResult{
Service: &ha_proxy.AddHAProxyOKBodyService{
Service: &service.AddHAProxyOKBodyService{
ServiceID: "/service_id/1",
ServiceName: "myhost-redis",
},
Expand Down
Loading

0 comments on commit 9755375

Please sign in to comment.