Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
# Copyright (c) 2014 TrilioData, Inc
# All Rights Reserved
"""
FileSearch Interface (1.1 extension)
"""
from workloadmgrclient import base


class FileSearch(base.Resource):
    """A file_search describes search of files in snapshots"""

    def __repr__(self):
        return "<FileSearch: %s>" % self.id

    def delete(self):
        """Delete"""
        return self.manager.delete(self)


class FileSearchManager(base.ManagerWithFind):
    """Manage :class:`FileSearch` resources."""

    resource_class = FileSearch

    def list(self, detailed=True):
        return

    def search(
        self,
        vm_id,
        file_path,
        snapshotids=[],
        start=0,
        end=0,
        date_from=None,
        date_to=None,
    ):
        """File search"""
        body = {
            "file_search": {
                "vm_id": vm_id,
                "filepath": file_path,
                "snapshot_ids": snapshotids,
                "start": start,
                "end": end,
                "date_from": date_from,
                "date_to": date_to,
            }
        }
        return self._create("/search", body, "file_search")

    def get(self, search_id, query_string=None):
        """
        Show details of a file search
        :param search_id: The ID of the search to display.
        """
        return self._get("/search/%s" % search_id, "file_search")