예제 #1
0
    def update(self, zone, api_url=None, username=None, password=None,
               weight_offset=None, weight_scale=None):
        """
        Update the name or the api_url for a zone.

        :param zone: The :class:`Zone` (or its ID) to update.
        :param api_url: Update the API URL.
        :param username: Update the username.
        :param password: Update the password.
        :param weight_offset: Update the child zone's weight offset.
        :param weight_scale: Update the child zone's weight scale.
        """

        body = {"zone": {}}
        if api_url:
            body["zone"]["api_url"] = api_url
        if username:
            body["zone"]["username"] = username
        if password:
            body["zone"]["password"] = password
        if weight_offset:
            body["zone"]["weight_offset"] = weight_offset
        if weight_scale:
            body["zone"]["weight_scale"] = weight_scale
        if not len(body["zone"]):
            return
        self._update("/zones/%s" % base.getid(zone), body)
예제 #2
0
    def get(self, zone):
        """
        Get a child zone.

        :param server: ID of the :class:`Zone` to get.
        :rtype: :class:`Zone`
        """
        return self._get("/zones/%s" % base.getid(zone), "zone")
예제 #3
0
 def delete(self, zone):
     """
     Delete a child zone.
     """
     self._delete("/zones/%s" % base.getid(zone))