Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Instances endpoints #6161

Merged
merged 5 commits into from Sep 6, 2019

Conversation

@tomponline
Copy link
Member

commented Sep 6, 2019

  • Renames container endpoints to have an instance prefix.
  • Adds container prefix alias for each instance endpoint.
  • Adds ability for handler functions to determine which endpoint name they are being access through.
tomponline added 4 commits Sep 6, 2019
lxd/api: Contructs endpoint alias routes
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
lxd/containers/get: Fixes comment
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
lxd/api/1.0: Renames container endpoint vars to instance prefix
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
lxd/daemon: Adds Name and Aliases support to APIEndpoint
The APIEndpoint struct has been modified as follows:

- Repurposes the Name field to represent the name of the endpoint rather than the path.
- Adds a Path field which is what the previous Name field was used for - the path template of the endpoint.
- Add an Aliases field which is contructed of APIEndpointAlias structs - allowing for a single endpoint to be exposed over multiple endpoint paths, each with a separate name.

This field naming scheme matches the concepts used in the gorilla mux router we use.

The purpose of this change is:

- To allow a single set of handler functions to be exposed at multiple URL paths.
- To allow the handler functions to access the name of the endpoint used to access the handler function. In case they need to behave differently based on which path was used (but without having to rely on examing the raw URL path which is unreliable).

The name of the endpoint can be accessed inside the handler function as follows:

 mux.CurrentRoute().GetName()

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>

@tomponline tomponline force-pushed the tomponline:tp-api-instances branch from 8802e6c to 02347ed Sep 6, 2019

lxd: Adds /1.0/instances aliases of /1.0/containers routes
 - Renames Name property to Path property for all routes
 - Renames container routes to instance prefix
 - Adds new Name property to all instance endpoints
 - Adds equivalent container alias to all instance routes

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>

@tomponline tomponline force-pushed the tomponline:tp-api-instances branch from 02347ed to e3ff0f9 Sep 6, 2019

@tomponline tomponline requested a review from stgraber Sep 6, 2019

@lxc-jenkins

This comment has been minimized.

Copy link

commented Sep 6, 2019

Testsuite passed

1 similar comment
@lxc-jenkins

This comment has been minimized.

Copy link

commented Sep 6, 2019

Testsuite passed

@tomponline tomponline referenced this pull request Sep 6, 2019

@stgraber stgraber merged commit fb854e5 into lxc:master Sep 6, 2019

5 checks passed

Branch target Branch target is correct
Details
DCO All commits signed-off
Details
Testsuite Build finished.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@tomponline tomponline deleted the tomponline:tp-api-instances branch Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.