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:
To be consistent, a change will be made to the L0 API to expose environment links via:
PUT /environment/:id
{ ... }
Client will be updated to take into account the changes at the API controller layer
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.
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.
Terraform Layer0 Provider will also need to be updated.
Notes:
This change will render the API unable to create a bi-directional environment link. The responsibility will move to the caller to explicitly create 2 environment links; which in our case will be the CLI and Terraform Layer0 Provider's responsibility.
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.
Problem:
The environment link endpoints exposed by Layer0 API were thought to be somewhat strange since introduction.
To create and delete environment link:
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:
To be consistent, a change will be made to the L0 API to expose environment links via:
Client will be updated to take into account the changes at the API controller layer
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.CLI link command will be updated with an optional flag
--bi-directional
with a default value oftrue
. Essentially CLI will by default create a bi-directional link to maintain existing behavior.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.