コード例 #1
0
    def delete(self, domainId, recordId):
        """
        Delete a specific record.

        :param domainId: The ID of the :class:`Domain` to delete.
        :param recordId: The ID of the :class:`Record` to delete.
        """
        self._delete("/domains/%s/records/%s" % (base.getid(domainId), base.getid(recordId)))
コード例 #2
0
    def delete(self, domainId, recordId):
        """
        Delete a specific record.

        :param domainId: The ID of the :class:`Domain` to delete.
        :param recordId: The ID of the :class:`Record` to delete.
        """
        self._delete("/domains/%s/records/%s" %
                     (base.getid(domainId), base.getid(recordId)))
コード例 #3
0
    def modify(self, args, domainId):
        """
        Modify a record in the dns system.  The following parameters are
        required recordId and name.
        
        :param record_id: str
        :param domain: str
        :param name: str
        :param ttl: int
        :param data: str
        :param priority: int
        :param comment: str
        
        :rtype: list of :class:`Record`
        """

        body = {
            "name": args.name,
            "comment": args.comment,
            "ttl": int(args.ttl),
            "data": args.data,
            "priority": args.priority
        }
        url = '/domains/%s/records/%s' % (base.getid(domainId),
                                          base.getid(args.record_id))

        if hasattr(args, 'type'):
            if args.type == "PTR":
                url = '/rdns'
                body = {
                    "recordsList": {
                        "records": [{
                            "name": args.name,
                            "id": args.record_id,
                            "comment": args.comment,
                            "ttl": int(args.ttl),
                            "type": args.type,
                            "data": args.data
                        }]
                    },
                    "link": {
                        "content": "",
                        "href": args.server_href,
                        "rel": "cloudServersOpenStack"
                    }
                }

        return self._update(url, body, return_raw=False, response_key="")
コード例 #4
0
    def list(self, domainId):
        """
        Get a list of all records for the domain.

        :rtype: list of :class:`Record`.
        """
        return self._list("/domains/%s/records" % base.getid(domainId), "records")
コード例 #5
0
    def delete(self, domain):
        """
        Delete a specific domain.

        :param domain: The ID of the :class:`Domain` to delete.
        """
        self._delete("/domains/%s" % base.getid(domain))
コード例 #6
0
    def subdomains_list(self, domainId):
        """
        Get a list of all subdomains.

        :rtype: list of :class:`Domain`.
        """
        return self._list("/domains/%s/subdomains" % base.getid(domainId), "domains")
コード例 #7
0
    def delete(self, domain):
        """
        Delete a specific domain.

        :param domain: The ID of the :class:`Domain` to delete.
        """
        self._delete("/domains/%s" % base.getid(domain))
コード例 #8
0
 def export(self, domain):
     """
     Export a specific domain.
     
     :param domain: The ID of the :class:`Domain` to get.
     :rtype: :class:`Domain`
     """
     return self._get_async("/domains/%s/export" % base.getid(domain), "")
コード例 #9
0
    def get(self, domain):
        """
        Get a specific domain.

        :param domain: The ID of the :class:`Domain` to get.
        :rtype: :class:`Domain`
        """
        return self._get("/domains/%s" % base.getid(domain), "")
コード例 #10
0
    def list(self, domainId):
        """
        Get a list of all records for the domain.

        :rtype: list of :class:`Record`.
        """
        return self._list("/domains/%s/records" % base.getid(domainId),
                          "records")
コード例 #11
0
 def export(self, domain):
     """
     Export a specific domain.
     
     :param domain: The ID of the :class:`Domain` to get.
     :rtype: :class:`Domain`
     """
     return self._get_async("/domains/%s/export" % base.getid(domain), "")
コード例 #12
0
    def get(self, domain):
        """
        Get a specific domain.

        :param domain: The ID of the :class:`Domain` to get.
        :rtype: :class:`Domain`
        """
        return self._get("/domains/%s" % base.getid(domain), "")
コード例 #13
0
    def subdomains_list(self, domainId):
        """
        Get a list of all subdomains.

        :rtype: list of :class:`Domain`.
        """
        return self._list("/domains/%s/subdomains" % base.getid(domainId),
                          "domains")
