Skip to content

Commit 61e28c2

Browse files
Merge pull request #663 from apigee/issue662
fix: for issue662
2 parents da04e28 + 9c2af03 commit 61e28c2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

internal/client/hub/hub.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,15 @@ func CreateApi(apiID string, contents []byte) (respBody []byte, err error) {
205205
return respBody, err
206206
}
207207

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

212+
q := u.Query()
213+
q.Set("force", strconv.FormatBool(force))
214+
215+
u.RawQuery = q.Encode()
216+
212217
respBody, err = apiclient.HttpClient(u.String(), "", "DELETE")
213218
return respBody, err
214219
}

internal/cmd/apihub/apis/delete.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ var DelCmd = &cobra.Command{
3232
},
3333
RunE: func(cmd *cobra.Command, args []string) (err error) {
3434
cmd.SilenceUsage = true
35-
_, err = hub.DeleteApi(apiID)
35+
_, err = hub.DeleteApi(apiID, force)
3636
return
3737
},
3838
}
3939

4040
func init() {
4141
DelCmd.Flags().StringVarP(&apiID, "id", "",
4242
"", "API ID")
43+
DelCmd.Flags().BoolVarP(&force, "force", "",
44+
false, "force delete the API")
4345

4446
_ = DelCmd.MarkFlagRequired("id")
4547
}

internal/cmd/apihub/apis/get.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var GetCmd = &cobra.Command{
3838
}
3939

4040
var apiID string
41+
var force bool
4142

4243
func init() {
4344
GetCmd.Flags().StringVarP(&apiID, "id", "i",

0 commit comments

Comments
 (0)