quintilesims / layer0

Build, Manage, and Deploy Your Applications
Apache License 2.0
44 stars 20 forks source link

Update Environment Link Paths to be more consistent #405

Closed sesh-kebab closed 6 years ago

sesh-kebab commented 7 years ago

Problem:

The environment link endpoints exposed by Layer0 API were thought to be somewhat strange since introduction.

To create and delete environment link:

POST /environment/:id/link
{ ... }

DELETE /environment/:id/link/:id2

Key Point being that it is inconsistent with how other entities expose servicing attributes. Links is essentially an attribute of an environment which specifies which environment(s) are linked to it.

Proposal:

  1. To be consistent, a change will be made to the L0 API to expose environment links via:

    PUT /environment/:id
    { ... }
  2. Client will be updated to take into account the changes at the API controller layer

  3. A link will also be one way. I.e., a request such as l0 environment link env1 env2 will create a link to allow traffic from env1 to env2. Although in practice, we don't expect anyone to use one-way linking.

  4. CLI link command will be updated with an optional flag --bi-directional with a default value of true. Essentially CLI will by default create a bi-directional link to maintain existing behavior.

  5. Terraform Layer0 Provider will also need to be updated.

Notes:

Other:

For the record, although we are making PUT requests to do partial idempotent updates, I believe PATCH requests to do partial entity updates would be more appropriate; both in the case of updating LB ports and ENV links.

sesh-kebab commented 6 years ago

fixed by #411