All existing image memberships may be revoked and replaced in a single operation.
Continuing from the example above, in order to replace the membership list of the image with ID 1 with two entries--the first allowing 'tenant1' to access the image, and the second allowing 'tenant2' to access and further share the image, we can use the following code
from glance.client import Client
c = Client("glance.example.com", 9292)
- c.replace_members(1, {'member_id': 'tenant1', 'can_share': False},
{'member_id': 'tenant2', 'can_share': True})
![]() | Note |
|---|---|
The first argument to Client.replace_members() is the opaque identifier of the image; the remaining arguments are dictionaries with the keys `member_id` (mapping to a tenant name) and `can_share`. Note that `can_share` may be omitted, in which case any existing membership for the specified member will be preserved through the replace operation. The return value of Client.replace_members() is not significant. |
![[Note]](../common/images/admon/note.png)
