这是indexloc提供的服务,不要输入任何密码
Skip to content
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
7 changes: 6 additions & 1 deletion internal/client/hub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,15 @@ func CreateApi(apiID string, contents []byte) (respBody []byte, err error) {
return respBody, err
}

func DeleteApi(apiID string) (respBody []byte, err error) {
func DeleteApi(apiID string, force bool) (respBody []byte, err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiID)

q := u.Query()
q.Set("force", strconv.FormatBool(force))

u.RawQuery = q.Encode()

respBody, err = apiclient.HttpClient(u.String(), "", "DELETE")
return respBody, err
}
Expand Down
4 changes: 3 additions & 1 deletion internal/cmd/apihub/apis/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ var DelCmd = &cobra.Command{
},
RunE: func(cmd *cobra.Command, args []string) (err error) {
cmd.SilenceUsage = true
_, err = hub.DeleteApi(apiID)
_, err = hub.DeleteApi(apiID, force)
return
},
}

func init() {
DelCmd.Flags().StringVarP(&apiID, "id", "",
"", "API ID")
DelCmd.Flags().BoolVarP(&force, "force", "",
false, "force delete the API")

_ = DelCmd.MarkFlagRequired("id")
}
1 change: 1 addition & 0 deletions internal/cmd/apihub/apis/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var GetCmd = &cobra.Command{
}

var apiID string
var force bool

func init() {
GetCmd.Flags().StringVarP(&apiID, "id", "i",
Expand Down
Loading