Create an API key given name and description.

    An optional enabled argument can be provided.  If provided, the
    valid values are True|False.  This argument defaults to True.

    An optional stageKeys argument can be provided in the form of
    list of dictionary with 'restApiId' and 'stageName' as keys.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_apigateway.create_api_key name description

        salt myminion boto_apigateway.create_api_key name description enabled=False

        salt myminion boto_apigateway.create_api_key name description \\
             stageKeys='[{"restApiId": "id", "stageName": "stagename"}]'

def create_api_key(name, description, enabled=True, stageKeys=None,
                   region=None, key=None, keyid=None, profile=None):
    '''
    Create an API key given name and description.

    An optional enabled argument can be provided.  If provided, the
    valid values are True|False.  This argument defaults to True.

    An optional stageKeys argument can be provided in the form of
    list of dictionary with 'restApiId' and 'stageName' as keys.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_apigateway.create_api_key name description

        salt myminion boto_apigateway.create_api_key name description enabled=False

        salt myminion boto_apigateway.create_api_key name description \\
             stageKeys='[{"restApiId": "id", "stageName": "stagename"}]'

    '''

    try:
        stageKeys = list() if stageKeys is None else stageKeys

        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        response = conn.create_api_key(name=name, description=description,
                                       enabled=enabled, stageKeys=stageKeys)
        if not response:
            return {'created': False}

        return {'created': True, 'apiKey': _convert_datetime_str(response)}
    except ClientError as e:
        return {'created': False, 'error': __utils__['boto3.get_error'](e)}