# 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 MaintenanceWindowsApi(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 create_maintenance_window(self, maintenance_window_dto, **kwargs):  # noqa: E501
        """Create maintenance window associated to device groups  # noqa: E501

        Creates a new maintenance window associated with Device Groups with their IDs. Normally you should not provide Maintenance Window ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_maintenance_window(maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowDeviceGroupDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: MaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_maintenance_window_with_http_info(maintenance_window_dto, **kwargs)  # noqa: E501
        else:
            (data) = self.create_maintenance_window_with_http_info(maintenance_window_dto, **kwargs)  # noqa: E501
            return data

    def create_maintenance_window_with_http_info(self, maintenance_window_dto, **kwargs):  # noqa: E501
        """Create maintenance window associated to device groups  # noqa: E501

        Creates a new maintenance window associated with Device Groups with their IDs. Normally you should not provide Maintenance Window ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_maintenance_window_with_http_info(maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowDeviceGroupDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: MaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'maintenance_window_dto' in params:
            body_params = params['maintenance_window_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/maintenancewindows/device-group', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MaintenanceWindowDeviceDto',  # 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 create_maintenance_window1(self, maintenance_window_dto, **kwargs):  # noqa: E501
        """Create maintenance window associated with devices  # noqa: E501

        Creates a new maintenance window associated with a list of device IDs  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_maintenance_window1(maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowDeviceDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: MaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_maintenance_window1_with_http_info(maintenance_window_dto, **kwargs)  # noqa: E501
        else:
            (data) = self.create_maintenance_window1_with_http_info(maintenance_window_dto, **kwargs)  # noqa: E501
            return data

    def create_maintenance_window1_with_http_info(self, maintenance_window_dto, **kwargs):  # noqa: E501
        """Create maintenance window associated with devices  # noqa: E501

        Creates a new maintenance window associated with a list of device IDs  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_maintenance_window1_with_http_info(maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowDeviceDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: MaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'maintenance_window_dto' in params:
            body_params = params['maintenance_window_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/maintenancewindows', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MaintenanceWindowDeviceDto',  # 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 delete_maintenance_window_by_id(self, id, **kwargs):  # noqa: E501
        """Delete maintenance window  # noqa: E501

        Deletes an existing maintenance window given its ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_maintenance_window_by_id(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The ID of the maintenance window to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_maintenance_window_by_id_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_maintenance_window_by_id_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def delete_maintenance_window_by_id_with_http_info(self, id, **kwargs):  # noqa: E501
        """Delete maintenance window  # noqa: E501

        Deletes an existing maintenance window given its ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_maintenance_window_by_id_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The ID of the maintenance window to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # 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/maintenancewindows/{id}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResponseEntity',  # 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 filter_maintenance_windows(self, filter, **kwargs):  # noqa: E501
        """Get filtered list of maintenance windows  # noqa: E501

        Endpoint for retrieving filtered maintenance windows that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_maintenance_windows(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowFilterDto filter: Maintenance window request filter (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 50
        :param str sort_by: Sort string of format \"property1,-property2,...\", where minus is for descending. Sortable properties: name, notes, maintenanceType, createDateTime, beginDateTime (default), endDateTime.
        :return: PagerMaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.filter_maintenance_windows_with_http_info(filter, **kwargs)  # noqa: E501
        else:
            (data) = self.filter_maintenance_windows_with_http_info(filter, **kwargs)  # noqa: E501
            return data

    def filter_maintenance_windows_with_http_info(self, filter, **kwargs):  # noqa: E501
        """Get filtered list of maintenance windows  # noqa: E501

        Endpoint for retrieving filtered maintenance windows that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_maintenance_windows_with_http_info(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MaintenanceWindowFilterDto filter: Maintenance window request filter (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 50
        :param str sort_by: Sort string of format \"property1,-property2,...\", where minus is for descending. Sortable properties: name, notes, maintenanceType, createDateTime, beginDateTime (default), endDateTime.
        :return: PagerMaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        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 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'filter' in params:
            body_params = params['filter']
        # 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/maintenancewindows/filter', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PagerMaintenanceWindowDeviceDto',  # 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_maintenance_window_by_id(self, id, **kwargs):  # noqa: E501
        """Get maintenance window  # noqa: E501

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

        :param async_req bool
        :param str id: The ID of the maintenance window (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_maintenance_window_by_id_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_maintenance_window_by_id_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def get_maintenance_window_by_id_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get maintenance window  # noqa: E501

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

        :param async_req bool
        :param str id: The ID of the maintenance window (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        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/maintenancewindows/{id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResponseEntity',  # 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_maintenance_windows(self, **kwargs):  # noqa: E501
        """Get list of maintenance windows  # noqa: E501

        Endpoint for retrieving maintenance windows that supports filtering and pagination  # 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_maintenance_windows(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 50
        :param str sort_by: Sort string of format \"property1,-property2,...\", where minus is for descending. Sortable properties: name, notes, maintenanceType, createDateTime, beginDateTime (default), endDateTime.
        :return: PagerMaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_maintenance_windows_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_maintenance_windows_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_maintenance_windows_with_http_info(self, **kwargs):  # noqa: E501
        """Get list of maintenance windows  # noqa: E501

        Endpoint for retrieving maintenance windows that supports filtering and pagination  # 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_maintenance_windows_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 50
        :param str sort_by: Sort string of format \"property1,-property2,...\", where minus is for descending. Sortable properties: name, notes, maintenanceType, createDateTime, beginDateTime (default), endDateTime.
        :return: PagerMaintenanceWindowDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['date_format', 'page', 'size', 'sort_by']  # 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_maintenance_windows" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        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 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        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/maintenancewindows', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PagerMaintenanceWindowDeviceDto',  # 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_maintenance_window_by_id(self, id, maintenance_window_dto, **kwargs):  # noqa: E501
        """Update maintenance window associated with devices  # noqa: E501

        Updates all fields of an existing maintenance window  # 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_maintenance_window_by_id(id, maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The id of the maintenance window to be updated (required)
        :param MaintenanceWindowDeviceDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_maintenance_window_by_id_with_http_info(id, maintenance_window_dto, **kwargs)  # noqa: E501
        else:
            (data) = self.update_maintenance_window_by_id_with_http_info(id, maintenance_window_dto, **kwargs)  # noqa: E501
            return data

    def update_maintenance_window_by_id_with_http_info(self, id, maintenance_window_dto, **kwargs):  # noqa: E501
        """Update maintenance window associated with devices  # noqa: E501

        Updates all fields of an existing maintenance window  # 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_maintenance_window_by_id_with_http_info(id, maintenance_window_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str id: The id of the maintenance window to be updated (required)
        :param MaintenanceWindowDeviceDto maintenance_window_dto: Maintenance window request object (required)
        :param str date_format: The date format for begin and end dates: UNIX_TIMESTAMP_SECONDS, UNIX_TIMESTAMP_MILLISECONDS, ISO8601_SECONDS, ISO8601_MILLISECONDS
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'date_format' in params:
            header_params['Date-Format'] = params['date_format']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'maintenance_window_dto' in params:
            body_params = params['maintenance_window_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/maintenancewindows/{id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResponseEntity',  # 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)
