Creates an integration for a given method in a given API.
    If integrationType is MOCK, uri and credential parameters will be ignored.

    uri is in the form of (substitute APIGATEWAY_REGION and LAMBDA_FUNC_ARN)
    "arn:aws:apigateway:APIGATEWAY_REGION:lambda:path/2015-03-31/functions/LAMBDA_FUNC_ARN/invocations"

    credentials is in the form of an iam role name or role arn.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_apigateway.create_api_integration restApiId resourcePath httpMethod \\
                             integrationType integrationHttpMethod uri credentials ['{}' ['{}']]

def create_api_integration(restApiId, resourcePath, httpMethod, integrationType, integrationHttpMethod,
                           uri, credentials, requestParameters=None, requestTemplates=None,
                           region=None, key=None, keyid=None, profile=None):
    '''
    Creates an integration for a given method in a given API.
    If integrationType is MOCK, uri and credential parameters will be ignored.

    uri is in the form of (substitute APIGATEWAY_REGION and LAMBDA_FUNC_ARN)
    "arn:aws:apigateway:APIGATEWAY_REGION:lambda:path/2015-03-31/functions/LAMBDA_FUNC_ARN/invocations"

    credentials is in the form of an iam role name or role arn.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_apigateway.create_api_integration restApiId resourcePath httpMethod \\
                             integrationType integrationHttpMethod uri credentials ['{}' ['{}']]

    '''
    try:
        credentials = _get_role_arn(credentials, region=region, key=key, keyid=keyid, profile=profile)
        resource = describe_api_resource(restApiId, resourcePath, region=region,
                                         key=key, keyid=keyid, profile=profile).get('resource')
        if resource:
            requestParameters = dict() if requestParameters is None else requestParameters
            requestTemplates = dict() if requestTemplates is None else requestTemplates

            conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
            if httpMethod.lower() == 'options':
                uri = ""
                credentials = ""

            integration = conn.put_integration(restApiId=restApiId, resourceId=resource['id'], httpMethod=httpMethod,
                                               type=integrationType, integrationHttpMethod=integrationHttpMethod,
                                               uri=uri, credentials=credentials, requestParameters=requestParameters,
                                               requestTemplates=requestTemplates)
            return {'created': True, 'integration': integration}
        return {'created': False, 'error': 'no such resource'}
    except ClientError as e:
        return {'created': False, 'error': __utils__['boto3.get_error'](e)}