diff --git a/cmd/organization.go b/cmd/organization.go index b5b77b51..4ca36b13 100644 --- a/cmd/organization.go +++ b/cmd/organization.go @@ -37,23 +37,23 @@ var addOrgCmd = &cobra.Command{ if err != nil { return err } - organizationQuotaProject, err := cmd.Flags().GetUint("project-quota") + organizationQuotaProject, err := cmd.Flags().GetInt("project-quota") if err != nil { return err } - organizationQuotaGroup, err := cmd.Flags().GetUint("group-quota") + organizationQuotaGroup, err := cmd.Flags().GetInt("group-quota") if err != nil { return err } - organizationQuotaNotification, err := cmd.Flags().GetUint("notification-quota") + organizationQuotaNotification, err := cmd.Flags().GetInt("notification-quota") if err != nil { return err } - organizationQuotaEnvironment, err := cmd.Flags().GetUint("environment-quota") + organizationQuotaEnvironment, err := cmd.Flags().GetInt("environment-quota") if err != nil { return err } - organizationQuotaRoute, err := cmd.Flags().GetUint("route-quota") + organizationQuotaRoute, err := cmd.Flags().GetInt("route-quota") if err != nil { return err } @@ -163,23 +163,23 @@ var updateOrganizationCmd = &cobra.Command{ if err != nil { return err } - organizationQuotaProject, err := cmd.Flags().GetUint("project-quota") + organizationQuotaProject, err := cmd.Flags().GetInt("project-quota") if err != nil { return err } - organizationQuotaGroup, err := cmd.Flags().GetUint("group-quota") + organizationQuotaGroup, err := cmd.Flags().GetInt("group-quota") if err != nil { return err } - organizationQuotaNotification, err := cmd.Flags().GetUint("notification-quota") + organizationQuotaNotification, err := cmd.Flags().GetInt("notification-quota") if err != nil { return err } - organizationQuotaEnvironment, err := cmd.Flags().GetUint("environment-quota") + organizationQuotaEnvironment, err := cmd.Flags().GetInt("environment-quota") if err != nil { return err } - organizationQuotaRoute, err := cmd.Flags().GetUint("route-quota") + organizationQuotaRoute, err := cmd.Flags().GetInt("route-quota") if err != nil { return err } @@ -196,11 +196,11 @@ var updateOrganizationCmd = &cobra.Command{ organizationInput := s.UpdateOrganizationPatchInput{ Description: nullStrCheck(organizationDescription), FriendlyName: nullStrCheck(organizationFriendlyName), - QuotaProject: nullUintCheck(organizationQuotaProject), - QuotaGroup: nullUintCheck(organizationQuotaGroup), - QuotaNotification: nullUintCheck(organizationQuotaNotification), - QuotaEnvironment: nullUintCheck(organizationQuotaEnvironment), - QuotaRoute: nullUintCheck(organizationQuotaRoute), + QuotaProject: nullIntCheck(organizationQuotaProject), + QuotaGroup: nullIntCheck(organizationQuotaGroup), + QuotaNotification: nullIntCheck(organizationQuotaNotification), + QuotaEnvironment: nullIntCheck(organizationQuotaEnvironment), + QuotaRoute: nullIntCheck(organizationQuotaRoute), } result, err := l.UpdateOrganization(context.TODO(), organization.ID, organizationInput, lc) handleError(err) @@ -231,20 +231,20 @@ func init() { addOrgCmd.Flags().StringP("name", "O", "", "Name of the organization") addOrgCmd.Flags().String("friendly-name", "", "Friendly name of the organization") addOrgCmd.Flags().String("description", "", "Description of the organization") - addOrgCmd.Flags().Uint("project-quota", 0, "Project quota for the organization") - addOrgCmd.Flags().Uint("group-quota", 0, "Group quota for the organization") - addOrgCmd.Flags().Uint("notification-quota", 0, "Notification quota for the organization") - addOrgCmd.Flags().Uint("environment-quota", 0, "Environment quota for the organization") - addOrgCmd.Flags().Uint("route-quota", 0, "Route quota for the organization") + addOrgCmd.Flags().Int("project-quota", 0, "Project quota for the organization") + addOrgCmd.Flags().Int("group-quota", 0, "Group quota for the organization") + addOrgCmd.Flags().Int("notification-quota", 0, "Notification quota for the organization") + addOrgCmd.Flags().Int("environment-quota", 0, "Environment quota for the organization") + addOrgCmd.Flags().Int("route-quota", 0, "Route quota for the organization") updateOrganizationCmd.Flags().StringP("name", "O", "", "Name of the organization to update") updateOrganizationCmd.Flags().String("friendly-name", "", "Friendly name of the organization") updateOrganizationCmd.Flags().String("description", "", "Description of the organization") - updateOrganizationCmd.Flags().Uint("project-quota", 0, "Project quota for the organization") - updateOrganizationCmd.Flags().Uint("group-quota", 0, "Group quota for the organization") - updateOrganizationCmd.Flags().Uint("notification-quota", 0, "Notification quota for the organization") - updateOrganizationCmd.Flags().Uint("environment-quota", 0, "Environment quota for the organization") - updateOrganizationCmd.Flags().Uint("route-quota", 0, "Route quota for the organization") + updateOrganizationCmd.Flags().Int("project-quota", 0, "Project quota for the organization") + updateOrganizationCmd.Flags().Int("group-quota", 0, "Group quota for the organization") + updateOrganizationCmd.Flags().Int("notification-quota", 0, "Notification quota for the organization") + updateOrganizationCmd.Flags().Int("environment-quota", 0, "Environment quota for the organization") + updateOrganizationCmd.Flags().Int("route-quota", 0, "Route quota for the organization") deleteOrgCmd.Flags().StringP("name", "O", "", "Name of the organization to delete") } diff --git a/cmd/shared.go b/cmd/shared.go index 7f1adfed..7af150db 100644 --- a/cmd/shared.go +++ b/cmd/shared.go @@ -106,6 +106,13 @@ func nullUintCheck(i uint) *uint { return &i } +func nullIntCheck(i int) *int { + if i == 0 { + return nil + } + return &i +} + func requiredInputCheck(field string, value string) error { if value == "" || value == "0" { return fmt.Errorf(fmt.Sprintf("Missing argument: %s is not defined", field)) diff --git a/go.mod b/go.mod index e38f3792..359c4419 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/guregu/null v4.0.0+incompatible // workaround for https://github.com/manifoldco/promptui/issues/98 github.com/nicksnyder/go-i18n v1.10.1 // indirect - github.com/uselagoon/machinery v0.0.12-0.20231023034503-73831e83e104 + github.com/uselagoon/machinery v0.0.12-0.20231023051946-037b2d611755 golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect diff --git a/go.sum b/go.sum index d06a7b30..d9d0f33a 100644 --- a/go.sum +++ b/go.sum @@ -129,6 +129,8 @@ github.com/uselagoon/machinery v0.0.12-0.20231020044620-78ab64a18d9d h1:fEQ80pWi github.com/uselagoon/machinery v0.0.12-0.20231020044620-78ab64a18d9d/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk= github.com/uselagoon/machinery v0.0.12-0.20231023034503-73831e83e104 h1:4U+8Re8V0AY8jBuWAiGu7d07+LiKky9tDcfZBpgd/NU= github.com/uselagoon/machinery v0.0.12-0.20231023034503-73831e83e104/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk= +github.com/uselagoon/machinery v0.0.12-0.20231023051946-037b2d611755 h1:wRzZdJmoItWrkwcdWxFI0yaHgt6cbm42xP66XrHVb8c= +github.com/uselagoon/machinery v0.0.12-0.20231023051946-037b2d611755/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=