diff --git a/cmd/lint/main.go b/cmd/lint/main.go index 80e1acfbff..841babbe8b 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -353,6 +353,7 @@ var vocabWords = []string{ "savepoints", "scala", "schemas", + "scim", "server", "signup", "siv", diff --git a/go.mod b/go.mod index df7a2a5058..1660cfb9df 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/confluentinc/cli/v4 -go 1.26.5 +go 1.26.7 require ( github.com/antihax/optional v1.0.0 @@ -45,7 +45,7 @@ require ( github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.7.0 github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 - github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0 + github.com/confluentinc/ccloud-sdk-go-v2/org v0.15.0 github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0 github.com/confluentinc/ccloud-sdk-go-v2/rtce v0.1.0 github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0 diff --git a/go.sum b/go.sum index 22ecac73dc..7bb1b20476 100644 --- a/go.sum +++ b/go.sum @@ -225,8 +225,8 @@ github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0 h1:ZHNF2DeqVlNPuKG github.com/confluentinc/ccloud-sdk-go-v2/networking-ip v0.2.0/go.mod h1:KTShFBZA7WG8LcxlWjJpoZFdWkJ+uOw3dDuwAHs5eKU= github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0 h1:mC0E1nKUt57AxMM4Lpdfd+KA/YZwJVwro9ER+dCUFi8= github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.3.0/go.mod h1:GIHF2cYOUKx+6ycYokr4i8E4cuNBC22xqvO/IhqZ31U= -github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0 h1:n+4lb+CFCExljsp4Goyb4JTDL/UibGUhT0k++5JNhw8= -github.com/confluentinc/ccloud-sdk-go-v2/org v0.14.0/go.mod h1:z+7wtFzDczbMGda7AG7w14BGE3pQSjaFYhNbvkZAlOs= +github.com/confluentinc/ccloud-sdk-go-v2/org v0.15.0 h1:rbtGf2SFWjfXzgi+boRjYbARditK0GIfFPLS1baIy+c= +github.com/confluentinc/ccloud-sdk-go-v2/org v0.15.0/go.mod h1:VhKDWY80oJi+YPMsE0Wq5e5VBt6kRvl//Ez790tuKO0= github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0 h1:UN2a+aqYhk95ro+wVLkeB/8W7n+UV2KsE3jNFbbDCSw= github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0/go.mod h1:TzompS9F0G6awN5xMC+nguNG8ULElN5UqX2XOBOIPuM= github.com/confluentinc/ccloud-sdk-go-v2/rtce v0.1.0 h1:OBa2vm09bOG1oojOP1vNj8V7+M2AfUkYP1sRQ+xlRm4= diff --git a/internal/organization/command.go b/internal/organization/command.go index 048b9ec9cf..a038ec40ad 100644 --- a/internal/organization/command.go +++ b/internal/organization/command.go @@ -17,10 +17,11 @@ type organizationCommand struct { } type organizationOut struct { - IsCurrent bool `human:"Current" serialized:"is_current"` - ID string `human:"ID" serialized:"id"` - Name string `human:"Name" serialized:"name"` - JitEnabled bool `human:"JIT Enabled" serialized:"jit_enabled"` + IsCurrent bool `human:"Current" serialized:"is_current"` + ID string `human:"ID" serialized:"id"` + Name string `human:"Name" serialized:"name"` + JitEnabled bool `human:"JIT Enabled" serialized:"jit_enabled"` + ScimEnabled bool `human:"SCIM Enabled" serialized:"scim_enabled"` } func New(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint:unparam @@ -48,10 +49,11 @@ func New(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command { //nolint func (c *organizationCommand) printOrganization(cmd *cobra.Command, organization orgv2.OrgV2Organization) error { table := output.NewTable(cmd) out := &organizationOut{ - IsCurrent: organization.GetId() == c.Context.GetCurrentOrganization(), - ID: organization.GetId(), - Name: organization.GetDisplayName(), - JitEnabled: organization.GetJitEnabled(), + IsCurrent: organization.GetId() == c.Context.GetCurrentOrganization(), + ID: organization.GetId(), + Name: organization.GetDisplayName(), + JitEnabled: organization.GetJitEnabled(), + ScimEnabled: organization.GetScimEnabled(), } table.Add(out) return table.Print() diff --git a/internal/organization/command_list.go b/internal/organization/command_list.go index df3dd26c5b..87f3d97790 100644 --- a/internal/organization/command_list.go +++ b/internal/organization/command_list.go @@ -36,10 +36,11 @@ func (c *organizationCommand) list(cmd *cobra.Command, _ []string) error { list := output.NewList(cmd) for _, organization := range organizations { out := &organizationOut{ - IsCurrent: organization.GetId() == c.Context.GetCurrentOrganization(), - ID: organization.GetId(), - Name: organization.GetDisplayName(), - JitEnabled: organization.GetJitEnabled(), + IsCurrent: organization.GetId() == c.Context.GetCurrentOrganization(), + ID: organization.GetId(), + Name: organization.GetDisplayName(), + JitEnabled: organization.GetJitEnabled(), + ScimEnabled: organization.GetScimEnabled(), } list.Add(out) } diff --git a/internal/organization/command_update.go b/internal/organization/command_update.go index a3d1c68629..6ff0e67735 100644 --- a/internal/organization/command_update.go +++ b/internal/organization/command_update.go @@ -25,6 +25,7 @@ func (c *organizationCommand) newUpdateCommand() *cobra.Command { // Optional flags cmd.Flags().String("name", "", "Name of the Confluent Cloud organization.") cmd.Flags().Bool("jit-enabled", false, "Toggle Just-In-Time (JIT) user provisioning for SSO-enabled organizations.") + cmd.Flags().Bool("scim-enabled", false, "Toggle System for Cross-domain Identity Management (SCIM) user provisioning for SSO-enabled organizations.") pcmd.AddContextFlag(cmd, c.CLICommand) pcmd.AddOutputFlag(cmd) @@ -53,6 +54,14 @@ func (c *organizationCommand) update(cmd *cobra.Command, _ []string) error { updateReq.JitEnabled = orgv2.PtrBool(jitEnabled) } + if cmd.Flags().Changed("scim-enabled") { + scimEnabled, err := cmd.Flags().GetBool("scim-enabled") + if err != nil { + return err + } + updateReq.ScimEnabled = orgv2.PtrBool(scimEnabled) + } + organization, httpResp, err := c.V2Client.UpdateOrgOrganization(id, updateReq) if err != nil { return errors.NewErrorWithSuggestions( diff --git a/test/fixtures/output/organization/describe-json.golden b/test/fixtures/output/organization/describe-json.golden index d6309773e9..2391f009ac 100644 --- a/test/fixtures/output/organization/describe-json.golden +++ b/test/fixtures/output/organization/describe-json.golden @@ -2,5 +2,6 @@ "is_current": true, "id": "abc-123", "name": "default", - "jit_enabled": true + "jit_enabled": true, + "scim_enabled": true } diff --git a/test/fixtures/output/organization/describe.golden b/test/fixtures/output/organization/describe.golden index 54a74bd7b4..cc2cf40829 100644 --- a/test/fixtures/output/organization/describe.golden +++ b/test/fixtures/output/organization/describe.golden @@ -1,6 +1,7 @@ -+-------------+---------+ -| Current | true | -| ID | abc-123 | -| Name | default | -| JIT Enabled | true | -+-------------+---------+ ++--------------+---------+ +| Current | true | +| ID | abc-123 | +| Name | default | +| JIT Enabled | true | +| SCIM Enabled | true | ++--------------+---------+ diff --git a/test/fixtures/output/organization/list-json.golden b/test/fixtures/output/organization/list-json.golden index d3730e184a..7452785367 100644 --- a/test/fixtures/output/organization/list-json.golden +++ b/test/fixtures/output/organization/list-json.golden @@ -3,18 +3,21 @@ "is_current": true, "id": "abc-123", "name": "org1", - "jit_enabled": true + "jit_enabled": true, + "scim_enabled": true }, { "is_current": false, "id": "abc-456", "name": "org2", - "jit_enabled": true + "jit_enabled": true, + "scim_enabled": false }, { "is_current": false, "id": "abc-789", "name": "org3", - "jit_enabled": true + "jit_enabled": true, + "scim_enabled": true } ] diff --git a/test/fixtures/output/organization/list.golden b/test/fixtures/output/organization/list.golden index 169dce696e..b1019b31ab 100644 --- a/test/fixtures/output/organization/list.golden +++ b/test/fixtures/output/organization/list.golden @@ -1,5 +1,5 @@ - Current | ID | Name | JIT Enabled -----------+---------+------+-------------- - * | abc-123 | org1 | true - | abc-456 | org2 | true - | abc-789 | org3 | true + Current | ID | Name | JIT Enabled | SCIM Enabled +----------+---------+------+-------------+--------------- + * | abc-123 | org1 | true | true + | abc-456 | org2 | true | false + | abc-789 | org3 | true | true diff --git a/test/fixtures/output/organization/update-help.golden b/test/fixtures/output/organization/update-help.golden index a95c516642..85eab4a827 100644 --- a/test/fixtures/output/organization/update-help.golden +++ b/test/fixtures/output/organization/update-help.golden @@ -6,6 +6,7 @@ Usage: Flags: --name string Name of the Confluent Cloud organization. --jit-enabled Toggle Just-In-Time (JIT) user provisioning for SSO-enabled organizations. + --scim-enabled Toggle System for Cross-domain Identity Management (SCIM) user provisioning for SSO-enabled organizations. --context string CLI context name. -o, --output string Specify the output format as "human", "json", or "yaml". (default "human") diff --git a/test/fixtures/output/organization/update-json.golden b/test/fixtures/output/organization/update-json.golden index e57a9f548a..d4adecb313 100644 --- a/test/fixtures/output/organization/update-json.golden +++ b/test/fixtures/output/organization/update-json.golden @@ -2,5 +2,6 @@ "is_current": true, "id": "abc-123", "name": "default-updated", - "jit_enabled": true + "jit_enabled": true, + "scim_enabled": true } diff --git a/test/fixtures/output/organization/update.golden b/test/fixtures/output/organization/update.golden index bd1e84667f..bd7ff46e39 100644 --- a/test/fixtures/output/organization/update.golden +++ b/test/fixtures/output/organization/update.golden @@ -1,7 +1,8 @@ Updated organization "abc-123". -+-------------+-----------------+ -| Current | true | -| ID | abc-123 | -| Name | default-updated | -| JIT Enabled | true | -+-------------+-----------------+ ++--------------+-----------------+ +| Current | true | +| ID | abc-123 | +| Name | default-updated | +| JIT Enabled | true | +| SCIM Enabled | true | ++--------------+-----------------+ diff --git a/test/test-server/org_handlers.go b/test/test-server/org_handlers.go index 7b6925febf..00471ed58c 100644 --- a/test/test-server/org_handlers.go +++ b/test/test-server/org_handlers.go @@ -143,6 +143,7 @@ func handleOrgOrganization(t *testing.T) http.HandlerFunc { Id: orgv2.PtrString(id), DisplayName: orgv2.PtrString(displayName), JitEnabled: orgv2.PtrBool(true), + ScimEnabled: orgv2.PtrBool(true), } err := json.NewEncoder(w).Encode(organization) require.NoError(t, err) @@ -155,9 +156,9 @@ func handleOrgOrganizations(t *testing.T) http.HandlerFunc { switch r.Method { case http.MethodGet: organizationList := &orgv2.OrgV2OrganizationList{Data: []orgv2.OrgV2Organization{ - {Id: orgv2.PtrString("abc-123"), DisplayName: orgv2.PtrString("org1"), JitEnabled: orgv2.PtrBool(true)}, - {Id: orgv2.PtrString("abc-456"), DisplayName: orgv2.PtrString("org2"), JitEnabled: orgv2.PtrBool(true)}, - {Id: orgv2.PtrString("abc-789"), DisplayName: orgv2.PtrString("org3"), JitEnabled: orgv2.PtrBool(true)}, + {Id: orgv2.PtrString("abc-123"), DisplayName: orgv2.PtrString("org1"), JitEnabled: orgv2.PtrBool(true), ScimEnabled: orgv2.PtrBool(true)}, + {Id: orgv2.PtrString("abc-456"), DisplayName: orgv2.PtrString("org2"), JitEnabled: orgv2.PtrBool(true), ScimEnabled: orgv2.PtrBool(false)}, + {Id: orgv2.PtrString("abc-789"), DisplayName: orgv2.PtrString("org3"), JitEnabled: orgv2.PtrBool(true), ScimEnabled: orgv2.PtrBool(true)}, }} setPageToken(organizationList, &organizationList.Metadata, r.URL) err := json.NewEncoder(w).Encode(organizationList)