How to use the schema.vcd.v1_5.schemas.vcloud.taskType.parseString function in schema

To help you get started, we’ve selected a few schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vmware / pyvcloud / pyvcloud / vclouddirector.py View on Github external
def delete_disk(self, id):
        link = filter(lambda link: link.get_href().endswith(id), self.get_diskRefs())
        if len(link)>0:
            response = requests.delete(link[0].get_href(), headers=self.headers)
            if response.status_code == requests.codes.accepted:
                task = taskType.parseString(response.content, True)
                return (True, task)            
            else:
                return(False, response.content)
        else:
            return(False, 'disk not found')
github vmware / pyvcloud / pyvcloud / gateway.py View on Github external
headers = dict(self.headers)
        headers['Accept'] = 'application/*+xml;version={0}'.format(api_version)
        href = self.me.get_href() + '/action/manageExternalIpAddresses'
        body = """
        
        
            {0}
        
        
        """.format(ip_address)

        self.response = Http.put(href, data=body, headers=headers,
                                 verify=self.verify, logger=self.logger)
        if self.response.status_code == requests.codes.ok:
            task = taskType.parseString(self.response.content, True)
            return task
github vmware / pyvcloud / pyvcloud / vapp.py View on Github external
networkConnectionSection.export(
                        output,
                        0,
                        name_='NetworkConnectionSection',
                        namespacedef_='xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmw="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"',
                        pretty_print=True)
                    body = output.getvalue().replace("vmw:Info", "ovf:Info")
                    self.response = Http.put(
                        vm.get_href() +
                        "/networkConnectionSection/",
                        data=body,
                        headers=self.headers,
                        verify=self.verify,
                        logger=self.logger)
                    if self.response.status_code == requests.codes.accepted:
                        return taskType.parseString(
                            self.response.content, True)
        task = TaskType()
        task.set_status("success")
        task.set_Progress("100")
        return task
github vmware / pyvcloud / pyvcloud / vapp.py View on Github external
"").replace(
                    'Info xmlns:vmw="http://www.vmware.com/vcloud/v1.5" msgid=""',
                    "ovf:Info"). replace(
                    "/Info",
                    "/ovf:Info")
                headers = self.headers
                headers[
                    'Content-type'] = 'application/vnd.vmware.vcloud.guestcustomizationsection+xml'
                self.response = Http.put(
                    vms[0].get_href() + '/guestCustomizationSection/',
                    data=body,
                    headers=headers,
                    verify=self.verify,
                    logger=self.logger)
                if self.response.status_code == requests.codes.accepted:
                    return taskType.parseString(self.response.content, True)
                else:
                    Log.debug(
                        self.logger, "failed; response status=%d, content=%s" %
                        (self.response.status_code, self.response.text))
github vmware / pyvcloud / pyvcloud / vclouddirector.py View on Github external
def get_task(self, task, mode=None):
        response = requests.get(task.get_href(), headers = self.headers)
        if response.status_code == requests.codes.ok:
            task = taskType.parseString(response.content, True)
            if mode == "json":
                print ghf.task_json(response.content)
            else:
                if mode == "table":
                    print ghf.task_table(response.content)
                else:
                    pass
            return (True, task)                            
        else:
            ghf.print_xml_error(response.content, args["--json"])                    
            return (False, None)
github vmware / pyvcloud / pyvcloud / gateway.py View on Github external
headers = dict(self.headers)
        headers['Accept'] = 'application/*+xml;version={0}'.format(api_version)
        href = self.me.get_href() + '/action/manageExternalIpAddresses'
        body = """
        
        
            1
        
        
        """

        self.response = Http.put(href, data=body, headers=headers,
                                 verify=self.verify, logger=self.logger)
        if self.response.status_code == requests.codes.ok:
            task = taskType.parseString(self.response.content, True)
            return task
github vmware / pyvcloud / pyvcloud / vapp.py View on Github external
networkConnectionSection.export(
                        output,
                        0,
                        name_='NetworkConnectionSection',
                        namespacedef_='xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmw="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"',
                        pretty_print=True)
                    body = output.getvalue().replace("vmw:Info", "ovf:Info")
                    self.response = Http.put(
                        vm.get_href() +
                        "/networkConnectionSection/",
                        data=body,
                        headers=self.headers,
                        verify=self.verify,
                        logger=self.logger)
                    if self.response.status_code == requests.codes.accepted:
                        return taskType.parseString(
                            self.response.content, True)
        task = TaskType()
        task.set_status("success")
        task.set_Progress("100")
        return task
github vmware / pyvcloud / pyvcloud / vapp.py View on Github external
namespacedef_='xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmw="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"',
                    pretty_print=True)
                link = filter(
                    lambda link: link.get_rel() == 'edit',
                    networkConnectionSection.get_Link())
                body = output.getvalue().replace("vmw:Info", "ovf:Info")
                headers = self.headers
                headers['Content-type'] = link[0].get_type()
                self.response = Http.put(
                    link[0].get_href(),
                    data=body,
                    headers=headers,
                    verify=self.verify,
                    logger=self.logger)
                if self.response.status_code == requests.codes.accepted:
                    return taskType.parseString(self.response.content, True)
                else:
                    raise Exception(self.response.status_code)

        raise Exception('can\'t find vm')