# coding: utf-8

"""
    Maestro API

    Maestro authors and executes experiences that allow non-coders the ability to define Simple Business Process without having to write code and to deploy them seamlessly without having to have development expertise  # noqa: E501

    OpenAPI spec version: 1.0.0
    Contact: devcenter@docusign.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..client.configuration import Configuration
from ..client.api_client import ApiClient


class WorkflowManagementApi(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):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def create_workflow_definition(self, account_id, body, **kwargs):
        """
        Creates a new workflow definition.
        Creates a new workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_workflow_definition(account_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param CreateOrUpdateWorkflowDefinitionRequestBody body: Request Body to create a new workflow definition. (required)
        :return: NewOrUpdatedWorkflowDefinitionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_workflow_definition_with_http_info(account_id, body, **kwargs)
        else:
            (data) = self.create_workflow_definition_with_http_info(account_id, body, **kwargs)
            return data

    def create_workflow_definition_with_http_info(self, account_id, body, **kwargs):
        """
        Creates a new workflow definition.
        Creates a new workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.create_workflow_definition_with_http_info(account_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param CreateOrUpdateWorkflowDefinitionRequestBody body: Request Body to create a new workflow definition. (required)
        :return: NewOrUpdatedWorkflowDefinitionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'body']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'POST',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='NewOrUpdatedWorkflowDefinitionResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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_workflow_definition(self, account_id, workflow_definition_id, **kwargs):
        """
        Deletes a workflow definition.
        Deletes a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.delete_workflow_definition(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :return: WorkflowDeleteResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.delete_workflow_definition_with_http_info(account_id, workflow_definition_id, **kwargs)
        else:
            (data) = self.delete_workflow_definition_with_http_info(account_id, workflow_definition_id, **kwargs)
            return data

    def delete_workflow_definition_with_http_info(self, account_id, workflow_definition_id, **kwargs):
        """
        Deletes a workflow definition.
        Deletes a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.delete_workflow_definition_with_http_info(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :return: WorkflowDeleteResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'workflow_definition_id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions/{workflowDefinitionId}'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']
        if 'workflow_definition_id' in params:
            path_params['workflowDefinitionId'] = params['workflow_definition_id']

        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'])

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'DELETE',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='WorkflowDeleteResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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_workflow_definition(self, account_id, workflow_definition_id, **kwargs):
        """
        Get Workflow Definition
        Returns a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definition(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param str last_deployed_id: deployed workflow definition metadata object id
        :return: WorkflowDefinitionWithId
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_workflow_definition_with_http_info(account_id, workflow_definition_id, **kwargs)
        else:
            (data) = self.get_workflow_definition_with_http_info(account_id, workflow_definition_id, **kwargs)
            return data

    def get_workflow_definition_with_http_info(self, account_id, workflow_definition_id, **kwargs):
        """
        Get Workflow Definition
        Returns a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definition_with_http_info(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param str last_deployed_id: deployed workflow definition metadata object id
        :return: WorkflowDefinitionWithId
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'workflow_definition_id', 'last_deployed_id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions/{workflowDefinitionId}'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']
        if 'workflow_definition_id' in params:
            path_params['workflowDefinitionId'] = params['workflow_definition_id']

        query_params = {}
        if 'last_deployed_id' in params:
            query_params['lastDeployedId'] = params['last_deployed_id']

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='WorkflowDefinitionWithId',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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_workflow_definition_config_instances(self, account_id, workflow_definition_id, **kwargs):
        """
        Gets configuration instances
        Returns a list of configuration instances for a workflow definition
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definition_config_instances(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :return: GetConfigurationInstancesResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_workflow_definition_config_instances_with_http_info(account_id, workflow_definition_id, **kwargs)
        else:
            (data) = self.get_workflow_definition_config_instances_with_http_info(account_id, workflow_definition_id, **kwargs)
            return data

    def get_workflow_definition_config_instances_with_http_info(self, account_id, workflow_definition_id, **kwargs):
        """
        Gets configuration instances
        Returns a list of configuration instances for a workflow definition
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definition_config_instances_with_http_info(account_id, workflow_definition_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :return: GetConfigurationInstancesResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'workflow_definition_id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions/{workflowDefinitionId}/configInstances'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']
        if 'workflow_definition_id' in params:
            path_params['workflowDefinitionId'] = params['workflow_definition_id']

        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'])

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='GetConfigurationInstancesResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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_workflow_definitions(self, account_id, **kwargs):
        """
        Get Workflow Definitions metadata
        Returns a list of workflow definitions' metadata.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definitions(account_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str status: workflow definition metadata status
        :return: WorkflowDefinitionList
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_workflow_definitions_with_http_info(account_id, **kwargs)
        else:
            (data) = self.get_workflow_definitions_with_http_info(account_id, **kwargs)
            return data

    def get_workflow_definitions_with_http_info(self, account_id, **kwargs):
        """
        Get Workflow Definitions metadata
        Returns a list of workflow definitions' metadata.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_workflow_definitions_with_http_info(account_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str status: workflow definition metadata status
        :return: WorkflowDefinitionList
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'status']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']

        query_params = {}
        if 'status' in params:
            query_params['status'] = params['status']

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='WorkflowDefinitionList',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 publish_or_un_publish_workflow_definition(self, account_id, workflow_definition_id, body, **kwargs):
        """
        Publishes or unpublishes a workflow definition.
        Publishes or unpublishes a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.publish_or_un_publish_workflow_definition(account_id, workflow_definition_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param DeployRequest body: Request Body to publish or unpublish a workflow definition. (required)
        :return: DeployResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.publish_or_un_publish_workflow_definition_with_http_info(account_id, workflow_definition_id, body, **kwargs)
        else:
            (data) = self.publish_or_un_publish_workflow_definition_with_http_info(account_id, workflow_definition_id, body, **kwargs)
            return data

    def publish_or_un_publish_workflow_definition_with_http_info(self, account_id, workflow_definition_id, body, **kwargs):
        """
        Publishes or unpublishes a workflow definition.
        Publishes or unpublishes a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.publish_or_un_publish_workflow_definition_with_http_info(account_id, workflow_definition_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param DeployRequest body: Request Body to publish or unpublish a workflow definition. (required)
        :return: DeployResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'workflow_definition_id', 'body']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions/{workflowDefinitionId}/publish'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']
        if 'workflow_definition_id' in params:
            path_params['workflowDefinitionId'] = params['workflow_definition_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'POST',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='DeployResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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_workflow_definition(self, account_id, workflow_definition_id, body, **kwargs):
        """
        Updates a workflow definition.
        Updates a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.update_workflow_definition(account_id, workflow_definition_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param CreateOrUpdateWorkflowDefinitionRequestBody body: Request Body to update a workflow definition. (required)
        :return: NewOrUpdatedWorkflowDefinitionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_workflow_definition_with_http_info(account_id, workflow_definition_id, body, **kwargs)
        else:
            (data) = self.update_workflow_definition_with_http_info(account_id, workflow_definition_id, body, **kwargs)
            return data

    def update_workflow_definition_with_http_info(self, account_id, workflow_definition_id, body, **kwargs):
        """
        Updates a workflow definition.
        Updates a workflow definition.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.update_workflow_definition_with_http_info(account_id, workflow_definition_id, body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: Account ID (required)
        :param str workflow_definition_id: Workflow Definition ID (required)
        :param CreateOrUpdateWorkflowDefinitionRequestBody body: Request Body to update a workflow definition. (required)
        :return: NewOrUpdatedWorkflowDefinitionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'workflow_definition_id', 'body']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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


        collection_formats = {}

        resource_path = 'aow-manage/v1.0/management/accounts/{accountId}/workflowDefinitions/{workflowDefinitionId}'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['accountId'] = params['account_id']
        if 'workflow_definition_id' in params:
            path_params['workflowDefinitionId'] = params['workflow_definition_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='NewOrUpdatedWorkflowDefinitionResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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)
