示例#1
0
文件: domains.py 项目: abg/vaporize
    def get(cls, id, records=False, subdomains=False):
        """Retrieve a Domain using an ID.

        :param records: Include the Domain's Records in the result
        :type records: bool
        :param subdomains: Include the Domain's Subdomainsi n the result
        :type subdomains: bool
        :returns: A Domain with the specified ID.
        :rtype: :class:`Domain`

        .. versionadded:: 0.1
        """
        url = '/'.join([get_url('clouddns'), 'domains', str(id)])
        if records is True:
            url = query(url, showRecords='true')
        if subdomains is True:
            url = query(url, showSubdomains='true')
        return handle_request('get', url, wrapper=cls)
示例#2
0
文件: domains.py 项目: abg/vaporize
    def list(cls, limit=None, offset=None, filter=None):
        """List of Domains.

        :param limit: Limit the number of results returned
        :type limit: int
        :param offset: Offset the result set by a certain amount
        :type offset: int
        :param filter: Filter results by a domain name
        :type filter: str
        :returns: A list of Domains
        :rtype: A list of :class:`Domain`

        .. versionadded:: 0.1
        """
        url = [get_url('clouddns'), 'domains']
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        if filter is not None:
            url = query(url, name=filter)
        return handle_request('get', url, wrapper=cls, container='domains')
示例#3
0
文件: domains.py 项目: abg/vaporize
    def changes(self, since):
        """Returns a list of CloudDNS changes for this domain.

        :param since: A datetime as a starting point.
        :type since: str or datetime
        :returns: A list of Changes
        :rtype: A list of :class:`Change`

        .. versionadded:: 0.1
        """
        assert 'id' in self
        url = '/'.join([get_url('clouddns'), 'domains', str(self['id']),
                        'changes'])
        url = query(url, since=str(since))
        return handle_request('get', url, wrapper=Change, container='changes')
示例#4
0
    def list(cls, limit=None, offset=None):
        """Lists information for all available flavors.

        This operation lists information for all available flavors.

        :param limit: Limit the result set by a number
        :type limit: int
        :param offset: Offset the result set by a number
        :type offset: int
        :returns: A list of CloudDatabases Flavors.
        :rtype: list of :class:`Flavor`

        .. versionadded:: 0.2
        """
        url = '/'.join([get_url('clouddatabases'), 'flavors'])
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=cls, container='flavors')
示例#5
0
文件: domains.py 项目: abg/vaporize
    def delete(self, subdomains=False):
        """Delete this Domain.

        .. warning::

            There is no confirmation step to this operation. Deleting this
            domain is permanent. If in doubt you can export a copy of the DNS
            zone (:func:`vaporize.domains.Domain.export_zone`) before deleting.

        :param subdomains: Delete this Domain's Subdomains (optional)
        :type subdomains: bool

        .. versionadded:: 0.1
        """
        assert 'id' in self
        url = '/'.join([get_url('clouddns'), 'domains', str(self['id'])])
        url = query(url, deleteSubdomains=subdomains)
        handle_request('delete', url)
示例#6
0
    def list(cls, limit=None, offset=None, detail=False):
        """
        List of CloudNextGenServer NextGenServers

        :param limit: Limit the result set to a certain number
        :type limit: int
        :param offset: Offset the result set by a certain number
        :type offset: int
        :returns: A list of CloudNextGenServers NextGenServers.
        :rtype: List of :class:`NextGenServer`

        .. versionadded:: 0.3
        """
        url = [get_url('cloudserversopenstack'), 'servers']
        if detail:
            url.append(detail)
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=cls, container='servers')
示例#7
0
    def list(cls, limit=None, offset=None, detail=False):
        """Returns a list of CloudNextGenServers NextGenImages.

        :param limit: Limit the result set by a cetain number
        :type limit: int
        :param offset: Offset the result set by a certain number
        :type offset: int
        :param detail: Return additional details about each NextGenImage
        :type detail: bool
        :returns: A list of CloudNextGenServers NextGenImages.
        :rtype: A list of :class:`NextGenImage`

        .. versionadded:: 0.3
        """
        url = [get_url('cloudserversopenstack'), 'images']
        if detail:
            url.append('detail')
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=NextGenImage, container='images')
示例#8
0
    def list(cls, limit=None, offset=None, detail=False):
        """Returns a list of Flavors.

        :param limit: Limit the result set by a number
        :type limit: int
        :param offset: Offset the result set by a number
        :type offset: int
        :param detail: Return additional details about each Flavor
        :type: bool
        :returns: A list of CloudServers Flavors.
        :rtype: :class:`Flavor`

        .. versionadded:: 0.1
        """
        url = [get_url('cloudservers'), 'flavors']
        if detail:
            url.append('detail')
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=cls, container='flavors')
示例#9
0
    def list(cls, limit=None, offset=None, detail=False):
        """Returns a list of Shared IP Groups.

        :param limit: Limit the result set by a certain number
        :type limit: int
        :param offset: Offset the result set by a certain number
        :type offset: int
        :param detail: Return additional details about each Shared IP Group
        :type detail: bool
        :returns: A list of Shared IP Groups.
        :rtype: A list of :class:`SharedIPGroup`

        .. versionadded:: 0.1
        """
        url = [get_url('cloudservers'), 'shared_ip_groups']
        if detail:
            url.append('detail')
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=cls,
                              container='sharedIpGroups')
示例#10
0
    def list(cls, limit=None, offset=None, detail=False):
        """
        List of CloudServer Servers

        :param limit: Limit the result set to a certain number
        :type limit: int
        :param offset: Offset the result set by a certain number
        :type offset: int
        :param detail: Return detailed information about each Server
        :type detail: bool
        :returns: A list of CloudServers Servers.
        :rtype: List of :class:`Server`

        .. versionadded:: 0.1
        """
        url = [get_url('cloudservers'), 'servers']
        if detail:
            url.append('detail')
        url = '/'.join(url)
        if limit is not None or offset is not None:
            url = query(url, limit=limit, offset=offset)
        return handle_request('get', url, wrapper=cls, container='servers')