# coding: utf-8

"""
    Domino Volumes for NetApp ONTAP Microservice API

    Microservice responsible for managing Domino Volumes for NetApp ONTAP feature  # noqa: E501

    OpenAPI spec version: 1.0
    Contact: support@dominodatalab.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from remotefs_api_client.api_client import ApiClient


class FilesystemsApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def filesystems_get(self, **kwargs):  # noqa: E501
        """List filesystem  # noqa: E501

        List filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_get(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int limit: Limit
        :param int offset: Offset
        :param str order: Order
        :param str search: Search
        :param str sort_by: Sort by
        :param list[str] data_plane_id: Data Plane ID
        :return: ServerPaginatedFilesystems
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.filesystems_get_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.filesystems_get_with_http_info(**kwargs)  # noqa: E501
            return data

    def filesystems_get_with_http_info(self, **kwargs):  # noqa: E501
        """List filesystem  # noqa: E501

        List filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_get_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int limit: Limit
        :param int offset: Offset
        :param str order: Order
        :param str search: Search
        :param str sort_by: Sort by
        :param list[str] data_plane_id: Data Plane ID
        :return: ServerPaginatedFilesystems
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            "limit",
            "offset",
            "order",
            "search",
            "sort_by",
            "data_plane_id",
        ]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method filesystems_get" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "limit" in params:
            query_params.append(("limit", params["limit"]))  # noqa: E501
        if "offset" in params:
            query_params.append(("offset", params["offset"]))  # noqa: E501
        if "order" in params:
            query_params.append(("order", params["order"]))  # noqa: E501
        if "search" in params:
            query_params.append(("search", params["search"]))  # noqa: E501
        if "sort_by" in params:
            query_params.append(("sort_by", params["sort_by"]))  # noqa: E501
        if "data_plane_id" in params:
            query_params.append(("data_plane_id", params["data_plane_id"]))  # noqa: E501
            collection_formats["data_plane_id"] = "multi"  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/filesystems",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="ServerPaginatedFilesystems",  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def filesystems_id_delete(self, id, **kwargs):  # noqa: E501
        """Delete filesystem by ID  # noqa: E501

        Delete a filesystem by ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_delete(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: ID of filesystem to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.filesystems_id_delete_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.filesystems_id_delete_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def filesystems_id_delete_with_http_info(self, id, **kwargs):  # noqa: E501
        """Delete filesystem by ID  # noqa: E501

        Delete a filesystem by ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_delete_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: ID of filesystem to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["id"]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method filesystems_id_delete" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'id' is set
        if "id" not in params or params["id"] is None:
            raise ValueError(
                "Missing the required parameter `id` when calling `filesystems_id_delete`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "id" in params:
            path_params["id"] = params["id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/filesystems/{id}",
            "DELETE",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def filesystems_id_get(self, id, **kwargs):  # noqa: E501
        """Get filesystem by ID  # noqa: E501

        Get filesystem by ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_get(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: ID of filesystem to retrieve (required)
        :param bool include_hostname: Whether to include the data plane host name in response
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.filesystems_id_get_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.filesystems_id_get_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def filesystems_id_get_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get filesystem by ID  # noqa: E501

        Get filesystem by ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_get_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: ID of filesystem to retrieve (required)
        :param bool include_hostname: Whether to include the data plane host name in response
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["id", "include_hostname"]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method filesystems_id_get" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'id' is set
        if "id" not in params or params["id"] is None:
            raise ValueError(
                "Missing the required parameter `id` when calling `filesystems_id_get`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "id" in params:
            path_params["id"] = params["id"]  # noqa: E501

        query_params = []
        if "include_hostname" in params:
            query_params.append(("include_hostname", params["include_hostname"]))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/filesystems/{id}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="RemotefsFilesystem",  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def filesystems_id_put(self, body, id, **kwargs):  # noqa: E501
        """Update filesystem  # noqa: E501

        Update a filesystem. Can be updated if there are volumes associated with the filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_put(body, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServerFilesystem body: Filesystem to update (required)
        :param str id: ID of filesystem to update (required)
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.filesystems_id_put_with_http_info(body, id, **kwargs)  # noqa: E501
        else:
            (data) = self.filesystems_id_put_with_http_info(body, id, **kwargs)  # noqa: E501
            return data

    def filesystems_id_put_with_http_info(self, body, id, **kwargs):  # noqa: E501
        """Update filesystem  # noqa: E501

        Update a filesystem. Can be updated if there are volumes associated with the filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_id_put_with_http_info(body, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServerFilesystem body: Filesystem to update (required)
        :param str id: ID of filesystem to update (required)
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["body", "id"]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method filesystems_id_put" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'body' is set
        if "body" not in params or params["body"] is None:
            raise ValueError(
                "Missing the required parameter `body` when calling `filesystems_id_put`"
            )  # noqa: E501
        # verify the required parameter 'id' is set
        if "id" not in params or params["id"] is None:
            raise ValueError(
                "Missing the required parameter `id` when calling `filesystems_id_put`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "id" in params:
            path_params["id"] = params["id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "body" in params:
            body_params = params["body"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/filesystems/{id}",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="RemotefsFilesystem",  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def filesystems_post(self, body, **kwargs):  # noqa: E501
        """Create new filesystem  # noqa: E501

        Create new filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_post(body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServerFilesystem body: Filesystem to create (required)
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.filesystems_post_with_http_info(body, **kwargs)  # noqa: E501
        else:
            (data) = self.filesystems_post_with_http_info(body, **kwargs)  # noqa: E501
            return data

    def filesystems_post_with_http_info(self, body, **kwargs):  # noqa: E501
        """Create new filesystem  # noqa: E501

        Create new filesystem  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filesystems_post_with_http_info(body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServerFilesystem body: Filesystem to create (required)
        :return: RemotefsFilesystem
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["body"]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method filesystems_post" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'body' is set
        if "body" not in params or params["body"] is None:
            raise ValueError(
                "Missing the required parameter `body` when calling `filesystems_post`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "body" in params:
            body_params = params["body"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/filesystems",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="RemotefsFilesystem",  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )

    def root_pvcs_get(self, **kwargs):  # noqa: E501
        """List available PVCs in the domino-compute namespace with the netapp-storage label  # noqa: E501

        List available PVCs in the domino-compute namespace with the netapp-storage label  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.root_pvcs_get(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_plane_id: Data Plane ID
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.root_pvcs_get_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.root_pvcs_get_with_http_info(**kwargs)  # noqa: E501
            return data

    def root_pvcs_get_with_http_info(self, **kwargs):  # noqa: E501
        """List available PVCs in the domino-compute namespace with the netapp-storage label  # noqa: E501

        List available PVCs in the domino-compute namespace with the netapp-storage label  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.root_pvcs_get_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_plane_id: Data Plane ID
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["data_plane_id"]  # noqa: E501
        all_params.append("async_req")
        all_params.append("_return_http_data_only")
        all_params.append("_preload_content")
        all_params.append("_request_timeout")

        params = locals()
        for key, val in six.iteritems(params["kwargs"]):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'" " to method root_pvcs_get" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "data_plane_id" in params:
            query_params.append(("data_plane_id", params["data_plane_id"]))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            "/root-pvcs",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[str]",  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get("async_req"),
            _return_http_data_only=params.get("_return_http_data_only"),
            _preload_content=params.get("_preload_content", True),
            _request_timeout=params.get("_request_timeout"),
            collection_formats=collection_formats,
        )
