当前位置: 首页>>代码示例>>Python>>正文


Python Http.delete方法代码示例

本文整理汇总了Python中pyvcloud.Http.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Http.delete方法的具体用法?Python Http.delete怎么用?Python Http.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.Http的用法示例。


在下文中一共展示了Http.delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_catalog

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete_catalog(self, catalog_name):
     admin_url = None
     if not self.vcloud_session or not self.vcloud_session.organization: return False
     if 'ondemand' == self.service_type:
         refs = filter(lambda ref: ref.type_ == 'application/vnd.vmware.admin.organization+xml',
                              self.vcloud_session.organization.Link)
         if len(refs) == 1:
             admin_url = refs[0].href
     else:
         refs = filter(lambda ref: ref.type_ == 'application/vnd.vmware.admin.catalog+xml',
                              self.vcloud_session.organization.Link)
         if len(refs) == 1:
             admin_url = refs[0].href[:refs[0].href.rindex('/')]
     if admin_url:
         self.response = Http.get(admin_url, headers=self.vcloud_session.get_vcloud_headers(), verify=self.verify, logger=self.logger)
         if self.response.status_code == requests.codes.ok:
             adminOrg = vCloudEntities.parseString(self.response.content, True)
             if adminOrg and adminOrg.Catalogs and adminOrg.Catalogs.CatalogReference:
                 catRefs = filter(lambda ref: ref.name == catalog_name and ref.type_ == 'application/vnd.vmware.admin.catalog+xml',
                                         adminOrg.Catalogs.CatalogReference)
                 if len(catRefs) == 1:
                     self.response = Http.delete(catRefs[0].href, headers=self.vcloud_session.get_vcloud_headers(), verify=self.verify, logger=self.logger)
                     if self.response.status_code == requests.codes.no_content:
                         return True
     return False
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:27,代码来源:vcloudair.py

示例2: delete

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete(self, blueprint_id):
     self.score.response = Http.delete(self.score.url +
                                       '/blueprints/%s' % blueprint_id,
                                       headers=self.score.get_headers(),
                                       verify=self.score.verify,
                                       logger=self.logger)
     if self.score.response.status_code != requests.codes.ok:
         raise exceptions.from_response(self.score.response)
     return json.loads(self.score.response.content)
开发者ID:digideskio,项目名称:pyvcloud,代码行数:11,代码来源:score.py

示例3: delete_catalog_item

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete_catalog_item(self, catalog_name, item_name):
     for catalog in self.get_catalogs():
         if catalog.CatalogItems and catalog.CatalogItems.CatalogItem:
             for item in catalog.CatalogItems.CatalogItem:
                 if item_name == item.name:
                     self.response = Http.delete(item.href, headers=self.vcloud_session.get_vcloud_headers(), verify=self.verify, logger=self.logger)
                     if self.response.status_code == requests.codes.no_content:
                         return True
     return False
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:11,代码来源:vcloudair.py

示例4: delete_vdc_network

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete_vdc_network(self, vdc_name, network_name):
     netref = self.get_admin_network_href(vdc_name, network_name)
     if netref is None:
         return (False, 'network not found')
     self.response = Http.delete(netref, headers=self.vcloud_session.get_vcloud_headers(), verify=self.verify, logger=self.logger)
     if self.response.status_code == requests.codes.accepted:
         task = taskType.parseString(self.response.content, True)
         return (True, task)
     else:
         return (False, self.response.content)
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:12,代码来源:vcloudair.py

示例5: delete_disk

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete_disk(self, vdc_name, name, id=None):
     vdc = self.get_vdc(vdc_name)
     refs = self.get_diskRefs(vdc)
     link = []
     if id is not None:
         link = filter(lambda link: link.get_href().endswith('/'+id), refs)
     elif name is not None:
         link = filter(lambda link: link.get_name() == name, refs)
     if len(link) == 1:
         self.response = Http.delete(link[0].get_href(), headers=self.vcloud_session.get_vcloud_headers(), verify=self.verify, logger=self.logger)
         if self.response.status_code == requests.codes.accepted:
             task = taskType.parseString(self.response.content, True)
             return (True, task)
         else:
             return(False, self.response.content)
     elif len(link) == 0:
         return(False, 'disk not found')
     elif len(link) > 1:
         return(False, 'more than one disks found with that name, use the disk id')
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:21,代码来源:vcloudair.py

