(orgContext *OrganizationContext)
| 15 | ) |
| 16 | |
| 17 | func (r *RootCmd) organizationSettings(orgContext *OrganizationContext) *serpent.Command { |
| 18 | settings := []organizationSetting{ |
| 19 | { |
| 20 | Name: "group-sync", |
| 21 | Aliases: []string{"groupsync"}, |
| 22 | Short: "Group sync settings to sync groups from an IdP.", |
| 23 | Patch: func(ctx context.Context, cli *codersdk.Client, org uuid.UUID, input json.RawMessage) (any, error) { |
| 24 | var req codersdk.GroupSyncSettings |
| 25 | err := json.Unmarshal(input, &req) |
| 26 | if err != nil { |
| 27 | return nil, xerrors.Errorf("unmarshalling group sync settings: %w", err) |
| 28 | } |
| 29 | return cli.PatchGroupIDPSyncSettings(ctx, org.String(), req) |
| 30 | }, |
| 31 | Fetch: func(ctx context.Context, cli *codersdk.Client, org uuid.UUID) (any, error) { |
| 32 | return cli.GroupIDPSyncSettings(ctx, org.String()) |
| 33 | }, |
| 34 | }, |
| 35 | { |
| 36 | Name: "role-sync", |
| 37 | Aliases: []string{"rolesync"}, |
| 38 | Short: "Role sync settings to sync organization roles from an IdP.", |
| 39 | Patch: func(ctx context.Context, cli *codersdk.Client, org uuid.UUID, input json.RawMessage) (any, error) { |
| 40 | var req codersdk.RoleSyncSettings |
| 41 | err := json.Unmarshal(input, &req) |
| 42 | if err != nil { |
| 43 | return nil, xerrors.Errorf("unmarshalling role sync settings: %w", err) |
| 44 | } |
| 45 | return cli.PatchRoleIDPSyncSettings(ctx, org.String(), req) |
| 46 | }, |
| 47 | Fetch: func(ctx context.Context, cli *codersdk.Client, org uuid.UUID) (any, error) { |
| 48 | return cli.RoleIDPSyncSettings(ctx, org.String()) |
| 49 | }, |
| 50 | }, |
| 51 | { |
| 52 | Name: "organization-sync", |
| 53 | Aliases: []string{"organizationsync", "org-sync", "orgsync"}, |
| 54 | Short: "Organization sync settings to sync organization memberships from an IdP.", |
| 55 | DisableOrgContext: true, |
| 56 | Patch: func(ctx context.Context, cli *codersdk.Client, _ uuid.UUID, input json.RawMessage) (any, error) { |
| 57 | var req codersdk.OrganizationSyncSettings |
| 58 | err := json.Unmarshal(input, &req) |
| 59 | if err != nil { |
| 60 | return nil, xerrors.Errorf("unmarshalling organization sync settings: %w", err) |
| 61 | } |
| 62 | return cli.PatchOrganizationIDPSyncSettings(ctx, req) |
| 63 | }, |
| 64 | Fetch: func(ctx context.Context, cli *codersdk.Client, _ uuid.UUID) (any, error) { |
| 65 | return cli.OrganizationIDPSyncSettings(ctx) |
| 66 | }, |
| 67 | }, |
| 68 | { |
| 69 | Name: "workspace-sharing", |
| 70 | Aliases: []string{"workspacesharing"}, |
| 71 | Short: "Workspace sharing settings for the organization.", |
| 72 | Patch: func(ctx context.Context, cli *codersdk.Client, org uuid.UUID, input json.RawMessage) (any, error) { |
| 73 | var req codersdk.UpdateWorkspaceSharingSettingsRequest |
| 74 | err := json.Unmarshal(input, &req) |
no test coverage detected