# coding: utf-8

"""
    SevOne API Documentation

    Supported endpoints by the new RESTful API  # noqa: E501

    OpenAPI spec version: 2.1.18, Hash: db562e6
    
    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 swagger_client.api_client import ApiClient


class PermissionsApi(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 get_access_permissions(self, role_id, **kwargs):  # noqa: E501
        """Get access permissions  # noqa: E501

        Get role's access permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_access_permissions(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :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.get_access_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_access_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
            return data

    def get_access_permissions_with_http_info(self, role_id, **kwargs):  # noqa: E501
        """Get access permissions  # noqa: E501

        Get role's access permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_access_permissions_with_http_info(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_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 get_access_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `get_access_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_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

        # 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(
            '/api/v2/permissions/{roleId}/access', '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)

    def get_page_permissions(self, role_id, **kwargs):  # noqa: E501
        """Get page permissions  # noqa: E501

        Get role's page permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_page_permissions(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :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.get_page_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_page_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
            return data

    def get_page_permissions_with_http_info(self, role_id, **kwargs):  # noqa: E501
        """Get page permissions  # noqa: E501

        Get role's page permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_page_permissions_with_http_info(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_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 get_page_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `get_page_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_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

        # 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(
            '/api/v2/permissions/{roleId}/page', '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)

    def get_role_permissions(self, role_id, **kwargs):  # noqa: E501
        """Get userrole permissions  # noqa: E501

        Get role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerRolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_role_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_role_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
            return data

    def get_role_permissions_with_http_info(self, role_id, **kwargs):  # noqa: E501
        """Get userrole permissions  # noqa: E501

        Get role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions_with_http_info(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerRolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'page', 'size', 'include_count', 'sort_by', 'fields']  # 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 get_role_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `get_role_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'size' in params:
            query_params.append(('size', params['size']))  # noqa: E501
        if 'include_count' in params:
            query_params.append(('includeCount', params['include_count']))  # noqa: E501
        if 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # 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

        # 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(
            '/api/v2/permissions/{roleId}/role', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PagerRolePermissionDto',  # 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 get_role_permissions1(self, role_id, target_role_id, **kwargs):  # noqa: E501
        """Get userrole permissions  # noqa: E501

        Get role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions1(role_id, target_role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int target_role_id: TargetRoleId (required)
        :return: RolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_role_permissions1_with_http_info(role_id, target_role_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_role_permissions1_with_http_info(role_id, target_role_id, **kwargs)  # noqa: E501
            return data

    def get_role_permissions1_with_http_info(self, role_id, target_role_id, **kwargs):  # noqa: E501
        """Get userrole permissions  # noqa: E501

        Get role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions1_with_http_info(role_id, target_role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int target_role_id: TargetRoleId (required)
        :return: RolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'target_role_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 get_role_permissions1" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `get_role_permissions1`")  # noqa: E501
        # verify the required parameter 'target_role_id' is set
        if ('target_role_id' not in params or
                params['target_role_id'] is None):
            raise ValueError("Missing the required parameter `target_role_id` when calling `get_role_permissions1`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501
        if 'target_role_id' in params:
            path_params['targetRoleId'] = params['target_role_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

        # 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(
            '/api/v2/permissions/{roleId}/role/{targetRoleId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RolePermissionDto',  # 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 get_role_permissions2(self, role_id, target_role_id, role_permission_dto, **kwargs):  # noqa: E501
        """Update userrole permissions  # noqa: E501

        Update role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions2(role_id, target_role_id, role_permission_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int target_role_id: TargetRoleId (required)
        :param RolePermissionDto role_permission_dto: rolePermissionDto (required)
        :return: RolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_role_permissions2_with_http_info(role_id, target_role_id, role_permission_dto, **kwargs)  # noqa: E501
        else:
            (data) = self.get_role_permissions2_with_http_info(role_id, target_role_id, role_permission_dto, **kwargs)  # noqa: E501
            return data

    def get_role_permissions2_with_http_info(self, role_id, target_role_id, role_permission_dto, **kwargs):  # noqa: E501
        """Update userrole permissions  # noqa: E501

        Update role's permissions to view/edit other roles and users  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_role_permissions2_with_http_info(role_id, target_role_id, role_permission_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int target_role_id: TargetRoleId (required)
        :param RolePermissionDto role_permission_dto: rolePermissionDto (required)
        :return: RolePermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'target_role_id', 'role_permission_dto']  # 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 get_role_permissions2" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `get_role_permissions2`")  # noqa: E501
        # verify the required parameter 'target_role_id' is set
        if ('target_role_id' not in params or
                params['target_role_id'] is None):
            raise ValueError("Missing the required parameter `target_role_id` when calling `get_role_permissions2`")  # noqa: E501
        # verify the required parameter 'role_permission_dto' is set
        if ('role_permission_dto' not in params or
                params['role_permission_dto'] is None):
            raise ValueError("Missing the required parameter `role_permission_dto` when calling `get_role_permissions2`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501
        if 'target_role_id' in params:
            path_params['targetRoleId'] = params['target_role_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'role_permission_dto' in params:
            body_params = params['role_permission_dto']
        # 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(
            '/api/v2/permissions/{roleId}/role/{targetRoleId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RolePermissionDto',  # 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 update_access_permissions(self, role_id, permissions, **kwargs):  # noqa: E501
        """Update access permissions  # noqa: E501

        Update role's access permissions, the method will replace all existing access permissions with one passed in the body of the request  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_access_permissions(role_id, permissions, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param list[str] permissions: List of access permissions (required)
        :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.update_access_permissions_with_http_info(role_id, permissions, **kwargs)  # noqa: E501
        else:
            (data) = self.update_access_permissions_with_http_info(role_id, permissions, **kwargs)  # noqa: E501
            return data

    def update_access_permissions_with_http_info(self, role_id, permissions, **kwargs):  # noqa: E501
        """Update access permissions  # noqa: E501

        Update role's access permissions, the method will replace all existing access permissions with one passed in the body of the request  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_access_permissions_with_http_info(role_id, permissions, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param list[str] permissions: List of access permissions (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'permissions']  # 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 update_access_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_access_permissions`")  # noqa: E501
        # verify the required parameter 'permissions' is set
        if ('permissions' not in params or
                params['permissions'] is None):
            raise ValueError("Missing the required parameter `permissions` when calling `update_access_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'permissions' in params:
            body_params = params['permissions']
        # 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(
            '/api/v2/permissions/{roleId}/access', 'PUT',
            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)

    def update_device_group_permissions(self, role_id, **kwargs):  # noqa: E501
        """Get deviceGroup permissions  # noqa: E501

        Get role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_device_group_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_device_group_permissions_with_http_info(role_id, **kwargs)  # noqa: E501
            return data

    def update_device_group_permissions_with_http_info(self, role_id, **kwargs):  # noqa: E501
        """Get deviceGroup permissions  # noqa: E501

        Get role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions_with_http_info(role_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'page', 'size', 'include_count', 'sort_by', 'fields']  # 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 update_device_group_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_device_group_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'size' in params:
            query_params.append(('size', params['size']))  # noqa: E501
        if 'include_count' in params:
            query_params.append(('includeCount', params['include_count']))  # noqa: E501
        if 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # 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

        # 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(
            '/api/v2/permissions/{roleId}/devicegroup', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PagerDeviceGroupPermissionDto',  # 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 update_device_group_permissions1(self, role_id, id, **kwargs):  # noqa: E501
        """Get deviceGroup permissions  # noqa: E501

        Get role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions1(role_id, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int id: DeviceGroupId (required)
        :return: DeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_device_group_permissions1_with_http_info(role_id, id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_device_group_permissions1_with_http_info(role_id, id, **kwargs)  # noqa: E501
            return data

    def update_device_group_permissions1_with_http_info(self, role_id, id, **kwargs):  # noqa: E501
        """Get deviceGroup permissions  # noqa: E501

        Get role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions1_with_http_info(role_id, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int id: DeviceGroupId (required)
        :return: DeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', '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 update_device_group_permissions1" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_device_group_permissions1`")  # 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 `update_device_group_permissions1`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501
        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

        # 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(
            '/api/v2/permissions/{roleId}/devicegroup/{id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceGroupPermissionDto',  # 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 update_device_group_permissions2(self, role_id, id, dto, **kwargs):  # noqa: E501
        """Update deviceGroup permissions  # noqa: E501

        Update role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions2(role_id, id, dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int id: DeviceGroupId (required)
        :param DeviceGroupPermissionDto dto: DeviceGroup permission request object (required)
        :return: DeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_device_group_permissions2_with_http_info(role_id, id, dto, **kwargs)  # noqa: E501
        else:
            (data) = self.update_device_group_permissions2_with_http_info(role_id, id, dto, **kwargs)  # noqa: E501
            return data

    def update_device_group_permissions2_with_http_info(self, role_id, id, dto, **kwargs):  # noqa: E501
        """Update deviceGroup permissions  # noqa: E501

        Update role's device and deviceGroup permissions  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_device_group_permissions2_with_http_info(role_id, id, dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param int id: DeviceGroupId (required)
        :param DeviceGroupPermissionDto dto: DeviceGroup permission request object (required)
        :return: DeviceGroupPermissionDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'id', 'dto']  # 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 update_device_group_permissions2" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_device_group_permissions2`")  # 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 `update_device_group_permissions2`")  # noqa: E501
        # verify the required parameter 'dto' is set
        if ('dto' not in params or
                params['dto'] is None):
            raise ValueError("Missing the required parameter `dto` when calling `update_device_group_permissions2`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'dto' in params:
            body_params = params['dto']
        # 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(
            '/api/v2/permissions/{roleId}/devicegroup/{id}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceGroupPermissionDto',  # 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 update_page_permissions(self, role_id, permissions, **kwargs):  # noqa: E501
        """Update page permissions  # noqa: E501

        Update role's access permissions, the method will replace all existing page permissions with ones passed in the body of the request  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_page_permissions(role_id, permissions, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param list[str] permissions: List of page permissions (required)
        :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.update_page_permissions_with_http_info(role_id, permissions, **kwargs)  # noqa: E501
        else:
            (data) = self.update_page_permissions_with_http_info(role_id, permissions, **kwargs)  # noqa: E501
            return data

    def update_page_permissions_with_http_info(self, role_id, permissions, **kwargs):  # noqa: E501
        """Update page permissions  # noqa: E501

        Update role's access permissions, the method will replace all existing page permissions with ones passed in the body of the request  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_page_permissions_with_http_info(role_id, permissions, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int role_id: RoleId (required)
        :param list[str] permissions: List of page permissions (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['role_id', 'permissions']  # 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 update_page_permissions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'role_id' is set
        if ('role_id' not in params or
                params['role_id'] is None):
            raise ValueError("Missing the required parameter `role_id` when calling `update_page_permissions`")  # noqa: E501
        # verify the required parameter 'permissions' is set
        if ('permissions' not in params or
                params['permissions'] is None):
            raise ValueError("Missing the required parameter `permissions` when calling `update_page_permissions`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'role_id' in params:
            path_params['roleId'] = params['role_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'permissions' in params:
            body_params = params['permissions']
        # 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(
            '/api/v2/permissions/{roleId}/page', 'PUT',
            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)
