'Adds a membership to the image.
:param req: the Request object coming from the wsgi layer
:param image_id: the image identifier
:param member_id: the member identifier
:returns: The response body is a mapping of the following form
{\'member_id\': <MEMBER>,
\'image_id\': <IMAGE>,
\'status\': <MEMBER_STATUS>
\'created_at\': ..,
\'updated_at\': ..}'

@utils.mutating
def create(self, req, image_id, member_id):

    image = self._lookup_image(req, image_id)
    member_repo = self._get_member_repo(req, image)
    image_member_factory = self.gateway.get_image_member_factory(req.context)
    try:
        new_member = image_member_factory.new_image_member(image, member_id)
        member_repo.add(new_member)
        return new_member
    except exception.Forbidden:
        msg = (_('Not    allowed    to    create    members    for    image    %s.') % image_id)
        LOG.warning(msg)
        raise webob.exc.HTTPForbidden(explanation=msg)
    except exception.Duplicate:
        msg = (_('Member    %(member_id)s    is    duplicated    for    image    %(image_id)s') % {'member_id': member_id, 'image_id': image_id})
        LOG.warning(msg)
        raise webob.exc.HTTPConflict(explanation=msg)
    except exception.ImageMemberLimitExceeded as e:
        msg = (_('Image    member    limit    exceeded    for    image    %(id)s:    %(e)s:') % {'id': image_id, 'e': encodeutils.exception_to_unicode(e)})
        LOG.warning(msg)
        raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
