Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/lint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ var vocabWords = []string{
"sasl",
"scala",
"schemas",
"scim",
"server",
"signup",
"siv",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
github.com/confluentinc/ccloud-sdk-go-v2/networking-gateway v0.2.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.9.0
github.com/confluentinc/ccloud-sdk-go-v2/org v0.10.0
github.com/confluentinc/ccloud-sdk-go-v2/provider-integration v0.2.0
github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.7.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,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.9.0 h1:FtaqHX0kBTK7fCQK+9SJcOso+XpWCWzY2roT3gBQGfw=
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0/go.mod h1:X0uaTYPp+mr19W1R/Z1LuB1ePZJZrH7kxnQckDx6zoc=
github.com/confluentinc/ccloud-sdk-go-v2/org v0.10.0 h1:UN/SU52OApJxMt/zkuxmTGjhAzy1nALcsZbnBP+jfaE=
github.com/confluentinc/ccloud-sdk-go-v2/org v0.10.0/go.mod h1:K5kVqnlOPD35riIm1VR89uulVwsKlmCbKDWxXSKTFVI=
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/service-quota v0.2.0 h1:xVSmwdycExze1E2Jta99CaFuMOlL6k6KExOOSY1hSFg=
Expand Down
9 changes: 5 additions & 4 deletions internal/organization/command_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (
)

type out 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 (c *command) newDescribeCommand() *cobra.Command {
Expand Down
9 changes: 5 additions & 4 deletions internal/organization/command_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ func (c *command) list(cmd *cobra.Command, _ []string) error {
list := output.NewList(cmd)
for _, organization := range organizations {
list.Add(&out{
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(),
})
}
return list.Print()
Expand Down
18 changes: 14 additions & 4 deletions internal/organization/command_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func (c *command) newUpdateCommand() *cobra.Command {

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.AddOutputFlag(cmd)

return cmd
Expand All @@ -36,6 +37,14 @@ func (c *command) update(cmd *cobra.Command, _ []string) error {
organization.JitEnabled = orgv2.PtrBool(jitEnabled)
}

if cmd.Flags().Changed("scim-enabled") {
scimEnabled, err := cmd.Flags().GetBool("scim-enabled")
if err != nil {
return err
}
organization.ScimEnabled = orgv2.PtrBool(scimEnabled)
}

if cmd.Flags().Changed("name") {
name, err := cmd.Flags().GetString("name")
if err != nil {
Expand All @@ -51,10 +60,11 @@ func (c *command) update(cmd *cobra.Command, _ []string) error {

table := output.NewTable(cmd)
table.Add(&out{
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(),
})
return table.Print()
}
3 changes: 2 additions & 1 deletion test/fixtures/output/organization/describe-json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"is_current": true,
"id": "abc-123",
"name": "default",
"jit_enabled": true
"jit_enabled": true,
"scim_enabled": false
}
13 changes: 7 additions & 6 deletions test/fixtures/output/organization/describe.golden
Original file line number Diff line number Diff line change
@@ -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 | false |
+--------------+---------+
9 changes: 6 additions & 3 deletions test/fixtures/output/organization/list-json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
10 changes: 5 additions & 5 deletions test/fixtures/output/organization/list.golden
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/fixtures/output/organization/update-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Global Flags:
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/output/organization/update-json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"is_current": true,
"id": "abc-123",
"name": "default-updated",
"jit_enabled": true
"jit_enabled": true,
"scim_enabled": true
}
13 changes: 7 additions & 6 deletions test/fixtures/output/organization/update.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
+-------------+-----------------+
| 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 |
+--------------+-----------------+
7 changes: 4 additions & 3 deletions test/test-server/org_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,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)
Expand All @@ -146,9 +147,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)
Expand Down