示例6: execute

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
    def execute(self, operation, http, body=None, targetVM=None):
        """
        Execute an operation against a VM as an Asychronous Task.

        :param operation: (str): The command to execute
        :param http: (str): The http operation.
        :param body: (str, optional): a body for the http request
        :param targetVM: (str, optional): The name of the VM that will be the target of the request.
        :return: (TaskType or Bool) a :class:`pyvcloud.schema.vcd.v1_5.schemas.admin.vCloudEntities.TaskType` object that can be used to monitor the request. \n
                Or False if the request failed, error and debug level messages are logged.

        """
        vApp = targetVM if targetVM else self.me
        link = filter(lambda link: link.get_rel() == operation, vApp.get_Link())
        if not link:
            Log.error(self.logger, "link not found; rel=%s" % operation)
            Log.debug(self.logger, "vApp href=%s, name=%s" % (vApp.get_href(), vApp.get_name()))
            return False
        else:
            if http == "post":
                headers = self.headers
                if body and body.startswith('<DeployVAppParams '):
                    headers['Content-type'] = 'application/vnd.vmware.vcloud.deployVAppParams+xml'
                elif body and body.startswith('<UndeployVAppParams '):
                    headers['Content-type'] = 'application/vnd.vmware.vcloud.undeployVAppParams+xml'
                elif body and body.startswith('<CreateSnapshotParams '):
                    headers['Content-type'] = 'application/vnd.vmware.vcloud.createSnapshotParams+xml'
                self.response = Http.post(link[0].get_href(), data=body, headers=headers, verify=self.verify, logger=self.logger)
            elif http == "put":
                self.response = Http.put(link[0].get_href(), data=body, headers=self.headers, verify=self.verify, logger=self.logger)
            else:
                self.response = Http.delete(link[0].get_href(), headers=self.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))
                return False
开发者ID:kostya13,项目名称:pyvcloud,代码行数:39,代码来源:vapp.py

示例7: execute

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def execute(self, operation, http, body=None, targetVM=None):
     vApp = targetVM if targetVM else self.me
     link = filter(lambda link: link.get_rel() == operation, vApp.get_Link())
     if not link:
         Log.error(self.logger, "link not found; rel=%s" % operation)
         Log.debug(self.logger, "vApp href=%s, name=%s" % (vApp.get_href(), vApp.get_name()))
         return False
     else:
         if http == "post":
             headers = self.headers
             if body and body.startswith('<DeployVAppParams '):
                 headers['Content-type'] = 'application/vnd.vmware.vcloud.deployVAppParams+xml'
             elif body and body.startswith('<UndeployVAppParams '):
                 headers['Content-type'] = 'application/vnd.vmware.vcloud.undeployVAppParams+xml'
             self.response = Http.post(link[0].get_href(), data = body, headers=headers, verify=self.verify, logger=self.logger)
         elif http == "put":
             self.response = Http.put(link[0].get_href(), data = body, headers=self.headers, verify=self.verify, logger=self.logger)
         else:
             self.response = Http.delete(link[0].get_href(), headers=self.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, response.text))
             return False
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:26,代码来源:vapp.py

示例8: delete

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete(self, blueprint_id):
     self.score.response = Http.delete(self.score.url + '/blueprints/{0}'.format(blueprint_id), headers=self.score.get_headers(), verify=self.score.verify, logger=self.logger)
     if self.score.response.status_code == requests.codes.ok:
         return json.loads(self.score.response.content)
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:6,代码来源:score.py

示例9: delete_instance

# 需要导入模块: from pyvcloud import Http [as 别名]
# 或者: from pyvcloud.Http import delete [as 别名]
 def delete_instance(self, instance):
     self.response = Http.delete(self.host + "/api/sc/instances/" + instance, headers=self._get_vcloud_headers(), verify=self.verify, logger=self.logger)
     print self.response.status_code, self.response.content
开发者ID:nmishkin,项目名称:pyvcloud,代码行数:5,代码来源:vcloudair.py


注:本文中的pyvcloud.Http.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。