text: # -*- coding: utf-8 -*-
  
  """
      bouncerapi
  
      This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
  """
  
  from bouncerapi.api_helper import APIHelper
  from bouncerapi.configuration import Configuration
  from bouncerapi.controllers.base_controller import BaseController
  from bouncerapi.http.auth.custom_auth import CustomAuth
  from bouncerapi.models.remove_response import RemoveResponse
  from bouncerapi.models.update_response import UpdateResponse
  from bouncerapi.models.create_response import CreateResponse
  from bouncerapi.models.get_details_response import GetDetailsResponse
  from bouncerapi.models.list_response import ListResponse
  from bouncerapi.models.search_response import SearchResponse
  from bouncerapi.exceptions.return_exception import ReturnException
  
  class WhitelistIPAddressesController(BaseController):
  
      """A Controller to access Endpoints in the bouncerapi API."""
  
  
      def remove(self,
                  entry_id,
                  body):
          """Does a DELETE request to /v1.1/whitelists/ipaddresses/{entry_id}/delete.
  
          Remove an IP Address in the Whitelist
  
          Args:
              entry_id (string): a unique identifier for the IP Address; opaque
                  but likely a GUID
              body (IPAddress): TODO: type description here. Example: 
  
          Returns:
              RemoveResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses/{entry_id}/delete'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
              'entry_id': entry_id
          })
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json',
              'content-type': 'application/json; charset=utf-8'
          }
  
          # Prepare and execute request
          _request = self.http_client.delete(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, RemoveResponse.from_dictionary)
  
      def update(self,
                  entry_id,
                  body):
          """Does a PUT request to /v1.1/whitelists/ipaddresses/{entry_id}/update.
  
          Update an IP Address in the Whitelist
  
          Args:
              entry_id (string): a unique identifier for the IP Address; opaque
                  but likely a GUID
              body (IPAddress): TODO: type description here. Example: 
  
          Returns:
              UpdateResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses/{entry_id}/update'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
              'entry_id': entry_id
          })
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json',
              'content-type': 'application/json; charset=utf-8'
          }
  
          # Prepare and execute request
          _request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, UpdateResponse.from_dictionary)
  
      def create(self,
                  body):
          """Does a POST request to /v1.1/whitelists/ipaddresses/create.
  
          Create an IP Address in the Whitelist
  
          Args:
              body (IPAddress): TODO: type description here. Example: 
  
          Returns:
              CreateResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses/create'
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json',
              'content-type': 'application/json; charset=utf-8'
          }
  
          # Prepare and execute request
          _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, CreateResponse.from_dictionary)
  
      def get_details(self,
                      entry_id):
          """Does a GET request to /v1.1/whitelists/ipaddresses/{entry_id}.
  
          Get Details of an IP Address Entry in the Whitelist
  
          Args:
              entry_id (string): a unique identifier for the IP Address; opaque
                  but likely a GUID
  
          Returns:
              GetDetailsResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses/{entry_id}'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
              'entry_id': entry_id
          })
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json'
          }
  
          # Prepare and execute request
          _request = self.http_client.get(_query_url, headers=_headers)
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, GetDetailsResponse.from_dictionary)
  
      def list(self):
          """Does a GET request to /v1.1/whitelists/ipaddresses.
  
          List all IP Addresses in the Whitelist
  
          Returns:
              ListResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses'
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json'
          }
  
          # Prepare and execute request
          _request = self.http_client.get(_query_url, headers=_headers)
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, ListResponse.from_dictionary)
  
      def search(self,
                  search_filter):
          """Does a GET request to /v1.1/whitelists/ipaddresses/filter/{search_filter}.
  
          Search for IP Addresses in the Whitelist
  
          Args:
              search_filter (string): an comma-separated lsit of IP addresses in
                  CIDR format (`192.168.100.14/24`) except with `/` replaced by
                  `+`
  
          Returns:
              SearchResponse: Response from the API. 
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/v1.1/whitelists/ipaddresses/filter/{search_filter}'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, { 
              'search_filter': search_filter
          })
          _query_builder = Configuration.get_base_uri()
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json'
          }
  
          # Prepare and execute request
          _request = self.http_client.get(_query_url, headers=_headers)
          CustomAuth.apply(_request)
          _context = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _context.response.status_code == 400:
              raise ReturnException('Unexpected error in API call. See HTTP response body for details.', _context)
          self.validate_response(_context)
  
          # Return appropriate type
          return APIHelper.json_deserialize(_context.response.raw_body, SearchResponse.from_dictionary)
  