Scenario 2 – create a new prototype

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

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

Request

https://use.cloudshare.com/API/v1/Env/ListEnvironments?timestamp=1354447587&UserApiId=VWRWJ4550LB086FG&HMAC=c019be8a9240ebd6165897007c1a2b7e9a29e7c7

Response

{
    "envsList": [
        {
            "apiId": "V0MDPUQHHN1A",
            "campaign": "N/A",
            "description": " CloudShare Pro environment",
            "expirationTime": "Wed, 18 Dec 2013 22:00:00 GMT",
            "invitationAllowed": true,
            "licenseValid": "Valid",
            "name": "A linux environment",
            "organization": "N/A",
            "owner": "*****@*****.com",
            "package": "N/A",
            "prototype": "A linux environment",
            "snapshot": "snap1",
            "status": "Suspended"
        },
        {
            "apiId": "4Z0ZAVFCHTYA",
            "campaign": "N/A",
            "description": " CloudShare Pro environment",
            "expirationTime": "Mon, 03 Dec 2012 12:14:30 GMT",
            "invitationAllowed": false,
            "licenseValid": "Valid",
            "name": "My environment one - sharepoint",
            "organization": "N/A",
            "owner": "*****@*****.com",
            "package": "N/A",
            "prototype": "My environment one - sharepoint",
            "snapshot": "N/A",
            "status": "Suspended"
        },
        {
            "apiId": "2G5ZZQT0Q4PA",
            "campaign": "API Documentation Campaign",
            "description": "",
            "expirationTime": "Sat, 22 Dec 2012 08:06:38 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "linux environment",
            "organization": "CloudShare",
            "owner": "*****@*****.com",
            "package": "CloudShare/PoC (10 days)",
            "prototype": "linux environment",
            "snapshot": "newsnapshot",
            "status": "Suspended"
        }
    ]
}

Status

HTTP/1.1 200 OK
Resume suspended environment

Request

https://use.cloudshare.com/API/v1/Env/ResumeEnvironment?envApiId=2G5ZZQT0Q4PA&timestamp=1354448705&UserApiId=VWRWJ4550LB086FG&HMAC=86b29a2a2495c5a8b6b07b3d407e3895716178d0

Response

{
    "apiId": "2G5ZZQT0Q4PA"
}

Status

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

Label the snapshot snap2, and the new prototype newProto.

Request

https://use.cloudshare.com/API/v1/Env/EntAppTakeSnapshotToNewPrototype?envApiId=2G5ZZQT0Q4PA&newPrototypeName=newProto&snapshotName=snap2&timestamp=1354449059&UserApiId=VWRWJ4550LB086FG&HMAC=8fc561db6c06c6b6ca013f1715ab6254d413d154

Response

{
    "envApiId": "2G5ZZQT0Q4PA"
}

Status

HTTP/1.1 200 OK
Check create environment options.

Look for the new prototype, newProto.

Request

https://use.cloudshare.com/API/v1/Env/CreateEntAppEnvOptions?timestamp=1354449403&UserApiId=VWRWJ4550LB086FG&HMAC=824e7b42cea759e6d1060f5156a59ab3d5f3f6d9

Response

{
    "json": {
        "UsagePackagesList": [
            {
                "Campaign": "API Documentation Campaign",
                "Organizations": [
                    "CloudShare"
                ],
                "Prototype": "CloudShare API Documentation linux
                                     proto",
                "ResourcePackage": "PoC (10 days)",
                "Snapshots": [
                    {
                        "Author": "******",
                        "Comment": "",
                        "CreationTime": "11/29/2012 5:54 PM",
                        "IsDefault": true,
                        "IsLatest": true,
                        "Name": "snap1",
                        "SnapshotId": "CBEQ10MT1YBB"
                    }
                ],
                "UsagePackageId": "T0JCP2VQ1XHA"
            },
            {
                "Campaign": "API Documentation Campaign",
                "Organizations": [
                    "CloudShare"
                ],
                "Prototype": "linux environment",
                "ResourcePackage": "PoC (10 days)",
                "Snapshots": [
                    {
                        "Author": "*******",
                        "Comment": null,
                        "CreationTime": "12/2/2012 8:09 AM",
                        "IsDefault": true,
                        "IsLatest": true,
                        "Name": "newsnapshot",
                        "SnapshotId": "Q4VCZH0U2SGA"
                    }
                ],
                "UsagePackageId": "GSMKV44JETNA"
            },
            {
                "Campaign": "API Documentation Campaign",
                "Organizations": [
                    "CloudShare"
                ],
                "Prototype": "newProto",
                "ResourcePackage": "PoC (10 days)",
                "Snapshots": [
                    {
                        "Author": "*****",
                        "Comment": null,
                        "CreationTime": "12/2/2012 11:51 AM",
                        "IsDefault": true,
                        "IsLatest": true,
                        "Name": "snap2",
                        "SnapshotId": "4T4UJZBDC1QB"
                    }
                ],
                "UsagePackageId": "SY1FYBBEUMGB"
            }
        ]
    }
}

