示例#1
0
    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
示例#2
0
    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
示例#3
0
    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