Skip to content

Commit

Permalink
acl done
Browse files Browse the repository at this point in the history
  • Loading branch information
grantstephens committed Nov 18, 2022
1 parent fb308e9 commit 56ccc2a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
17 changes: 11 additions & 6 deletions pkg/commands/acl/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ import (

// NewCreateCommand returns a usable command registered under the parent.
func NewCreateCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *CreateCommand {
var c CreateCommand
c := CreateCommand{
Base: cmd.Base{
Globals: globals,
},
manifest: data,
}

c.CmdClause = parent.Command("create", "Create a new ACL attached to the specified service version").Alias("add")
c.Globals = globals
c.manifest = data

// Required flags
c.CmdClause.Flag("name", "Name for the ACL. Must start with an alphanumeric character and contain only alphanumeric characters, underscores, and whitespace").Action(c.name.Set).StringVar(&c.name.Value)
// required
c.RegisterFlag(cmd.StringFlagOpts{
Name: cmd.FlagVersionName,
Description: cmd.FlagVersionDesc,
Dst: &c.serviceVersion.Value,
Required: true,
})

// Optional flags
// optional
c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{
Action: c.autoClone.Set,
Dst: &c.autoClone.Value,
Expand All @@ -45,6 +48,8 @@ func NewCreateCommand(parent cmd.Registerer, globals *config.Data, data manifest
Dst: &c.serviceName.Value,
})

c.CmdClause.Flag("name", "Name for the ACL. Must start with an alphanumeric character and contain only alphanumeric characters, underscores, and whitespace").Action(c.name.Set).StringVar(&c.name.Value)

return &c
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/commands/acl/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ import (
// NewDeleteCommand returns a usable command registered under the parent.
func NewDeleteCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *DeleteCommand {
var c DeleteCommand
c.CmdClause = parent.Command("delete", "Delete an ACL from the specified service version").Alias("remove")
c.Globals = globals
c.manifest = data
c.CmdClause = parent.Command("delete", "Delete an ACL from the specified service version").Alias("remove")

// Required flags
c.CmdClause.Flag("name", "The name of the ACL to delete").Required().StringVar(&c.name)
c.RegisterFlag(cmd.StringFlagOpts{
Name: cmd.FlagVersionName,
Description: cmd.FlagVersionDesc,
Dst: &c.serviceVersion.Value,
Required: true,
})

c.CmdClause.Flag("name", "The name of the ACL to delete").Required().StringVar(&c.name)

// Optional flags
c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{
Action: c.autoClone.Set,
Expand Down
12 changes: 8 additions & 4 deletions pkg/commands/acl/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ import (

// NewDescribeCommand returns a usable command registered under the parent.
func NewDescribeCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *DescribeCommand {
var c DescribeCommand
c := DescribeCommand{
Base: cmd.Base{
Globals: globals,
},
manifest: data,
}
c.CmdClause = parent.Command("describe", "Retrieve a single ACL by name for the version and service").Alias("get")
c.Globals = globals
c.manifest = data

// Required flags
c.CmdClause.Flag("name", "The name of the ACL").Required().StringVar(&c.name)
c.RegisterFlag(cmd.StringFlagOpts{
Name: cmd.FlagVersionName,
Description: cmd.FlagVersionDesc,
Dst: &c.serviceVersion.Value,
Required: true,
})

c.CmdClause.Flag("name", "The name of the ACL").Required().StringVar(&c.name)

// Optional Flags
c.RegisterFlagBool(cmd.BoolFlagOpts{
Name: cmd.FlagJSONName,
Expand Down
9 changes: 6 additions & 3 deletions pkg/commands/acl/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ import (

// NewListCommand returns a usable command registered under the parent.
func NewListCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *ListCommand {
var c ListCommand
c := ListCommand{
Base: cmd.Base{
Globals: globals,
},
manifest: data,
}
c.CmdClause = parent.Command("list", "List ACLs")
c.Globals = globals
c.manifest = data

// Required flags
c.RegisterFlag(cmd.StringFlagOpts{
Expand Down
14 changes: 9 additions & 5 deletions pkg/commands/acl/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ import (

// NewUpdateCommand returns a usable command registered under the parent.
func NewUpdateCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *UpdateCommand {
var c UpdateCommand
c := UpdateCommand{
Base: cmd.Base{
Globals: globals,
},
manifest: data,
}
c.CmdClause = parent.Command("update", "Update an ACL for a particular service and version")
c.Globals = globals
c.manifest = data

// Required flags
c.CmdClause.Flag("name", "The name of the ACL to update").Required().StringVar(&c.name)
c.CmdClause.Flag("new-name", "The new name of the ACL").Required().StringVar(&c.newName)
c.RegisterFlag(cmd.StringFlagOpts{
Name: cmd.FlagVersionName,
Description: cmd.FlagVersionDesc,
Dst: &c.serviceVersion.Value,
Required: true,
})

c.CmdClause.Flag("name", "The name of the ACL to update").Required().StringVar(&c.name)
c.CmdClause.Flag("new-name", "The new name of the ACL").Required().StringVar(&c.newName)

// Optional flags
c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{
Action: c.autoClone.Set,
Expand Down

0 comments on commit 56ccc2a

Please sign in to comment.