Skip to content

Commit

Permalink
chore: add --secret option to init tenant cmd #76
Browse files Browse the repository at this point in the history
  • Loading branch information
SLedunois committed Apr 13, 2023
1 parent bb9e979 commit ba05c1e
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/bbsctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bbsctl <command> [flags]
* [bbsctl get](bbsctl_get.md) - Display a resource
* [bbsctl init](bbsctl_init.md) - Initialize a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ bbsctl apply -f [filepath] [flags]

* [bbsctl](bbsctl.md) - BigBlueSwarm controller cli

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_cluster-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bbsctl cluster-info [flags]

* [bbsctl](bbsctl.md) - BigBlueSwarm controller cli

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ bbsctl delete <command> [flags]
* [bbsctl](bbsctl.md) - BigBlueSwarm controller cli
* [bbsctl delete tenant](bbsctl_delete_tenant.md) - delete a tenant based on hostname

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_delete_tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bbsctl delete tenant <hostname> [flags]

* [bbsctl delete](bbsctl_delete.md) - Delete a specific resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ bbsctl describe <command> [flags]
* [bbsctl describe config](bbsctl_describe_config.md) - describe BigBlueSwarm configuration.
* [bbsctl describe tenant](bbsctl_describe_tenant.md) - Describe B3L tenant.

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_describe_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bbsctl describe config [flags]

* [bbsctl describe](bbsctl_describe.md) - Show details of a specific resource or group of resources

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_describe_tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ bbsctl describe tenant <hostname> [flags]

* [bbsctl describe](bbsctl_describe.md) - Show details of a specific resource or group of resources

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ bbsctl get <command> [flags]
* [bbsctl get instances](bbsctl_get_instances.md) - Display all BigBlueButton instances available in your BigBlueSwarm cluster
* [bbsctl get tenants](bbsctl_get_tenants.md) - Display all BigBlueSwarm tenants available in your BigBlueSwarm cluster

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_get_instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ bbsctl get instances [flags]

* [bbsctl get](bbsctl_get.md) - Display a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_get_tenants.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ bbsctl get tenants [flags]

* [bbsctl get](bbsctl_get.md) - Display a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ bbsctl init <command> [flags]
* [bbsctl init instances](bbsctl_init_instances.md) - Initialize bigblueswarm instances file
* [bbsctl init tenant](bbsctl_init_tenant.md) - Initialize a new bigblueswarm tenant configuration file

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_init_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ bbsctl init config --bbs http://bbs.example.com --key api_key

* [bbsctl init](bbsctl_init.md) - Initialize a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
2 changes: 1 addition & 1 deletion docs/bbsctl_init_instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbsctl init instances

* [bbsctl init](bbsctl_init.md) - Initialize a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
14 changes: 12 additions & 2 deletions docs/bbsctl_init_tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ bbsctl init tenant --host bbs.example.com
#
# kind: Tenant
# spec:
host: bbs.example.com
# host: bbs.example.com
# instances: []
bbsctl init tenant --host bbs.example.com --secret dummy_secret
# generates the following file
#
# kind: Tenant
# spec:
# host: bbs.example.com
# secret: dummy_secret
# instances: []
bbsctl init tenant --host bbs.example.com --dest /path/to/file
Expand Down Expand Up @@ -52,6 +61,7 @@ bbsctl init tenant --host bbs.example.com --meeting_pool 10 --user_pool 100
-h, --help help for tenant
--host string Tenant hostname
--meeting_pool int Tenant meeting pool. This means the tenant can't create more meetings than the configured meeting pool. -1 is ignored. (default -1)
--secret string Tenant secret
--user_pool int Tenant user pool. This means the tenant can't have more users than the configured user pool. -1 is ignored. (default -1)
```

Expand All @@ -65,4 +75,4 @@ bbsctl init tenant --host bbs.example.com --meeting_pool 10 --user_pool 100

* [bbsctl init](bbsctl_init.md) - Initialize a resource

###### Auto generated by spf13/cobra on 3-Jan-2023
###### Auto generated by spf13/cobra on 13-Apr-2023
1 change: 1 addition & 0 deletions pkg/cmd/init/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewInitInstancesFlags() *InstancesFlags {
// TenantFlags represents `bbsctl init tenant` flags
type TenantFlags struct {
Hostname string
Secret string
Destination string
UserPool int64
MeetingPool int64
Expand Down
16 changes: 15 additions & 1 deletion pkg/cmd/init/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ bbsctl init tenant --host bbs.example.com
#
# kind: Tenant
# spec:
host: bbs.example.com
# host: bbs.example.com
# instances: []
bbsctl init tenant --host bbs.example.com --secret dummy_secret
# generates the following file
#
# kind: Tenant
# spec:
# host: bbs.example.com
# secret: dummy_secret
# instances: []
bbsctl init tenant --host bbs.example.com --dest /path/to/file
Expand Down Expand Up @@ -82,6 +91,7 @@ func NewInitTenantCmd() *cobra.Command {
func (cmd *TenantCmd) ApplyFlags() {
cmd.Command.Flags().StringVarP(&cmd.Flags.Destination, "dest", "d", bbsconfig.DefaultConfigFolder, "File folder destination")
cmd.Command.Flags().StringVarP(&cmd.Flags.Hostname, "host", "", "", "Tenant hostname")
cmd.Command.Flags().StringVarP(&cmd.Flags.Secret, "secret", "", "", "Tenant secret")
cmd.Command.Flags().Int64VarP(&cmd.Flags.MeetingPool, "meeting_pool", "", -1, "Tenant meeting pool. This means the tenant can't create more meetings than the configured meeting pool. -1 is ignored.")
cmd.Command.Flags().Int64VarP(&cmd.Flags.UserPool, "user_pool", "", -1, "Tenant user pool. This means the tenant can't have more users than the configured user pool. -1 is ignored.")
cmd.Command.MarkFlagRequired("host")
Expand All @@ -102,6 +112,10 @@ func (cmd *TenantCmd) init(command *cobra.Command, args []string) error {
Instances: []string{},
}

if cmd.Flags.Secret != "" {
tenant.Spec.Secret = cmd.Flags.Secret
}

if cmd.Flags.MeetingPool != -1 {
tenant.Spec.MeetingsPool = &cmd.Flags.MeetingPool
}
Expand Down

0 comments on commit ba05c1e

Please sign in to comment.