コード例 #14
0
    def modify(self, args, domainId):
        """
        Modify a record in the dns system.  The following parameters are
        required recordId and name.
        
        :param record_id: str
        :param domain: str
        :param name: str
        :param ttl: int
        :param data: str
        :param priority: int
        :param comment: str
        
        :rtype: list of :class:`Record`
        """

        body = {
            "name": args.name,
            "comment": args.comment,
            "ttl": int(args.ttl),
            "data": args.data,
            "priority": args.priority,
        }
        url = "/domains/%s/records/%s" % (base.getid(domainId), base.getid(args.record_id))

        if hasattr(args, "type"):
            if args.type == "PTR":
                url = "/rdns"
                body = {
                    "recordsList": {
                        "records": [
                            {
                                "name": args.name,
                                "id": args.record_id,
                                "comment": args.comment,
                                "ttl": int(args.ttl),
                                "type": args.type,
                                "data": args.data,
                            }
                        ]
                    },
                    "link": {"content": "", "href": args.server_href, "rel": "cloudServersOpenStack"},
                }

        return self._update(url, body, return_raw=False, response_key="")
コード例 #15
0
    def modify(self, args, domainId):
        """
        Modify a domain in the dns system.  The following parameters are
        optional, except for name.
        
        :param name: str
        :param email_address: str
        :param ttl: int
        :param comment: str
        
        :rtype: list of :class:`Domain`
        """

        body = {"comment": args.comment, "ttl": int(args.ttl), "emailAddress": args.email_address}
        return self._update("/domains/%s" % base.getid(domainId), body, return_raw=False, response_key="")
コード例 #16
0
    def create(self, args, domainId):
        """
        Create a record in the dns system.  The following parameters are
        required type, name, data.
        
        :param type: str
        :param name: str
        :param ttl: int
        :param data: str
        :param priority: int
        :param comment: str
        
        :rtype: list of :class:`Record`
        """

        body = {
            "records": [{
                "name": args.name,
                "comment": args.comment,
                "ttl": int(args.ttl),
                "type": args.type,
                "data": args.data,
                "priority": args.priority
            }]
        }
        url = '/domains/%s/records' % base.getid(domainId)

        if args.type == "PTR":
            url = '/rdns'
            body = {
                "recordsList": {
                    "records": [{
                        "name": args.name,
                        "comment": args.comment,
                        "ttl": int(args.ttl),
                        "type": args.type,
                        "data": args.data
                    }]
                },
                "link": {
                    "content": "",
                    "href": args.server_href,
                    "rel": "cloudServersOpenStack"
                }
            }

        return self._create_async(url, body, return_raw=False, response_key="")
コード例 #17
0
    def create(self, args, domainId):
        """
        Create a record in the dns system.  The following parameters are
        required type, name, data.
        
        :param type: str
        :param name: str
        :param ttl: int
        :param data: str
        :param priority: int
        :param comment: str
        
        :rtype: list of :class:`Record`
        """

        body = {
            "records": [
                {
                    "name": args.name,
                    "comment": args.comment,
                    "ttl": int(args.ttl),
                    "type": args.type,
                    "data": args.data,
                    "priority": args.priority,
                }
            ]
        }
        url = "/domains/%s/records" % base.getid(domainId)

        if args.type == "PTR":
            url = "/rdns"
            body = {
                "recordsList": {
                    "records": [
                        {
                            "name": args.name,
                            "comment": args.comment,
                            "ttl": int(args.ttl),
                            "type": args.type,
                            "data": args.data,
                        }
                    ]
                },
                "link": {"content": "", "href": args.server_href, "rel": "cloudServersOpenStack"},
            }

        return self._create_async(url, body, return_raw=False, response_key="")
コード例 #18
0
    def modify(self, args, domainId):
        """
        Modify a domain in the dns system.  The following parameters are
        optional, except for name.
        
        :param name: str
        :param email_address: str
        :param ttl: int
        :param comment: str
        
        :rtype: list of :class:`Domain`
        """

        body = {
            "comment": args.comment,
            "ttl": int(args.ttl),
            "emailAddress": args.email_address
        }
        return self._update('/domains/%s' % base.getid(domainId),
                            body,
                            return_raw=False,
                            response_key="")