Scenario 2 – create a new blueprint

This scenario will take a snapshot of an environment, create a new environment with a new Blueprint and start it with the image from the snapshot.

List all environments
 
 
 
 
 
The linux environment is suspended (inactive).

Request

https://use.cloudshare.com/API/v2/Env/ListEnvironments?timestamp=1363500860&token=JAHL6X5H2I&UserApiId=VWRWJ4550LB086FG&HMAC=62c0d4ba5197cb37ef3a9aa39a6bde1015681323

Response

{
    "data": [
        {
            "blueprint": "A linux environment",
            "description": "  CloudShare Pro environment",
            "envId": "V0MDPUQHHN1A",
            "envToken": "VQbE1o1IBQK6B633_UFGog2",
            "environmentPolicy": null,
            "expirationTime": "Wed, 18 Dec 2013 22:00:00 GMT",
            "invitationAllowed": true,
            "licenseValid": "Valid",
            "name": "A linux environment",
            "organization": null,
            "owner": "jsmith@company.com",
            "project": null,
            "snapshot": "snap1",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Pro/Environment.mvc/View/VQbE1o1IBQK6B633_UFGog2"
        },
        {
            "blueprint": "linux environment",
            "description": "A new linux environment",
            "envId": "VJ1DWJYN5GXB",
            "envToken": "9wtGldOX2PVXHaUlrTRG2g2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 09:55:44 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial State Snapshot",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/9wtGldOX2PVXHaUlrTRG2g2"
        },
        {
            "blueprint": "linux environment",
            "description": "A new linux environment",
            "envId": "P400PXZJOWEB",
            "envToken": "9FgUl7qx5--BByJ3sEholw2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 10:05:53 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial State Snapshot",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/9FgUl7qx5--BByJ3sEholw2"
        },
        {
            "blueprint": "Linux2",
            "description": "A new linux environment",
            "envId": "HA0VLW3GJ0PA",
            "envToken": "Gh5wSR5wN2nm7I6orvTcDg2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 08:37:32 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial snapshot",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/Gh5wSR5wN2nm7I6orvTcDg2"
        }
    ],
    "remaining_api_calls": 99999,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Resume suspended environment

Use envId VJ1DWJYN5GXB from the previous step

Request

https://use.cloudshare.com/API/v2/Env/ResumeEnvironment?envId=VJ1DWJYN5GXB&timestamp=1363501349&token=DA7KL661O0&UserApiId=VWRWJ4550LB086FG&HMAC=3e3014bc2553b6e9ebc9bfb9661b605aea0cbf94

Response

{
    "data": {
        "envId": "VJ1DWJYN5GXB"
    },
    "remaining_api_calls": 99998,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Take a snapshot of one environment, to a new Blueprint.

Label the snapshot system at initialization, and the new Blueprint Blueprint1.

Request

https://use.cloudshare.com/API/v2/Env/EntAppTakeSnapshotToNewBlueprint?description=system%20at%20initialization&envId=VJ1DWJYN5GXB&newBlueprintName=Blueprint1&snapshotName=Initial%20snapshot&timestamp=1363501926&token=1CV2KGDA1G&UserApiId=VWRWJ4550LB086FG&HMAC=db1a181e1b52362449e4cd5c1aa0fe539a40ecef

Response

{
    "data": {
        "envId": "VJ1DWJYN5GXB"
    },
    "remaining_api_calls": 99996,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Check environment options, filtering for the new blueprint, Blueprint1

Look for the new Blueprint, Initial snapshot.

Request

https://use.cloudshare.com/API/v2/Env/CreateEntAppEnvOptions?blueprintFilter=Blueprint1&timestamp=1363502534&token=WQ9BD5TBXS&UserApiId=VWRWJ4550LB086FG&HMAC=6dd906b9fe9b3cbe84b06d1b539edcd1e37044e2

Response

{
    "data": [
        {
            "Blueprints": [
                {
                    "Name": "Blueprint1",
                    "Snapshots": [
                        {
                            "Author": "david goldhar",
                            "Comment": "system at initialization",
                            "CreationTime": "3/17/2013 6:31 AM",
                            "IsDefault": true,
                            "IsLatest": true,
                            "Name": "Initial snapshot",
                            "snapshotId": "O0AZSRDTP4LB"
                        }
                    ]
                }
            ],
            "EnvironmentPolicyDuration": "PoC (10 days)",
            "EnvironmentPolicyId": "JHGNJFQS4MOA",
            "Organizations": [
                "CloudShare"
            ],
            "Project": "API Documentation Campaign"
        },
            ],
    "remaining_api_calls": 99993,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Create a new environment from the snapshot, with name new linux environment.

Request

https://use.cloudshare.com/API/v2/Env/CreateEntAppEnv?description=another%20linux%20environment&environmentNewName=new%20linux%20environment&environmentPolicyId=JHGNJFQ4MOA&snapshotId=O0AZSRDTP4LB&timestamp=1363504331&token=YZ0I810IKC&UserApiId=VWRWJ4550LB086FG&HMAC=bff42cf775f4934424e5e05c8bdc00cf6ac47cc7

Response

{
    "data": {
        "environmentPolicyId": "JHGNJFQS4MOA"
    },
    "remaining_api_calls": 99992,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Get list of all environments; check for new one, identified by the Blueprint, Blueprint1.

Obtain the envId for the new environment (LCU0UWSXEMZA, used in the next step)

Request

https://use.cloudshare.com/API/v2/Env/ListEnvironments?timestamp=1363504514&token=8G8OHQ5AFR&UserApiId=VWRWJ4550LB086FG&HMAC=cadbb2450c08b6df6d5a8e5a716f07f86b9ff12c

Response

{
    "data": [
        {
            "blueprint": "Blueprint1",
            "description": "A new linux environment",
            "envId": "LCU0UWSXEMZA",
            "envToken": "f9aHyVG3x_hLyGMBQKTJHg2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Sat, 06 Apr 2013 07:12:16 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "new linux environment",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial snapshot",
            "status_code": 0,
            "status_text": "Ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/f9aHyVG3x_hLyGMBQKTJHg2"
        },
        {
            "blueprint": "A linux environment",
            "description": "  CloudShare Pro environment",
            "envId": "V0MDPUQHHN1A",
            "envToken": "VQbE1o1IBQK6B633_UFGog2",
            "environmentPolicy": null,
            "expirationTime": "Wed, 18 Dec 2013 22:00:00 GMT",
            "invitationAllowed": true,
            "licenseValid": "Valid",
            "name": "A linux environment",
            "organization": null,
            "owner": "jsmith@company.com",
            "project": null,
            "snapshot": "snap1",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Pro/Environment.mvc/View/VQbE1o1IBQK6B633_UFGog2"
        },
        {
            "blueprint": "linux environment",
            "description": "A new linux environment",
            "envId": "VJ1DWJYN5GXB",
            "envToken": "9wtGldOX2PVXHaUlrTRG2g2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 09:55:44 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial State Snapshot",
            "status_code": 0,
            "status_text": "Ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/9wtGldOX2PVXHaUlrTRG2g2"
        },
        {
            "blueprint": "linux environment",
            "description": "A new linux environment",
            "envId": "P400PXZJOWEB",
            "envToken": "9FgUl7qx5--BByJ3sEholw2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 10:05:53 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial State Snapshot",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/9FgUl7qx5--BByJ3sEholw2"
        },
        {
            "blueprint": "Linux2",
            "description": "A new linux environment",
            "envId": "HA0VLW3GJ0PA",
            "envToken": "Gh5wSR5wN2nm7I6orvTcDg2",
            "environmentPolicy": "CloudShare/PoC (10 days)",
            "expirationTime": "Thu, 04 Apr 2013 08:37:32 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "Linux2",
            "organization": "CloudShare",
            "owner": "jsmith@company.com",
            "project": "API Documentation Campaign",
            "snapshot": "Initial snapshot",
            "status_code": 2,
            "status_text": "Not ready",
            "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/Gh5wSR5wN2nm7I6orvTcDg2"
        }
    ],
    "remaining_api_calls": 99991,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Check running status of the new environment

The environment id was identified in the previous request as LCU0UWSXEMZA.

The status for the environment is ‘Ready’.

Request

https://use.cloudshare.com/API/v2/Env/GetEnvironmentState?envId=LCU0UWSXEMZA&timestamp=1363505037&token=IXFTKU88LD&UserApiId=VWRWJ4550LB086FG&HMAC=a08f2a2fc2cb9fe1294ec825372fe4c39cbfb2d6

Response

{
    "data": {
        "available_actions": {
            "add_vms": true,
            "delete_vm": false,
            "reboot_vm": true,
            "resume_environment": false,
            "revert_environment": true,
            "revert_vm": false,
            "take_snapshot": true
        },
        "blueprint": "Blueprint1",
        "description": "A new linux environment",
        "envId": "LCU0UWSXEMZA",
        "envToken": "f9aHyVG3x_hLyGMBQKTJHg2",
        "environmentPolicy": "CloudShare/PoC (10 days)",
        "expirationTime": "Sat, 06 Apr 2013 07:12:16 GMT",
        "invitationAllowed": true,
        "licenseValid": "Not relevant",
        "name": "new linux environment",
        "organization": "CloudShare",
        "owner": "jsmith@company.com",
        "project": "API Documentation Campaign",
        "resources": {
            "cpu_in_use": 0,
            "cpu_qouta": 10,
            "disk_size_in_use_mb": 0,
            "disk_size_qouta_mb": 204800,
            "total_memory_in_use_mb": 0,
            "total_memory_qouta_mb": 10240
        },
        "snapshot": "Initial snapshot",
        "status_code": 0,
        "status_text": "Ready",
        "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/f9aHyVG3x_hLyGMBQKTJHg2",
        "vms": []
    },
    "remaining_api_calls": 99990,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Revert the environment to the new snapshot.

Request

https://use.cloudshare.com/API/v2/Env/RevertEnvironment?envId=LCU0UWSXEMZA&timestamp=1363505510&token=32YDUA1DWL&UserApiId=VWRWJ4550LB086FG&HMAC=57a71cf6a9dc7bb1be3011380fc460503abfdd45

Response

{
    "data": {
        "envId": "LCU0UWSXEMZA"
    },
    "remaining_api_calls": 99989,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK
Check new environment running state after reverting to the snapshot image.

Request

https://use.cloudshare.com/API/v2/Env/GetEnvironmentState?envId=LCU0UWSXEMZA&timestamp=1363505694&token=G38ZWR0X0S&UserApiId=VWRWJ4550LB086FG&HMAC=81ba3f04de02d341dedf8ac22432f8968a1e6650

Response

{
    "data": {
        "available_actions": {
            "add_vms": true,
            "delete_vm": false,
            "reboot_vm": true,
            "resume_environment": false,
            "revert_environment": true,
            "revert_vm": false,
            "take_snapshot": true
        },
        "blueprint": "Blueprint1",
        "description": "A new linux environment",
        "envId": "LCU0UWSXEMZA",
        "envToken": "f9aHyVG3x_hLyGMBQKTJHg2",
        "environmentPolicy": "CloudShare/PoC (10 days)",
        "expirationTime": "Sat, 06 Apr 2013 07:12:16 GMT",
        "invitationAllowed": true,
        "licenseValid": "Not relevant",
        "name": "Linux2",
        "organization": "CloudShare",
        "owner": "jsmith@company.com",
        "project": "API Documentation Campaign",
        "resources": {
            "cpu_in_use": 0,
            "cpu_qouta": 10,
            "disk_size_in_use_mb": 0,
            "disk_size_qouta_mb": 204800,
            "total_memory_in_use_mb": 0,
            "total_memory_qouta_mb": 10240
        },
        "snapshot": "Initial snapshot",
        "status_code": 0,
        "status_text": "Ready",
        "view_url": "https://use.cloudshare.com/Ent/Environment.mvc/View/f9aHyVG3x_hLyGMBQKTJHg2",
        "vms": []
    },
    "remaining_api_calls": 99988,
    "status_additional_data": null,
    "status_code": "0x20000",
    "status_text": "Success"
}

Status

HTTP/1.1 200 OK