Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: adds validation for siteid #349 #350

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/apicategories/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apicategories

import (
"fmt"

"internal/apiclient"

"internal/client/apicategories"
Expand All @@ -31,6 +33,9 @@ var CreateCmd = &cobra.Command{
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
_, err = apicategories.Create(siteid, name)
return
},
Expand Down
5 changes: 5 additions & 0 deletions cmd/apicategories/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apicategories

import (
"fmt"

"internal/apiclient"
"internal/client/apicategories"

Expand All @@ -30,6 +32,9 @@ var DelCmd = &cobra.Command{
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
_, err = apicategories.Delete(siteid, id)
return
},
Expand Down
5 changes: 5 additions & 0 deletions cmd/apicategories/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apicategories

import (
"fmt"

"internal/apiclient"

"internal/client/apicategories"
Expand All @@ -31,6 +33,9 @@ var GetCmd = &cobra.Command{
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
_, err = apicategories.Get(siteid, id)
return
},
Expand Down
5 changes: 5 additions & 0 deletions cmd/apicategories/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apicategories

import (
"fmt"

"internal/apiclient"
"internal/client/apicategories"

Expand All @@ -27,6 +29,9 @@ var ListCmd = &cobra.Command{
Short: "Returns the API categories associated with a portal",
Long: "Returns the API categories associated with a portal",
Args: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/apidocs/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var CreateCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("require-callback-url must be a boolean value: %v", err)
}

if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
5 changes: 5 additions & 0 deletions cmd/apidocs/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apidocs

import (
"fmt"

"internal/apiclient"
"internal/client/apidocs"

Expand All @@ -27,6 +29,9 @@ var DelCmd = &cobra.Command{
Short: "Deletes a catalog item",
Long: "Deletes a catalog item",
Args: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
5 changes: 5 additions & 0 deletions cmd/apidocs/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apidocs

import (
"fmt"

"internal/apiclient"
"internal/client/apidocs"

Expand All @@ -27,6 +29,9 @@ var GetCmd = &cobra.Command{
Short: "Gets a catalog item",
Long: "Gets a catalog item",
Args: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
5 changes: 5 additions & 0 deletions cmd/apidocs/getdocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apidocs

import (
"fmt"

"internal/apiclient"
"internal/client/apidocs"

Expand All @@ -27,6 +29,9 @@ var GetDocCmd = &cobra.Command{
Short: "Gets the documentation for the specified catalog item",
Long: "Gets the documentation for the specified catalog item",
Args: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
5 changes: 5 additions & 0 deletions cmd/apidocs/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package apidocs

import (
"fmt"

"internal/apiclient"
"internal/client/apidocs"

Expand All @@ -27,6 +29,9 @@ var ListCmd = &cobra.Command{
Short: "Returns the catalog items associated with a portal",
Long: "Returns the catalog items associated with a portal",
Args: func(cmd *cobra.Command, args []string) (err error) {
if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/apidocs/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ var UpdateCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("require-callback-url must be a boolean value: %v", err)
}

if siteid == "" {
return fmt.Errorf("siteid is a mandatory parameter")
}
return apiclient.SetApigeeOrg(org)
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
Expand Down