Change in ovirt-engine-sdk-ruby[master]: Add "is_link" attribute
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Mon Jan 18 18:35:17 UTC 2016
Juan Hernandez has submitted this change and it was merged.
Change subject: Add "is_link" attribute
......................................................................
Add "is_link" attribute
This patch adds a new "is_link" attribute to struct and list types. This
attribute indicates if the object is used as a link or as a normal
object. When an object is used as a link the server will only populate
the identifier and "href" attributes. For example, in the specification
of the virtual machine type the "cluster" attribute is defined as a
link:
@Type
interface VmBase extends Identified {
...
@Link Cluster cluster();
...
}
This means that the server won't return the complete entity, but just
the identifier and the "href" attributes:
<vm ...>
...
<cluster id="123" href=".../clusters/123"/>
...
</vm>
The Ruby SDK will mark these uses of the objects, using the "is_link"
flag, so that the users of the SDK can decide, based on the value of
this flag, if furhter loading is needed:
# Get the VM:
vm = ...
# Check if the cluster is a link, in which case we need to
# load its complete representation explicitly:
if vm.cluster.is_link?
vm.cluster = clusters_service.get({:id => vm.cluster.id})
end
Change-Id: Ifac0d857942e8ca32a2fa5fb24d845a79c4380a7
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M generator/src/main/java/org/ovirt/sdk/ruby/ReadersGenerator.java
M sdk/lib/ovirt/sdk/v4/types/list.rb
M sdk/lib/ovirt/sdk/v4/types/struct.rb
M sdk/spec/vm_reader_spec.rb
4 files changed, 93 insertions(+), 9 deletions(-)
Approvals:
Juan Hernandez: Verified; Looks good to me, approved
Jenkins CI: Passed CI tests
--
To view, visit https://gerrit.ovirt.org/52350
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifac0d857942e8ca32a2fa5fb24d845a79c4380a7
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine-sdk-ruby
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
More information about the Engine-commits
mailing list