Fix the following issue:
Problem Statement
I'm trying to spin up containers on my Flocker cluster via the HTTP API but I can't find a way to do it — the configuration endpoints let me create datasets but there's nothing for containers as far as I can tell. Can we get a POST under /v1/configuration/containers so I can declare a container (host + name + image) the same way I declare datasets? Also it'd be nice if it actually rejected duplicate names instead of silently letting two containers share one.
One small thing while you're in there: the duplicate-dataset_id 409 returns its error under a message key, but every other error I've hit uses description — kinda annoying to special-case in my client, would be great to make that consistent.
Expected outcomes
Container configuration creation:
- A
POSTto/v1/configuration/containerswith a JSON body containinghost,name, andimagecreates a container entry in the cluster configuration. - A successful container creation returns HTTP
201 Created. - The successful response body includes the same
host,name, andimagevalues supplied by the client. - The created container is persisted in the configuration for the specified host.
- A
Duplicate container names:
- Creating a container with a
namethat is already used by any configured container is rejected. - Duplicate container-name requests return HTTP
409 Conflict. - Duplicate container-name error responses use a
descriptionfield that explains the duplicate-name conflict.
- Creating a container with a
Dataset conflict error format:
- Duplicate
dataset_idconfiguration requests continue to return HTTP409 Conflict. - The duplicate-
dataset_idconflict response uses adescriptionfield rather than amessagefield.
- Duplicate
Implementation notes
- Match the existing HTTP API conventions in this repository for routing, JSON request/response validation, persistence, and error formatting.
- The internal data structures, helper functions, and exact placement of validation or collision checks are implementation details; preserve the externally observable API behavior described above.