Pharo Library Reference

Quick-start

Install API library

Gofer it
    smalltalkhubUser: 'mikefilonov' project: 'EphemericCloudAPI';
    configuration;
    loadDevelopment.

Test connection

|client|
client := EphemericCloudClient userID: 'myid' authToken: 'mypass'.
client test.

Repository

https://github.com/mikefilonov/PharoEphemericCloudApi

Overview

Index

Classes

EphemericCloudClient

Represents an API client which allows you to work with your Ephemeric Cloud account. Client can fetch information about existing instances, create new instance and delete instances from the cloud.

Methods

userID:authToken: (class method)

Create an instance of EphemericCloudClient, authenticate with userID and authToken

client := EphemericCloudClient 
                  userID: 'ervak6b175f99echf6jasy8vm'
                  authToken: ''.

test

Check if client is connected and authenticated.

all

Answer an array of EphemericInstances for current client.

client all.
"an Array(EphemericInstance(eph-865894e7.swarm.pharocloud.com,Ephemeric-Cloud-Client-1.3.zip))"

/ hostname

Answer an EphemericInstance with a hostname or alias equals to aString

Example:

client / 'docs.swarm.pharocloud.com'. 
"EphemericInstance(eph-a33f8ffe.swarm.pharocloud.com,Ephemeric Documentation)"

publishZip: aFileReference named: imageNameString

Publish Zip Image Archive file in Ephemeric Cloud. Answer created EphemericInstance object.

publishSelfAs: imageName with: achiveBlock

Backup current Image and publish it in Ephemeric Cloud. archiveBlock is one argument block which accepts the archive been created to allow adding more files except .image and .changes.

Answers false in original Image, true in Image copy which is to be published in the Cloud.

Example:

isNew := client publishSelfAs: 'releaseImage' with: [ :archive |
    "add more files"  
    archive addFile: 'startup.st' ].

isNew 
    ifTrue: [ 
        "code to execute in Ephemeric Cloud Image copy" ] 
    ifFasle: [
        "code to execute in original Image" ] 

EphemericInstance

Provides an object wrapper around an ephemeric instance. Allows you to manipulate information of an individual host in the cloud.

Methods

hostname

Answer hostname (string) of an ephemeric instance.

alias

Answer alias hostname (string) of an ephemeric instance.

alias:

Set or change alias hostname for the instance. nil to remove alias from the instance.

reload

Reread information on the instance from the API server.

delete

Delete ephemeric instance from the cloud.

imageName

Answer imageName of the instance.

imageName:

Change imageName property of the ephemeric instance.

isRunning

Answer whether the instance is currently active.

isRunning:

Used to force-stop or force-activate the instance. To stop the instance set the value to false.

accessTime

Answer DateAndTime string of last access time of the instance.

createdTime

Answer DateAndTime string of instance creation.