當前位置: 首頁>>代碼示例>>Python>>正文


Python ProfitBricksService.delete_image方法代碼示例

本文整理匯總了Python中profitbricks.client.ProfitBricksService.delete_image方法的典型用法代碼示例。如果您正苦於以下問題:Python ProfitBricksService.delete_image方法的具體用法?Python ProfitBricksService.delete_image怎麽用?Python ProfitBricksService.delete_image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在profitbricks.client.ProfitBricksService的用法示例。


在下文中一共展示了ProfitBricksService.delete_image方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestImage

# 需要導入模塊: from profitbricks.client import ProfitBricksService [as 別名]
# 或者: from profitbricks.client.ProfitBricksService import delete_image [as 別名]
class TestImage(unittest.TestCase):
    def setUp(self):
        self.image = ProfitBricksService(
            username='username', password='password')

    def test_list_images(self):
        images = self.image.list_images()

        self.assertEqual(len(images), 4)
        self.assertEqual(
            images['items'][0]['id'], '7df81087-5835-41c6-a10b-3e098593bbd2')

    def test_get_image(self):
        image_id = '7df81087-5835-41c6-a10b-3e098593bbd2'
        image = self.image.get_image(image_id)

        self.assertEqual(image['properties']['name'], 'Ubuntu 14.04')

    def test_delete_image(self):
        image_id = '7df81087-5835-41c6-a10b-3e098593bbd2'

        image = self.image.delete_image(image_id)
        self.assertTrue(image)

    def test_update_image(self):
        image_id = '7df81087-5835-41c6-a10b-3e098593bbd2'
        image = self.image.update_image(
            image_id,
            name='New name')

        self.assertEqual(image['properties']['name'], 'New name')
開發者ID:grandvizier,項目名稱:profitbricks-sdk-python,代碼行數:33,代碼來源:test_image.py

示例2: ProfitBricksService

# 需要導入模塊: from profitbricks.client import ProfitBricksService [as 別名]
# 或者: from profitbricks.client.ProfitBricksService import delete_image [as 別名]
"""
from profitbricks.client import ProfitBricksService

client = ProfitBricksService(
    username='username', password='password')

image_id = '7df81087-5835-41c6-a10b-3e098593bbd2'
image = client.update_image(
    image_id,
    name='New name',
    description="Centos 7 with NGnix",
    licence_type='LINUX',
    cpu_hot_plug=True,
    ram_hot_plug=True,
    nic_hot_plug=True,
    nic_hot_unplug=True,
    disc_virtio_hot_plug=True,
    disc_virtio_hot_unplug=True)

"""Delete Image
"""
from profitbricks.client import ProfitBricksService

client = ProfitBricksService(
    username='username', password='password')

image_id = '7df81087-5835-41c6-a10b-3e098593bbd2'

image = client.delete_image(image_id)
開發者ID:fbrehm,項目名稱:profitbricks-sdk-python,代碼行數:31,代碼來源:image_examples.py


注:本文中的profitbricks.client.ProfitBricksService.delete_image方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。