Status

HTTP/1.1 200 OK
Create a new environment with the new prototype.

Apply the Usage Package and Snapshot from the previous request.

Request

https://use.cloudshare.com/API/v1/Env/CreateEntAppEnv?environmentNewName=newLinux&snapshotApiId=4T4UJZBDC1QB&timestamp=1354449606&usagePackageApiId=SY1FYBBEUMGB&UserApiId=VWRWJ4550LB086FG&HMAC=6ec2865efed9c0cf0b179659d5cfcb6d3941c0bf

Response

{
    "usagePackageApiId": "SY1FYBBEUMGB"
}

Status

HTTP/1.1 200 OK
Get list of all environments.

Check for a new environment, identified by the prototype, newProto.

Request

https://use.cloudshare.com/API/v1/Env/ListEnvironments?timestamp=1354449802&UserApiId=VWRWJ4550LB086FG&HMAC=19508a67368715f172875646e10c952c87e88744

Response

{
    "envsList": [
        {
            "apiId": "V0MDPUQHHN1A",
            "campaign": "N/A",
            "description": " CloudShare Pro environment",
            "expirationTime": "Wed, 18 Dec 2013 22:00:00 GMT",
            "invitationAllowed": true,
            "licenseValid": "Valid",
            "name": "A linux environment",
            "organization": "N/A",
            "owner": "*****@*****.com",
            "package": "N/A",
            "prototype": "A linux environment",
            "snapshot": "snap1",
            "status": "Suspended"
        },
        {
            "apiId": "Q5BICUFX1N5B",
            "campaign": "API Documentation Campaign",
            "description": "",
            "expirationTime": "Sat, 22 Dec 2012 12:00:27 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "newLinux",
            "organization": "CloudShare",
            "owner": "*****@*****.com",
            "package": "CloudShare/PoC (10 days)",
            "prototype": "newProto",
            "snapshot": "snap2",
            "status": "Running"
        },
        {
            "apiId": "4Z0ZAVFCHTYA",
            "campaign": "N/A",
            "description": "CloudShare Pro environment",
            "expirationTime": "Mon, 03 Dec 2012 12:14:30 GMT",
            "invitationAllowed": false,
            "licenseValid": "Valid",
            "name": "My environment one - sharepoint",
            "organization": "N/A",
            "owner": "*****@*****.com",
            "package": "N/A",
            "prototype": "My environment one - sharepoint",
            "snapshot": "N/A",
            "status": "Suspended"
        },
        {
            "apiId": "2G5ZZQT0Q4PA",
            "campaign": "API Documentation Campaign",
            "description": "",
            "expirationTime": "Sat, 22 Dec 2012 08:06:38 GMT",
            "invitationAllowed": true,
            "licenseValid": "Not relevant",
            "name": "linux environment",
            "organization": "CloudShare",
            "owner": "*****@*****.com",
            "package": "CloudShare/PoC (10 days)",
            "prototype": "linux environment",
            "snapshot": "newsnapshot",
            "status": "Running"
        }
    ]
}

Status

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

The new environment id is Q5BICUFX1N5B.

The status for the environment is ‘running’.

Request

https://use.cloudshare.com/API/v1/Env/GetEnvironmentSTate?EnvApiId=Q5BICUFX1N5B&timestamp=1354449886&UserApiId=VWRWJ4550LB086FG&HMAC=97daa329283dcc6502ed98124cad0f19bb2b8529

