From 32acf011e4dbeafd6b51d2a1d5fdbf5546af6556 Mon Sep 17 00:00:00 2001 From: Steven Gagniere <108363707+sgagniere@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:53:30 -0800 Subject: [PATCH] Show user full name in `confluent iam rbac role-binding list` (#2611) --- internal/iam/command_rbac_role_binding_list.go | 1 + .../role-binding/list-user-clusteradmin-cloud.golden | 12 ++++++------ .../list-user-clusteradmin-json-cloud.golden | 8 ++++---- .../list-user-clusteradmin-yaml-cloud.golden | 8 ++++---- .../role-binding/list-user-envadmin-cloud.golden | 6 +++--- .../role-binding/list-user-orgadmin-cloud.golden | 2 +- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/internal/iam/command_rbac_role_binding_list.go b/internal/iam/command_rbac_role_binding_list.go index f458854c25..06e9c66827 100644 --- a/internal/iam/command_rbac_role_binding_list.go +++ b/internal/iam/command_rbac_role_binding_list.go @@ -500,6 +500,7 @@ func (c *roleBindingCommand) ccloudListRolePrincipals(cmd *cobra.Command, listRo row := &roleBindingListOut{Principal: principal} if user, ok := principalToUser[principal]; ok { row.Email = user.GetEmail() + row.Name = user.GetFullName() list.Add(row) } if name, ok := serviceAccountToNameMap[principal]; ok { diff --git a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-cloud.golden b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-cloud.golden index 6980b79385..45147b7637 100644 --- a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-cloud.golden +++ b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-cloud.golden @@ -1,6 +1,6 @@ - Principal | Name | Email ----------------+------+----------------------- - User:u-11aaa | | u-11aaa@confluent.io - User:u-22bbb | | u-22bbb@confluent.io - User:u-33ccc | | u-33ccc@confluent.io - User:u-44ddd | | mhe@confluent.io + Principal | Name | Email +---------------+----------+----------------------- + User:u-11aaa | 11 Aaa | u-11aaa@confluent.io + User:u-22bbb | 22 Bbb | u-22bbb@confluent.io + User:u-33ccc | 33 Ccc | u-33ccc@confluent.io + User:u-44ddd | Muwei He | mhe@confluent.io diff --git a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-json-cloud.golden b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-json-cloud.golden index 802b43e5a8..adccf0515b 100644 --- a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-json-cloud.golden +++ b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-json-cloud.golden @@ -1,22 +1,22 @@ [ { "principal": "User:u-11aaa", - "name": "", + "name": "11 Aaa", "email": "u-11aaa@confluent.io" }, { "principal": "User:u-22bbb", - "name": "", + "name": "22 Bbb", "email": "u-22bbb@confluent.io" }, { "principal": "User:u-33ccc", - "name": "", + "name": "33 Ccc", "email": "u-33ccc@confluent.io" }, { "principal": "User:u-44ddd", - "name": "", + "name": "Muwei He", "email": "mhe@confluent.io" } ] diff --git a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-yaml-cloud.golden b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-yaml-cloud.golden index 90fc6d4b77..1c30391097 100644 --- a/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-yaml-cloud.golden +++ b/test/fixtures/output/iam/rbac/role-binding/list-user-clusteradmin-yaml-cloud.golden @@ -1,12 +1,12 @@ - principal: User:u-11aaa - name: "" + name: 11 Aaa email: u-11aaa@confluent.io - principal: User:u-22bbb - name: "" + name: 22 Bbb email: u-22bbb@confluent.io - principal: User:u-33ccc - name: "" + name: 33 Ccc email: u-33ccc@confluent.io - principal: User:u-44ddd - name: "" + name: Muwei He email: mhe@confluent.io diff --git a/test/fixtures/output/iam/rbac/role-binding/list-user-envadmin-cloud.golden b/test/fixtures/output/iam/rbac/role-binding/list-user-envadmin-cloud.golden index 29cb350bff..65719a1dd2 100644 --- a/test/fixtures/output/iam/rbac/role-binding/list-user-envadmin-cloud.golden +++ b/test/fixtures/output/iam/rbac/role-binding/list-user-envadmin-cloud.golden @@ -1,3 +1,3 @@ - Principal | Name | Email ----------------+------+----------------------- - User:u-22bbb | | u-22bbb@confluent.io + Principal | Name | Email +---------------+--------+----------------------- + User:u-22bbb | 22 Bbb | u-22bbb@confluent.io diff --git a/test/fixtures/output/iam/rbac/role-binding/list-user-orgadmin-cloud.golden b/test/fixtures/output/iam/rbac/role-binding/list-user-orgadmin-cloud.golden index 4bca6795d7..e53d86ad33 100644 --- a/test/fixtures/output/iam/rbac/role-binding/list-user-orgadmin-cloud.golden +++ b/test/fixtures/output/iam/rbac/role-binding/list-user-orgadmin-cloud.golden @@ -3,4 +3,4 @@ User:group-abc | another-group-mapping | User:pool-12345 | identity-pool | User:sa-12345 | service-account | - User:u-11aaa | | u-11aaa@confluent.io + User:u-11aaa | 11 Aaa | u-11aaa@confluent.io