# Path: glanceclient/v1/apiclient/base.py
# def getid(obj):
#     def add_hook(cls, hook_type, hook_func):
#     def run_hooks(cls, hook_type, *args, **kwargs):
#     def __init__(self, client):
#     def _list(self, url, response_key=None, obj_class=None, json=None):
#     def _get(self, url, response_key=None):
#     def _head(self, url):
#     def _post(self, url, json, response_key=None, return_raw=False):
#     def _put(self, url, json=None, response_key=None):
#     def _patch(self, url, json=None, response_key=None):
#     def _delete(self, url):
#     def list(self):
#     def find(self, **kwargs):
#     def findall(self, **kwargs):
#     def build_url(self, base_url=None, **kwargs):
#     def _filter_kwargs(self, kwargs):
#     def create(self, **kwargs):
#     def get(self, **kwargs):
#     def head(self, **kwargs):
#     def list(self, base_url=None, **kwargs):
#     def put(self, base_url=None, **kwargs):
#     def update(self, **kwargs):
#     def delete(self, **kwargs):
#     def find(self, base_url=None, **kwargs):
#     def __init__(self, name, module):
#     def _parse_extension_module(self):
#     def __repr__(self):
#     def __init__(self, manager, info, loaded=False):
#     def __repr__(self):
#     def human_id(self):
#     def _add_details(self, info):
#     def __getattr__(self, k):
#     def get(self):
#     def __eq__(self, other):
#     def is_loaded(self):
#     def set_loaded(self, val):
#     def to_dict(self):
# class HookableMixin(object):
# class BaseManager(HookableMixin):
# class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
# class CrudManager(BaseManager):
# class Extension(HookableMixin):
# class Resource(object):
#     SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__')
#     HUMAN_ID = False
#     NAME_ATTR = 'name'


from glanceclient.v1.apiclient import base

    @property
    def id(self):
        return self.member_id

    def delete(self):
        self.manager.delete(self)


class ImageMemberManager(base.ManagerWithFind):
    resource_class = ImageMember

    def get(self, image, member_id):
        image_id = base.getid(image)
        url = '/v1/images/%s/members/%s' % (image_id, member_id)
        resp, body = self.client.get(url)
        member = body['member']
        member['image_id'] = image_id
        return ImageMember(self, member, loaded=True)

    def list(self, image=None, member=None):
        out = []
        if image and member:
            try:
                out.append(self.get(image, member))
            # TODO(bcwaldon): narrow this down to 404
            except Exception:
                pass
        elif image:
            out.extend(self._list_by_image(image))

# Path: glanceclient/v1/apiclient/base.py
# def getid(obj):
#     def add_hook(cls, hook_type, hook_func):
#     def run_hooks(cls, hook_type, *args, **kwargs):
#     def __init__(self, client):
#     def _list(self, url, response_key=None, obj_class=None, json=None):
#     def _get(self, url, response_key=None):
#     def _head(self, url):
#     def _post(self, url, json, response_key=None, return_raw=False):
#     def _put(self, url, json=None, response_key=None):
#     def _patch(self, url, json=None, response_key=None):
#     def _delete(self, url):
#     def list(self):
#     def find(self, **kwargs):
#     def findall(self, **kwargs):
#     def build_url(self, base_url=None, **kwargs):
#     def _filter_kwargs(self, kwargs):
#     def create(self, **kwargs):
#     def get(self, **kwargs):
#     def head(self, **kwargs):
#     def list(self, base_url=None, **kwargs):
#     def put(self, base_url=None, **kwargs):
#     def update(self, **kwargs):
#     def delete(self, **kwargs):
#     def find(self, base_url=None, **kwargs):
#     def __init__(self, name, module):
#     def _parse_extension_module(self):
#     def __repr__(self):
#     def __init__(self, manager, info, loaded=False):
#     def __repr__(self):
#     def human_id(self):
#     def _add_details(self, info):
#     def __getattr__(self, k):
#     def get(self):
#     def __eq__(self, other):
#     def is_loaded(self):
#     def set_loaded(self, val):
#     def to_dict(self):
# class HookableMixin(object):
# class BaseManager(HookableMixin):
# class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
# class CrudManager(BaseManager):
# class Extension(HookableMixin):
# class Resource(object):
#     SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__')
#     HUMAN_ID = False
#     NAME_ATTR = 'name'


# Path: glanceclient/v1/image_members.py
from glanceclient.v1.apiclient import base


    @property
    def id(self):
        return self.member_id

    def delete(self):
        self.manager.delete(self)


class ImageMemberManager(base.ManagerWithFind):
    resource_class = ImageMember

    def get(self, image, member_id):
        image_id = base.getid(image)
        url = '/v1/images/%s/members/%s' % (image_id, member_id)
        resp, body = self.client.get(url)
        member = body['member']
        member['image_id'] = image_id
        return ImageMember(self, member, loaded=True)

    def list(self, image=None, member=None):
        out = []
        if image and member:
            try:
                out.append(self.get(image, member))
            # TODO(bcwaldon): narrow this down to 404
            except Exception:
                pass
        elif image:
            out.extend(self._list_by_image(image))

        elif member: