VMware Cloud Director API - POST-CloneMedia

VMware Cloud Director API - POST-CloneMedia

POST /vdc/{id}/action/cloneMedia

Operation:
POST /vdc/{id}/action/cloneMedia
Description:
Create a copy of a media object.
Since:
0.9
Input parameters
Consume media type(s):
application/vnd.vmware.vcloud.cloneMediaParams+xml
application/vnd.vmware.vcloud.cloneMediaParams+json
Input type:
CloneMediaParamsType
Output parameters
MediaType

The response includes a Task element. You can monitor the task to to track the creation of the copy.

Produce media type(s):
application/vnd.vmware.vcloud.media+xml
application/vnd.vmware.vcloud.media+json
Output type:
MediaType
Examples
Request
HTTP 1.1
POST /api/vdc/afaafb99-228c-4838-ad07-5bf3aa649d42/action/cloneMedia

Headers:
Content-Length: 467
Content-Type: application/vnd.vmware.vcloud.cloneMediaParams+xml; charset=ISO-8859-1
x-vcloud-authorization: H0WtdDGONxQuIdzQdy8wnQW9Eyo3E9HqGcaB8PlBdcg=

Body:
<?xml version="1.0" encoding="UTF-8"?><vcloud:CloneMediaParams
    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
    name="Cloned Media Name">
    <vcloud:Description>Cloned Media Description</vcloud:Description>
    <vcloud:Source
        href="https://vcloud.example.com/api/media/a28c42bf-2e99-43ba-880a-6305fe621ab0"
        name="Updated Media Name"
        type="application/vnd.vmware.vcloud.media+xml"/>
    <vcloud:IsSourceDelete>false</vcloud:IsSourceDelete>
</vcloud:CloneMediaParams>
Response
HTTP/1.1 201 Created

Headers:
Content-Length: 2309
Content-Type: application/vnd.vmware.vcloud.media+xml;version=5.5
Location: https://vcloud.example.com/api/media/c381720d-a385-4ce6-afb1-7798ce854065
Vary: Accept-Encoding

Body:
<?xml version="1.0" encoding="UTF-8"?><Media
    xmlns="http://www.vmware.com/vcloud/v1.5"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    href="https://vcloud.example.com/api/media/c381720d-a385-4ce6-afb1-7798ce854065"
    id="urn:vcloud:media:c381720d-a385-4ce6-afb1-7798ce854065"
    imageType="iso"
    name="Cloned Media Name"
    size="14427"
    status="0"
    type="application/vnd.vmware.vcloud.media+xml"
    xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://https://vcloud.example.com/api/v1.5/schema/master.xsd">
    <Link
        href="https://vcloud.example.com/api/vdc/afaafb99-228c-4838-ad07-5bf3aa649d42"
        rel="up"
        type="application/vnd.vmware.vcloud.vdc+xml"/>
    <Description>Cloned Media Description</Description>
    <Tasks>
        <Task
            cancelRequested="false"
            expiryTime="2013-05-15T13:11:05.605+03:00"
            href="https://vcloud.example.com/api/task/fdc44466-0f88-466d-ac44-d86f355a9052"
            id="urn:vcloud:task:fdc44466-0f88-466d-ac44-d86f355a9052"
            name="task"
            operation="Copying Media File Cloned Media Name(c381720d-a385-4ce6-afb1-7798ce854065)"
            operationName="vdcCopyMedia"
            serviceNamespace="com.vmware.vcloud"
            startTime="2013-02-14T13:11:05.605+02:00"
            status="running"
            type="application/vnd.vmware.vcloud.task+xml">
            <Link
                href="https://vcloud.example.com/api/task/fdc44466-0f88-466d-ac44-d86f355a9052/action/cancel"
                rel="task:cancel"/>
            <Owner
                href="https://vcloud.example.com/api/media/c381720d-a385-4ce6-afb1-7798ce854065"
                name="Cloned Media Name"
                type="application/vnd.vmware.vcloud.media+xml"/>
            <User
                href="https://vcloud.example.com/api/admin/user/1260efee-6915-494c-8afa-84e7e6d8a310"
                name="system"
                type="application/vnd.vmware.admin.user+xml"/>
            <Organization
                href="https://vcloud.example.com/api/org/7b832bc5-3d65-45a2-8d35-da28388ab80a"
                name="Default"
                type="application/vnd.vmware.vcloud.org+xml"/>
            <Details/>
        </Task>
    </Tasks>
    <Owner
        type="application/vnd.vmware.vcloud.owner+xml">
        <User
            href="https://vcloud.example.com/api/admin/user/51e86769-9e2d-4edc-af4e-5d3606494cbf"
            name="system"
            type="application/vnd.vmware.admin.user+xml"/>
    </Owner>
    <VdcStorageProfile
        href="https://vcloud.example.com/api/vdcStorageProfile/b520e879-71de-4d47-b2e1-e092aab97f61"
        name="*"
        type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/>
</Media>