diff --git a/internal/namespaces/redis/v1/custom.go b/internal/namespaces/redis/v1/custom.go index e3b160d90f..0b15d9d13b 100644 --- a/internal/namespaces/redis/v1/custom.go +++ b/internal/namespaces/redis/v1/custom.go @@ -10,7 +10,7 @@ func GetCommands() *core.Commands { cmds := GetGeneratedCommands() human.RegisterMarshalerFunc(redis.Cluster{}, redisClusterGetMarshalerFunc) - human.RegisterMarshalerFunc(redis.Endpoint{}, redisEndpointsClusterGetMarshalerFunc) + human.RegisterMarshalerFunc(redis.Cluster{}.Endpoints, redisEndpointsClusterGetMarshalerFunc) cmds.Merge(core.NewCommands(clusterWaitCommand())) cmds.MustFind("redis", "cluster", "create").Override(clusterCreateBuilder) diff --git a/internal/namespaces/redis/v1/custom_cluster.go b/internal/namespaces/redis/v1/custom_cluster.go index 3bbccdeba1..6abea6d8e5 100644 --- a/internal/namespaces/redis/v1/custom_cluster.go +++ b/internal/namespaces/redis/v1/custom_cluster.go @@ -3,7 +3,6 @@ package redis import ( "context" "errors" - "log" "net/http" "reflect" "time" @@ -160,8 +159,11 @@ func ACLAddListBuilder(c *core.Command) *core.Command { } func redisEndpointsClusterGetMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { - type tmp redis.Endpoint - endpoint := tmp(i.(redis.Endpoint)) + if opt == nil { + return "", nil + } + type tmp []*redis.Endpoint + endpoint := tmp(i.([]*redis.Endpoint)) opt.Fields = []*human.MarshalFieldOpt{ { FieldName: "ID", @@ -176,7 +178,7 @@ func redisEndpointsClusterGetMarshalerFunc(i interface{}, opt *human.MarshalOpt) Label: "IPs", }, } - str, err := human.Marshal(redisEndpointsClusterResponse, opt) + str, err := human.Marshal(endpoint, opt) if err != nil { return "", err } diff --git a/internal/namespaces/redis/v1/testdata/test-endpoints-single-public-endpoint.golden b/internal/namespaces/redis/v1/testdata/test-endpoints-single-public-endpoint.golden index 7e869a2353..87bf6055d3 100644 --- a/internal/namespaces/redis/v1/testdata/test-endpoints-single-public-endpoint.golden +++ b/internal/namespaces/redis/v1/testdata/test-endpoints-single-public-endpoint.golden @@ -14,8 +14,8 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [163.172.151.197] 9212bfab-dead-42d6-80e2-5eaa4f8be5a6 +ID Port IPs +9212bfab-dead-42d6-80e2-5eaa4f8be5a6 6379 [163.172.151.197] ACLRules: ID IP CIDR DESCRIPTION diff --git a/internal/namespaces/redis/v1/testdata/test-endpoints-single-static-private-endpoint.golden b/internal/namespaces/redis/v1/testdata/test-endpoints-single-static-private-endpoint.golden index 9fb036b9dd..55ff41bf60 100644 --- a/internal/namespaces/redis/v1/testdata/test-endpoints-single-static-private-endpoint.golden +++ b/internal/namespaces/redis/v1/testdata/test-endpoints-single-static-private-endpoint.golden @@ -14,8 +14,8 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [172.16.4.1] a56f3126-4e97-46cf-89c6-f179359f96e9 +ID Port IPs +a56f3126-4e97-46cf-89c6-f179359f96e9 6379 [172.16.4.1] ACLRules: ID IP CIDR DESCRIPTION diff --git a/internal/namespaces/redis/v1/testdata/test-endpoints-two-static-private-endpoints.golden b/internal/namespaces/redis/v1/testdata/test-endpoints-two-static-private-endpoints.golden index b7d7e18aad..9acaab65d5 100644 --- a/internal/namespaces/redis/v1/testdata/test-endpoints-two-static-private-endpoints.golden +++ b/internal/namespaces/redis/v1/testdata/test-endpoints-two-static-private-endpoints.golden @@ -14,9 +14,9 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [172.16.4.1] 13199053-663b-40e8-bf06-56161d32271b -6379 [10.16.4.1] 1ede35c6-c45a-4a24-b34b-0486a33c01f8 +ID Port IPs +13199053-663b-40e8-bf06-56161d32271b 6379 [172.16.4.1] +1ede35c6-c45a-4a24-b34b-0486a33c01f8 6379 [10.16.4.1] ACLRules: ID IP CIDR DESCRIPTION diff --git a/internal/namespaces/redis/v1/testdata/test-ipam-config-both-ipam-and-static-private-endpoints.golden b/internal/namespaces/redis/v1/testdata/test-ipam-config-both-ipam-and-static-private-endpoints.golden index d71fcd2559..fab10be026 100644 --- a/internal/namespaces/redis/v1/testdata/test-ipam-config-both-ipam-and-static-private-endpoints.golden +++ b/internal/namespaces/redis/v1/testdata/test-ipam-config-both-ipam-and-static-private-endpoints.golden @@ -14,9 +14,9 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [10.16.4.1] 0b9e8061-e10c-4fb8-815d-1dfd94bf2745 -6379 [172.16.228.2] c0be2bbb-d4d6-4043-9aaa-f8a96e1685dc +ID Port IPs +0b9e8061-e10c-4fb8-815d-1dfd94bf2745 6379 [10.16.4.1] +c0be2bbb-d4d6-4043-9aaa-f8a96e1685dc 6379 [172.16.228.2] ACLRules: ID IP CIDR DESCRIPTION diff --git a/internal/namespaces/redis/v1/testdata/test-ipam-config-single-ipam-private-endpoint.golden b/internal/namespaces/redis/v1/testdata/test-ipam-config-single-ipam-private-endpoint.golden index 175987899e..213ce134f8 100644 --- a/internal/namespaces/redis/v1/testdata/test-ipam-config-single-ipam-private-endpoint.golden +++ b/internal/namespaces/redis/v1/testdata/test-ipam-config-single-ipam-private-endpoint.golden @@ -14,8 +14,8 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [172.16.232.2] 2aaf6524-7ce6-4f6e-96aa-3f5cdc24ce04 +ID Port IPs +2aaf6524-7ce6-4f6e-96aa-3f5cdc24ce04 6379 [172.16.232.2] ACLRules: ID IP CIDR DESCRIPTION diff --git a/internal/namespaces/redis/v1/testdata/test-ipam-config-two-ipam-private-endpoints.golden b/internal/namespaces/redis/v1/testdata/test-ipam-config-two-ipam-private-endpoints.golden index f8e386bcde..0d54501cb9 100644 --- a/internal/namespaces/redis/v1/testdata/test-ipam-config-two-ipam-private-endpoints.golden +++ b/internal/namespaces/redis/v1/testdata/test-ipam-config-two-ipam-private-endpoints.golden @@ -14,9 +14,9 @@ Zone fr-par-1 UserName admin Endpoints: -PORT IPS ID -6379 [172.16.220.2] 003d16e6-7539-4058-9e59-b81b3fe8a4e6 -6379 [172.16.208.2] e6ac24ff-015a-4d2a-a29e-4b2eae03b259 +ID Port IPs +003d16e6-7539-4058-9e59-b81b3fe8a4e6 6379 [172.16.220.2] +e6ac24ff-015a-4d2a-a29e-4b2eae03b259 6379 [172.16.208.2] ACLRules: ID IP CIDR DESCRIPTION