Why not adopt me?
NAME
VMware::vCloudDirector2::Object - Module to contain an object!
VERSION
version 0.108
Attributes
api
A weak link to the API object to be used.
content
The object content. This is in a separate container so that partial objects passed can be inflated at a later stage without having to replace the object itself.
hash
A reference to the hash returned from the vCloud API. Forces object inflation.
links
Returns VMware::vCloudDirector2::Link objects for each of the JSON targetted links contained in this object. Forces object inflation.
all_links
Returns VMware::vCloudDirector2::Link objects for each of the links contained in this object. Will typically return two links per thing - one to the XML version, one to the JSON version. Forces object inflation.
id
The id attribute from the returned vCloud JSON. Forces object inflation.
is_admin_object
This determines, based on the href path, whether or not this is an admin object.
Methods
inflate
If this object is a partial object (ie taken from a link or partial chunk within a containing object), then this forces a refetch of the content from vCloud creating a fully populated object.
refetch
Forces a refetch of this object's content unconditionally.
find_links
Returns any links found that match the search criteria. The possible criteria are:-
- name
-
The name of the link
- type
-
The type of the link (short type, not full MIME type)
- rel
-
The rel of the link
The return value is a list of link objects.
find_link
Finds and returns one link that matches the search criteria, exactly as find_links, except that if no links are found an exception is thrown. If multiple links match then the first one returned (normally the first one back from the API) would be returned.
The return value is a single link object.
fetch_link
As per "find_link" except that the link found is fetched and expanded up as an object.
fetch_links
As per "find_links" except that each link found is fetched and expanded up as an object.
build_sub_objects
Given a type (specifically a key used within the current object hash), grabs the descendants of that key and instantiates them as partial objects (they can then be inflated into full objects).
build_sub_sub_objects
Similar to build_sub_objects, but builds objects from two levels down.
build_children_objects
Similar to build_sub_objects, but builds objects from within a children hash
DELETE
Make a delete request to the URL in this link. Returns Objects. Failure will generate an exception. See "DELETE" in VMware::vCloudDirector2::API.
GET
Make a get request to the URL in this link. Returns Objects. Failure will generate an exception. See "GET" in VMware::vCloudDirector2::API.
GET_hash
Make a get request to the URL in this link. Returns a decoded hash. Failure will generate an exception. See "GET_hash" in VMware::vCloudDirector2::API.
POST
Make a post request with the specified payload to the URL in this link. Returns Objects. Failure will generate an exception. See "POST" in VMware::vCloudDirector2::API.
PUT
Make a put request with the specified payload to the URL in this link. Returns Objects. Failure will generate an exception. See "PUT" in VMware::vCloudDirector2::API.
fetch_admin_object
If this is already an admin object (ie is_admin_object
is true), then this object is returned.
Otherwise, the path is modified to point to the admin API object and the object is fetched. Since this only exists for a subset of objects there is a reasonable chance that just attempting this will lead to an exception being thrown due to a non-existant object being requested.
AUTHOR
Nigel Metheringham <nigelm@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Nigel Metheringham.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.