diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-12-04 13:44:33 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-12-04 13:44:33 -0700 |
commit | 53c8bc5a5e48f02fb0c1f1a87ec5214fb47f0b93 (patch) | |
tree | 02832295349dfbff4ea821320ccd8f59cbfba72c /pkg/api/handlers/compat/networks.go | |
parent | f01630acf35a11aecdbfb9b77b249dcec85e67b5 (diff) | |
download | podman-53c8bc5a5e48f02fb0c1f1a87ec5214fb47f0b93.tar.gz podman-53c8bc5a5e48f02fb0c1f1a87ec5214fb47f0b93.tar.bz2 podman-53c8bc5a5e48f02fb0c1f1a87ec5214fb47f0b93.zip |
Jira RUN-1106 Network handlers updates
* Add network API tests
* Update network create endpoint to return ID not Name
Audit:
- GET /networks ListNetworks
- GET /networks/{id} InspectNetwork
- DELETE /networks/{id} RemoveNetwork
- POST /networks/create CreateNetwork
- POST /networks/prune 405 not implemented
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat/networks.go')
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index b4f3aa2f1..fe13971b0 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -271,11 +271,16 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { return } + net, err := getNetworkResourceByNameOrID(name, runtime, nil) + if err != nil { + utils.InternalServerError(w, err) + return + } body := struct { Id string Warning []string }{ - Id: name, + Id: net.ID, } utils.WriteResponse(w, http.StatusCreated, body) } @@ -320,7 +325,7 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) { return } - utils.WriteResponse(w, http.StatusNoContent, "") + utils.WriteResponse(w, http.StatusNoContent, nil) } // Connect adds a container to a network |