Skip to content

Commit

Permalink
Rename iam org-policy replace->update
Browse files Browse the repository at this point in the history
  • Loading branch information
kobajagi committed Feb 1, 2024
1 parent 91ff993 commit 20b5e32
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/iam_org_policy_replace.go → cmd/iam_org_policy_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ import (
exoapi "github.com/exoscale/egoscale/v2/api"
)

type iamOrgPolicyReplaceCmd struct {
type iamOrgPolicyUpdateCmd struct {
cliCommandSettings `cli-cmd:"-"`

Policy string `cli-arg:"#"`

_ bool `cli-cmd:"replace"`
_ bool `cli-cmd:"update"`
}

func (c *iamOrgPolicyReplaceCmd) cmdAliases() []string { return nil }
func (c *iamOrgPolicyUpdateCmd) cmdAliases() []string {
return []string{"replace"}
}

func (c *iamOrgPolicyReplaceCmd) cmdShort() string {
return "Replace Org policy"
func (c *iamOrgPolicyUpdateCmd) cmdShort() string {
return "Update Org policy"
}

func (c *iamOrgPolicyReplaceCmd) cmdLong() string {
func (c *iamOrgPolicyUpdateCmd) cmdLong() string {
return fmt.Sprintf(`This command replaces the complete IAM Organization Policy with the new one provided in JSON format.
To read the Policy from STDIN provide '-' as an argument.
Expand All @@ -41,11 +43,11 @@ Supported output template annotations: %s`,
strings.Join(output.TemplateAnnotations(&iamPolicyOutput{}), ", "))
}

func (c *iamOrgPolicyReplaceCmd) cmdPreRun(cmd *cobra.Command, args []string) error {
func (c *iamOrgPolicyUpdateCmd) cmdPreRun(cmd *cobra.Command, args []string) error {
return cliCommandDefaultPreRun(c, cmd, args)
}

func (c *iamOrgPolicyReplaceCmd) cmdRun(cmd *cobra.Command, _ []string) error {
func (c *iamOrgPolicyUpdateCmd) cmdRun(cmd *cobra.Command, _ []string) error {
zone := account.CurrentAccount.DefaultZone
ctx := exoapi.WithEndpoint(
gContext,
Expand Down Expand Up @@ -123,7 +125,7 @@ func (c *iamOrgPolicyReplaceCmd) cmdRun(cmd *cobra.Command, _ []string) error {
}

func init() {
cobra.CheckErr(registerCLICommand(iamOrgPolicyCmd, &iamOrgPolicyReplaceCmd{
cobra.CheckErr(registerCLICommand(iamOrgPolicyCmd, &iamOrgPolicyUpdateCmd{
cliCommandSettings: defaultCLICmdSettings(),
}))
}

0 comments on commit 20b5e32

Please sign in to comment.