Response

{
    "apiId": "Q5BICUFX1N5B",
    "campaign": "API Documentation Campaign",
    "description": "",
    "expirationTime": "Sat, 22 Dec 2012 12:00:27 GMT",
    "invitationAllowed": true,
    "licenseValid": "Not relevant",
    "machines": [
        {
            "apiId": "GYVX5XCKSSGA",
            "description": "OS: Ubuntu 10.04 Server
                          Spec: 16 GB HD / 0.5 GB RAM",
            "ip": "pub*-***.env.cloudshare.com",
            "name": "Ubuntu 10.04 Server",
            "password": null,
            "progress": -1,
            "status": "Running",
            "username": null,
            "webAccessUrl": null
        }
    ],
    "name": "newLinux",
    "organization": "CloudShare",
    "owner": "*****@*****.com",
    "package": "CloudShare/PoC (10 days)",
    "prototype": "newProto",
    "snapshot": "snap2",
    "status": "Running"
}

Status

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

Request

https://use.cloudshare.com/API/v1/Env/RevertEnvironment?EnvApiId=Q5BICUFX1N5B&timestamp=1354449991&UserApiId=VWRWJ4550LB086FG&HMAC=71d2581135fe60dddeb1f169b467e6b1249c26e2

Response

{
    "apiId": "Q5BICUFX1N5B"
}

Status

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

The status indicates the environment is being readied, with progress on the machine 34%.

Request

https://use.cloudshare.com/API/v1/Env/GetEnvironmentSTate?EnvApiId=Q5BICUFX1N5B&timestamp=1354450035&UserApiId=VWRWJ4550LB086FG&HMAC=fb6d2d8302fb6b0f3f10306bfd9cb0cb59095f0e

Response

{
    "apiId": "Q5BICUFX1N5B",
    "campaign": "API Documentation Campaign",
    "description": "",
    "expirationTime": "Sat, 22 Dec 2012 12:00:27 GMT",
    "invitationAllowed": true,
    "licenseValid": "Not relevant",
    "machines": [
        {
            "apiId": "GYVX5XCKSSGA",
            "description": "OS: Ubuntu 10.04 Server
                          Spec: 16 GB HD / 0.5 GB RAM",
            "ip": "pub*-***.env.cloudshare.com",
            "name": "Ubuntu 10.04 Server",
            "password": null,
            "progress": 34,
            "status": "Loading from snapshot",
            "username": null,
            "webAccessUrl": null
        }
    ],
    "name": "linux environment",
    "organization": "CloudShare",
    "owner": "*****@*****.com",
    "package": "CloudShare/PoC (10 days)",
    "prototype": "newProto",
    "snapshot": "snap2",
    "status": "Preparing"
}

Status

HTTP/1.1 200 OK
Check the environment status again, after a few minutes.

The environment is now running.

Request

https://use.cloudshare.com/API/v1/Env/GetEnvironmentSTate?EnvApiId=Q5BICUFX1N5B&timestamp=1354450132&UserApiId=VWRWJ4550LB086FG&HMAC=c873fb5e344143d29c771d8b0dde97f0f0104c02

Response

{
    "apiId": "Q5BICUFX1N5B",
    "campaign": "API Documentation Campaign",
    "description": "",
    "expirationTime": "Sat, 22 Dec 2012 12:00:27 GMT",
    "invitationAllowed": true,
    "licenseValid": "Not relevant",
    "machines": [
        {
            "apiId": "GYVX5XCKSSGA",
            "description": "OS: Ubuntu 10.04 Server
                    Spec: 16 GB HD / 0.5 GB RAM",
            "ip": "pub*-***.env.cloudshare.com",
            "name": "Ubuntu 10.04 Server",
            "password": null,
            "progress": -1,
            "status": "Running",
            "username": null,
            "webAccessUrl": null
        }
    ],
    "name": "linux environment",
    "organization": "CloudShare",
    "owner": "*****@*****.com",
    "package": "CloudShare/PoC (10 days)",
    "prototype": "newProto",
    "snapshot": "snap2",
    "status": "Running"
}