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


Python ProfitBricksService.update_snapshot方法代碼示例

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


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

示例1: TestServer

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

    def test_list_snapshots(self):
        snapshots = self.snapshot.list_snapshots()

        self.assertEqual(len(snapshots), 4)
        self.assertEqual(snapshots['items'][0]['id'], snapshot_id)
        self.assertEqual(
            snapshots['items'][0]['properties']['name'],
            'Snapshot of storage X on 12.12.12 12:12:12')

        self.assertEqual(
            snapshots['items'][0]['properties']['description'],
            'description of a snapshot')

        self.assertEqual(
            snapshots['items'][0]['properties']['location'], 'de/fkb')

        self.assertEqual(
            snapshots['items'][0]['properties']['size'], 28)

    def test_get_snapshot(self):
        snapshot = self.snapshot.get_snapshot(
            snapshot_id=snapshot_id)

        self.assertEqual(snapshot['id'], snapshot_id)
        self.assertEqual(
            snapshot['properties']['name'],
            'Snapshot of storage X on 12.12.12 12:12:12')

        self.assertEqual(
            snapshot['properties']['description'],
            'description of a snapshot')

        self.assertEqual(
            snapshot['properties']['location'], 'de/fkb')

        self.assertEqual(
            snapshot['properties']['size'], 28)

    def test_delete_snapshot(self):
        snapshot = self.snapshot.delete_snapshot(
            snapshot_id=snapshot_id)

        self.assertTrue(snapshot)

    def test_update_snapshot(self):
        snapshot = self.snapshot.update_snapshot(
            snapshot_id='7df81087-5835-41c6-a10b-3e098593bbd2',
            name='New name')

        self.assertEqual(snapshot['id'], '7df81087-5835-41c6-a10b-3e098593bbd2')
        self.assertEqual(snapshot['properties']['name'], 'New name')

        self.assertEqual(
            snapshot['properties']['description'],
            'description of a snapshot - updated')

        self.assertEqual(
            snapshot['properties']['location'], 'de/fkb')

        self.assertEqual(
            snapshot['properties']['size'], 28)
開發者ID:grandvizier,項目名稱:profitbricks-sdk-python,代碼行數:68,代碼來源:test_snapshot.py

示例2: ProfitBricksService

# 需要導入模塊: from profitbricks.client import ProfitBricksService [as 別名]
# 或者: from profitbricks.client.ProfitBricksService import update_snapshot [as 別名]
* disc_virtio_hot_unplug (bool)
* disc_scsi_hot_plug (bool)
* disc_scsi_hot_unplug (bool)

"""
from profitbricks.client import ProfitBricksService

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

snapshot_id = "d084aa0a-f9ab-41d5-9316-18163bc416ef"
image = client.update_snapshot(
    snapshot_id,
    name="New name",
    description="Backup of volume XYZ",
    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,
)

"""Remove Snapshot
"""

from profitbricks.client import ProfitBricksService

snapshot_id = "7df81087-5835-41c6-a10b-3e098593bba4"

client = ProfitBricksService(username="username", password="password")
開發者ID:fbrehm,項目名稱:profitbricks-sdk-python,代碼行數:33,代碼來源:snapshot_examples.py


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