# coding: utf-8

"""
    Alteryx Server API V3

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: 3
    
    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 src.server_client.api_client import ApiClient


class ServerConnectionsApi(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 server_connections_add_user_group_to_server_data_connection(self, data_connection_id, contract, **kwargs):  # noqa: E501
        """Share an existing Server data connection with an existing user group.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_add_user_group_to_server_data_connection(data_connection_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param AddServerConnectionUserGroupContract contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_add_user_group_to_server_data_connection_with_http_info(data_connection_id, contract, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_add_user_group_to_server_data_connection_with_http_info(data_connection_id, contract, **kwargs)  # noqa: E501
            return data

    def server_connections_add_user_group_to_server_data_connection_with_http_info(self, data_connection_id, contract, **kwargs):  # noqa: E501
        """Share an existing Server data connection with an existing user group.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_add_user_group_to_server_data_connection_with_http_info(data_connection_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param AddServerConnectionUserGroupContract contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'contract' in params:
            body_params = params['contract']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}/userGroups', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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 server_connections_add_user_to_server_data_connection(self, data_connection_id, contract, **kwargs):  # noqa: E501
        """Share an existing Server data connection with an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_add_user_to_server_data_connection(data_connection_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param AddServerConnectionUserContract contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_add_user_to_server_data_connection_with_http_info(data_connection_id, contract, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_add_user_to_server_data_connection_with_http_info(data_connection_id, contract, **kwargs)  # noqa: E501
            return data

    def server_connections_add_user_to_server_data_connection_with_http_info(self, data_connection_id, contract, **kwargs):  # noqa: E501
        """Share an existing Server data connection with an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_add_user_to_server_data_connection_with_http_info(data_connection_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param AddServerConnectionUserContract contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'contract' in params:
            body_params = params['contract']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}/users', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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 server_connections_delete_server_data_connection(self, data_connection_id, **kwargs):  # noqa: E501
        """Delete an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_delete_server_data_connection(data_connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (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.server_connections_delete_server_data_connection_with_http_info(data_connection_id, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_delete_server_data_connection_with_http_info(data_connection_id, **kwargs)  # noqa: E501
            return data

    def server_connections_delete_server_data_connection_with_http_info(self, data_connection_id, **kwargs):  # noqa: E501
        """Delete an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_delete_server_data_connection_with_http_info(data_connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['data_connection_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 server_connections_delete_server_data_connection" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'data_connection_id' is set
        if self.api_client.client_side_validation and ('data_connection_id' not in params or
                                                       params['data_connection_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `data_connection_id` when calling `server_connections_delete_server_data_connection`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_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', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}', '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 server_connections_get_server_data_connection(self, data_connection_id, **kwargs):  # noqa: E501
        """Retrieve details about an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_get_server_data_connection(data_connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_get_server_data_connection_with_http_info(data_connection_id, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_get_server_data_connection_with_http_info(data_connection_id, **kwargs)  # noqa: E501
            return data

    def server_connections_get_server_data_connection_with_http_info(self, data_connection_id, **kwargs):  # noqa: E501
        """Retrieve details about an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_get_server_data_connection_with_http_info(data_connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['data_connection_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 server_connections_get_server_data_connection" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'data_connection_id' is set
        if self.api_client.client_side_validation and ('data_connection_id' not in params or
                                                       params['data_connection_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `data_connection_id` when calling `server_connections_get_server_data_connection`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_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', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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 server_connections_get_server_data_connections(self, **kwargs):  # noqa: E501
        """Retrieve all accessible Server data connection records.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_get_server_data_connections(async_req=True)
        >>> result = thread.get()

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

    def server_connections_get_server_data_connections_with_http_info(self, **kwargs):  # noqa: E501
        """Retrieve all accessible Server data connection records.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_get_server_data_connections_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str view: 
        :return: list[ReducedServerConnectionView]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['view']  # 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 server_connections_get_server_data_connections" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'view' in params:
            query_params.append(('view', params['view']))  # 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', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[ReducedServerConnectionView]',  # 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 server_connections_remove_user_from_server_data_connection(self, data_connection_id, user_id, **kwargs):  # noqa: E501
        """Remove a user's permissions to use an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_remove_user_from_server_data_connection(data_connection_id, user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param str user_id: Identifier for an existing user. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_remove_user_from_server_data_connection_with_http_info(data_connection_id, user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_remove_user_from_server_data_connection_with_http_info(data_connection_id, user_id, **kwargs)  # noqa: E501
            return data

    def server_connections_remove_user_from_server_data_connection_with_http_info(self, data_connection_id, user_id, **kwargs):  # noqa: E501
        """Remove a user's permissions to use an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_remove_user_from_server_data_connection_with_http_info(data_connection_id, user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param str user_id: Identifier for an existing user. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_id']  # noqa: E501
        if 'user_id' in params:
            path_params['userId'] = params['user_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', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}/users/{userId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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 server_connections_remove_user_group_from_server_data_connection(self, data_connection_id, user_group_id, **kwargs):  # noqa: E501
        """Remove a user group's permissions to use an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_remove_user_group_from_server_data_connection(data_connection_id, user_group_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param str user_group_id: Identifier for an existing user group. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_remove_user_group_from_server_data_connection_with_http_info(data_connection_id, user_group_id, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_remove_user_group_from_server_data_connection_with_http_info(data_connection_id, user_group_id, **kwargs)  # noqa: E501
            return data

    def server_connections_remove_user_group_from_server_data_connection_with_http_info(self, data_connection_id, user_group_id, **kwargs):  # noqa: E501
        """Remove a user group's permissions to use an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_remove_user_group_from_server_data_connection_with_http_info(data_connection_id, user_group_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param str user_group_id: Identifier for an existing user group. (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_id']  # noqa: E501
        if 'user_group_id' in params:
            path_params['userGroupId'] = params['user_group_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', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}/userGroups/{userGroupId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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 server_connections_update_server_data_connection_name(self, data_connection_id, update_server_connection_contract, **kwargs):  # noqa: E501
        """Update the connection name of an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_update_server_data_connection_name(data_connection_id, update_server_connection_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param UpdateServerConnectionContract update_server_connection_contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.server_connections_update_server_data_connection_name_with_http_info(data_connection_id, update_server_connection_contract, **kwargs)  # noqa: E501
        else:
            (data) = self.server_connections_update_server_data_connection_name_with_http_info(data_connection_id, update_server_connection_contract, **kwargs)  # noqa: E501
            return data

    def server_connections_update_server_data_connection_name_with_http_info(self, data_connection_id, update_server_connection_contract, **kwargs):  # noqa: E501
        """Update the connection name of an existing Server data connection.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.server_connections_update_server_data_connection_name_with_http_info(data_connection_id, update_server_connection_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str data_connection_id: Identifier for an existing Server data connection. (required)
        :param UpdateServerConnectionContract update_server_connection_contract:  (required)
        :return: ServerConnectionView
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'data_connection_id' in params:
            path_params['dataConnectionId'] = params['data_connection_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'update_server_connection_contract' in params:
            body_params = params['update_server_connection_contract']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/v3/serverDataConnections/{dataConnectionId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConnectionView',  # 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)
