blob: f0693b2a90739fbfa04ef2459e36c1e1256a1b67 [file]
package commands
import (
"fmt"
"github.com/spf13/cobra"
)
func NewSharingCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "sharing",
Short: "Sharing registry commands",
Long: "Manage sharing registry (domains, users, groups, entities, permissions)",
}
// Domain commands
domainCmd := &cobra.Command{
Use: "domain",
Short: "Domain commands",
}
domainCmd.AddCommand(&cobra.Command{
Use: "create --name <name> --description <desc>",
Short: "Create a domain",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing domain create not yet implemented")
},
})
domainCmd.AddCommand(&cobra.Command{
Use: "update <id>",
Short: "Update a domain",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing domain update not yet implemented")
},
})
domainCmd.AddCommand(&cobra.Command{
Use: "get <id>",
Short: "Get domain details",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing domain get not yet implemented")
},
})
domainCmd.AddCommand(&cobra.Command{
Use: "list",
Short: "List domains",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing domain list not yet implemented")
},
})
domainCmd.AddCommand(&cobra.Command{
Use: "delete <id>",
Short: "Delete a domain",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing domain delete not yet implemented")
},
})
// User commands
userCmd := &cobra.Command{
Use: "user",
Short: "User commands",
}
userCmd.AddCommand(&cobra.Command{
Use: "create --domain <id> --user-id <id> --username <name>",
Short: "Create a user",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing user create not yet implemented")
},
})
userCmd.AddCommand(&cobra.Command{
Use: "update --domain <id> --user-id <id>",
Short: "Update a user",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing user update not yet implemented")
},
})
userCmd.AddCommand(&cobra.Command{
Use: "get --domain <id> --user-id <id>",
Short: "Get user details",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing user get not yet implemented")
},
})
userCmd.AddCommand(&cobra.Command{
Use: "list --domain <id>",
Short: "List users",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing user list not yet implemented")
},
})
userCmd.AddCommand(&cobra.Command{
Use: "delete --domain <id> --user-id <id>",
Short: "Delete a user",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing user delete not yet implemented")
},
})
// Group commands
groupCmd := &cobra.Command{
Use: "group",
Short: "Group commands",
}
groupCmd.AddCommand(&cobra.Command{
Use: "create --domain <id> --name <name>",
Short: "Create a group",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group create not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "update --domain <id> --group-id <id>",
Short: "Update a group",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group update not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "get --domain <id> --group-id <id>",
Short: "Get group details",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group get not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "list --domain <id>",
Short: "List groups",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group list not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "delete --domain <id> --group-id <id>",
Short: "Delete a group",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group delete not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "add-users --domain <id> --group-id <id> --users <id1,id2>",
Short: "Add users to group",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group add-users not yet implemented")
},
})
groupCmd.AddCommand(&cobra.Command{
Use: "remove-users --domain <id> --group-id <id> --users <id1,id2>",
Short: "Remove users from group",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing group remove-users not yet implemented")
},
})
// Entity commands
entityCmd := &cobra.Command{
Use: "entity",
Short: "Entity commands",
}
entityCmd.AddCommand(&cobra.Command{
Use: "create --domain <id> --entity-id <id> --type <type>",
Short: "Create an entity",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing entity create not yet implemented")
},
})
entityCmd.AddCommand(&cobra.Command{
Use: "share --domain <id> --entity-id <id> --users <ids> --permission <id>",
Short: "Share entity with users",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing entity share not yet implemented")
},
})
entityCmd.AddCommand(&cobra.Command{
Use: "revoke --domain <id> --entity-id <id> --users <ids> --permission <id>",
Short: "Revoke entity sharing",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing entity revoke not yet implemented")
},
})
// Permission commands
permissionCmd := &cobra.Command{
Use: "permission",
Short: "Permission commands",
}
permissionCmd.AddCommand(&cobra.Command{
Use: "create --domain <id> --name <name>",
Short: "Create a permission",
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("sharing permission create not yet implemented")
},
})
cmd.AddCommand(domainCmd)
cmd.AddCommand(userCmd)
cmd.AddCommand(groupCmd)
cmd.AddCommand(entityCmd)
cmd.AddCommand(permissionCmd)
return cmd
}