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

[GOCA] externalize client and modify the way to access to the resources (warning: breaking changes ) #2940

Closed
7 tasks
treywelsh opened this issue Feb 14, 2019 · 2 comments

Comments

@treywelsh
Copy link
Contributor

treywelsh commented Feb 14, 2019

Description
This pull request make some changes on the client, and the whole API.
/!\ It's an important breaking change /!\

As this imply breaking changes, I added some documentation (PR in the docs repository, and added some examples)

  1. This pull request adds a controller notion.
    It's a cheap layer added between the client and the entities API (host, vm ...).
    It allows to rework the way to access to the resources via the API in a way that seems more intuitive to use.

For instance, to make requests, now, it's like this:

vm, err := ctrl.VM(id).Info()                              // Retrieve VM informations
err := ctrl.VM(id).Delete()                                // Delete a VM
err := ctrl.VMs().Create(template, boolean)    // Create a VM
vms, err := ctrl.VMs().Info()                            // Retrieve a list of VM informations (with less informations per instance)
id, err := ctrl.ByName("vm_name")            // Retrieve an ID by name
  1. The controller embed a client:
    this pull request also externalize the client and allow to redefine it (For instance you may want to define a pool of clients to enabling some concurrency, or make a client that retry if the request fails ... ).
    If the RPCCaller interface is implemented, the controller can use the external client.

  2. By the way, I also added some other changes/fixes breaking the API:

    • lock part to be more maintainable, add added some missing methods
    • change parameters of some methods: permissions for chmod, typed parameter for Update methods
    • ID are signed integers

Use case
Users of GOCA may want more flexibility on the client, and a more natural way to access the resources

Interface Changes
A great part of the API change.

Additional Context
I will provide a pull request in this way.

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches
@treywelsh treywelsh changed the title [GOCA] externalize client and add flexibility on it [GOCA] externalize client and modify the way to access to the resources Feb 28, 2019
@treywelsh treywelsh changed the title [GOCA] externalize client and modify the way to access to the resources [GOCA] externalize client and modify the way to access to the resources (warning: breaking changes ) Mar 1, 2019
@eripa
Copy link
Contributor

eripa commented Apr 6, 2019

This is a very useful improvement. Any feedback from the OpenNebula team whether or not this is something that will be merged?

@treywelsh
Copy link
Contributor Author

treywelsh commented Apr 6, 2019

Thank you very much for your feedback :)
It's not perfect, but it proposes some changes that we need.

I discuss with the OpenNebula team member in charge of the Go binding, he seems busy, but as far as I know, it's being reviewed. In addition, some other pull requests have been merged these days.

tinova pushed a commit that referenced this issue Jul 11, 2019
 modify the way to access to the resources (Warning: breaking change)


* F #2940: GOCA - add controller

 - API refactored
 - Client externalized
 - Migrate entities and related tests.

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - remove EndpointCall method

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2772: GOCA - Add http config and update dep

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - add examples

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - replace lock methods by values

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - remove snake case

Signed-off-by: Pierre Lafievre <[email protected]>

* F #3209: GOCA - add vm group mapping

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2830: GOCA - rename xmlresource file

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - change update parameter type

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - permission as parameter of chmod

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2930: GOCA - split vm file

Signed-off-by: Pierre Lafievre <[email protected]>

* F #3209: GOCA - Add ACL parameters constants

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - fix id are signed integers

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2830: GOCA - export and improve consistency

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2940: GOCA - apply Go mixed cap case

Signed-off-by: Pierre Lafievre <[email protected]>

* F #3455: GOCA - split in packages

 - shorten and export struct names

Signed-off-by: Pierre Lafievre <[email protected]>

* F #2830: GOCA - fix ACL and Zone regressions

Signed-off-by: Pierre Lafievre <[email protected]>
rsmontero pushed a commit that referenced this issue Feb 14, 2024
* Gemfile.lock for Debian 12
* Add NODE_OPTIONS=--openssl-legacy-provider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants