Skip to content

Commit

Permalink
update endpoint version to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-onelson committed Sep 26, 2023
1 parent b28ab08 commit d88e72a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ Example Schema:
printer.CheckErr(err)
ep.Disabled = &disabledFlag
}
versionFlag, err := cmd.Flags().GetInt32(versionFlagName)
printer.CheckErr(err)
ep.Version = versionFlag

if cmd.Flags().Changed(versionFlagName) {
versionFlag, err := cmd.Flags().GetInt32(versionFlagName)
printer.CheckErr(err)
ep.Version.Set(&versionFlag)
}
svixClient := getSvixClientOrExit()
out, err := svixClient.Endpoint.Create(cmd.Context(), appID, &ep)
printer.CheckErr(err)
Expand All @@ -117,7 +118,7 @@ Example Schema:
},
}
create.Flags().String(urlFlagName, "", "")
create.Flags().Int32(versionFlagName, 1, "")
create.Flags().Int32(versionFlagName, 0, "")
create.Flags().StringArray(filterTypesFlagName, []string{}, "")
create.Flags().Int32(rateLimitFlagName, 0, "Rate Limit of the endpoint (optional)")
create.Flags().Bool(disabledFlagName, false, "")
Expand Down Expand Up @@ -189,7 +190,7 @@ Example Schema:
if cmd.Flags().Changed(versionFlagName) {
versionFlag, err := cmd.Flags().GetInt32(versionFlagName)
printer.CheckErr(err)
ep.Version = versionFlag
ep.Version.Set(&versionFlag)
}
if cmd.Flags().Changed(filterTypesFlagName) {
filterTypesFlag, err := cmd.Flags().GetStringArray(filterTypesFlagName)
Expand Down

0 comments on commit d88e72a

Please sign in to comment.