doc-exports/docs/ims/dev/en-us_topic_0110300592.html
guoyanyan b3547b53d8 ims_dev_1109
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-11-16 09:00:55 +00:00

4.5 KiB

Adding an Image Member

Scenario

A private image can be shared with other tenants. When sharing an image, you need add a project ID of the tenant with whom you are going to share the image.

  • Currently, images can be shared only within the same region.
  • The token obtained from Identity and Access Management (IAM) is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequently calling the IAM API.

Involved APIs

If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the IMS API when making an API call.

  • IAM API used to obtain the token

    URI format: POST https://IAM endpoint/v3/auth/tokens

  • IMS API used to add an image member (Native OpenStack API)

    URI format: POST https://IMS endpoint/v2/images/Image ID/members

Procedure

  1. Obtain the token.
  2. Send POST https://IMS endpoint/v2/images/Image ID/members.
  3. Add X-Auth-Token to the request header.
  4. Specify the following parameters in the request body:
    {
        "member": "edc89b490d7d4392898e19b2deb34797"  //Member ID (that is, project ID of the image recipient)
    }
  5. Check the response parameters.
    {
        "status": "pending",  //Image is being shared
        "created_at": "2016-09-01T02:05:14Z",  //Time when the image is shared
        "updated_at": "2016-09-01T02:05:14Z", //Time when the image status is updated
        "image_id": "d164b5df-1bc3-4c3f-893e-3e471fd16e64",  //Image ID
        "member_id": "edc89b490d7d4392898e19b2deb34797"  //Member ID (that is, project ID of the image recipient)
        "schema": "/v2/schemas/member"  //Image sharing schema
    }

    For details about status codes for request errors, see Status Codes.