def __init__(self, name, action, kind): validate_privilege_kind(kind) self._config = {} self._config['privilege-name'] = name self._config['action'] = action self.the_kind = kind self.etag = None
def set_kind(self, kind): """ Set the action URI of the privilege. :return: The privilege object """ validate_privilege_kind(kind) self.the_kind = kind return self
def unmarshal(cls, config): """ Construct a new Privilege from a flat structure. This method is principally used to construct an object from a Management API payload. The configuration passed in is largely assumed to be valid. :param: config: A hash of properties :return: A newly constructed Privilege object with the specified properties. """ kind = config['kind'] validate_privilege_kind(kind) result = Privilege("temp", "http://example.com/", kind) result._config = config result.the_kind = kind return result