Source code for models_v2.cluster

# -*- coding: utf-8 -*-

[docs]class Cluster(object): """Implementation of the 'Cluster' model. Specifies the resource (KVMH host) to which the restored VM will be attached Attributes: id (long|int): Specifies the id of the object. name (string): Specifies the name of the object. """ # Create a mapping from Model property names to API property names _names = { "id":'id', "name":'name' } def __init__(self, id=None, name=None): """Constructor for the Cluster class""" # Initialize members of the class = id = name
[docs] @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class. """ if dictionary is None: return None # Extract variables from the dictionary id = dictionary.get('id') name = dictionary.get('name') # Return an object of this model return cls(id, name)