Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

Set VDC metadata

$
0
0



Hi,


I can retrieve (and optionally delete) a VDC's metadata as follows:


$vdc = $service->createSDKObj($vdcRef);


$vdcinfo = $vdc->getVdc();


foreach($vdcmeta as $index => $vdcmetaentry)



{



                echo "Metadata index: " . $index . "\n";



                echo "Metadata key: " . $vdcmetaentry->getKey() . "\n";



                echo "Metadata value: " . $vdcmetaentry->getTypedValue()->getValue() . "\n";



// Uncomment to delete metadata



// $sdkAdminVdc->deleteMetadataByKey($vdcmetaentry->getKey()); 



}



Looking at the docs the process to set metadata, which similar to delete is in the class VMware_VCloud_SDK_AdminVdc:


     setMetadataByKey (string $key, VMware_VCloud_API_MetadataValueType $value, )


However $sdkAdminVdc->setMetadataByKey($vdcmetaentry->getKey(), 'hello'); results in an error.




Fatal error: Uncaught exception 'VMware_VCloud_SDK_Exception' with message 'PUT https://vdc-url/api/admin/vdc/bc68aea6-0fd5-474b-967c-938ca7238168/metadata/rate failed, error code: 400, error: <?xml version="1.0" encoding="UTF-8"?>



<Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.rest.handlers.exceptions.BadRequestRestApiException: The provided XML could not be parsed: Content is not allowed in prolog.



at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.getBadRequestApiException(ErrorHandler.java:99)



at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.errorBadRequest(ErrorHandler.java:47)



at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)



at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)



at java.lang.reflect.Method.invoke(Unknown Source)



at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)



at org.apache.cxf.service.invoker in /opt/lampp/lib/php/VMware/VCloud/ServiceAbstract.php on line 226



Can anyone advise?




Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>