Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
support delete api
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Jul 16, 2019
1 parent 43d8add commit f8456a4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ apigeeapi prods list -o org -n name
* [create](#createapi)
* [deploy](#depapi)
* [fetch](#fetchapi)
* [delete](#delapi)

### <a name="listorgs"/> list

Expand Down Expand Up @@ -210,7 +211,15 @@ Returns a zip-formatted proxy bundle of code and config files.
apigeeapi apis fetch -o org -e env -n proxy -v 1
```

The downloaded file is {proxyname}.zip and in the folder where the command runs
The downloaded file is {proxyname}.zip and in the folder where the command is executed

### <a name="delapi"/> delete

Deletes an API proxy and all associated endpoints, policies, resources, and revisions. The API proxy must be undeployed before you can delete it.

```
apigeeapi apis delete -o org -n proxy
```

## <a name="devs"/> developers

Expand Down
2 changes: 2 additions & 0 deletions cmd/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"./depapi"
fetch "./fetch"
crtapi "./crtapi"
delapi "./delapi"
"github.com/spf13/cobra"
)

Expand All @@ -26,5 +27,6 @@ func init() {
Cmd.AddCommand(listdeploy.Cmd)
Cmd.AddCommand(crtapi.Cmd)
Cmd.AddCommand(depapi.Cmd)
Cmd.AddCommand(delapi.Cmd)
Cmd.AddCommand(fetch.Cmd)
}
29 changes: 29 additions & 0 deletions cmd/apis/delapi/delapi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package delapis

import (
"../../shared"
"github.com/spf13/cobra"
"net/url"
"path"
)

var Cmd = &cobra.Command{
Use: "delete",
Short: "Deletes an API proxy",
Long: "Deletes an API proxy and all associated endpoints, policies, resources, and revisions. The proxy must be undeployed first.",
Run: func(cmd *cobra.Command, args []string) {
u, _ := url.Parse(shared.BaseURL)
u.Path = path.Join(u.Path, shared.RootArgs.Org, "apis", name)
shared.HttpClient(u.String(), "", "DELETE")
},
}

var name string

func init() {
Cmd.Flags().StringVarP(&name, "name", "n",
"", "API proxy name")

Cmd.MarkFlagRequired("name")

}

0 comments on commit f8456a4

Please sign in to comment.