gogrid api - presented at cloud connect event 2010

12
API Control the Cloud Justin Kitagawa

Upload: gogrid-cloud-hosting

Post on 17-May-2015

1.786 views

Category:

Technology


1 download

DESCRIPTION

This presentation was given by Justin Kitagawa (GoGrid's Lead Senior Software Engineer) at the Cloud Connect Event 2010 as part of a panel "Writing Code for Many Clouds". Video of the presentation is located at: http://blog.gogrid.com/?p=1807 The presentation provides an overview of GoGrid's API.

TRANSCRIPT

Page 1: GoGrid API - Presented at Cloud Connect Event 2010

APIControl the Cloud

Justin Kitagawa

Page 2: GoGrid API - Presented at Cloud Connect Event 2010

Control the CloudWho and What are we?• GoGrid is a global leader in hybrid cloud infrastructure• We provide cloud datacenters where customers pay on

demand for infrastructure that they use• Our infrastructure consists of inter-connected servers, load

balancers, firewalls, network, and storage

• Cloud Computing = Completely Outsourced IT Infrastructure

Page 3: GoGrid API - Presented at Cloud Connect Event 2010

All possible through GoGrid’s portal…

and…

Page 4: GoGrid API - Presented at Cloud Connect Event 2010

GoGrid’s APIHTTP Rest-Like Query API• https://api.gogrid.com• Easy to use stateless API using HTTP GET and POST Requests• Language agnostic• Every API request is a combination of

an action (verb) and an object (noun)

Examples:• Add Server• List Load Balancer

Page 5: GoGrid API - Presented at Cloud Connect Event 2010

Anatomy of a GoGrid API Call

Page 6: GoGrid API - Presented at Cloud Connect Event 2010

Common API Request Parameters

Page 7: GoGrid API - Presented at Cloud Connect Event 2010

Sample API Request

https://api.gogrid.com/api/grid/server/add   ?name=My+First+Server &image=centos53_64_none &ram=8GB &ip=192.200.10.101 &api_key=SK1mndkKSjsALKSExdsj30 &sig=Lsmdfj3kw99sdklnasdkjhds &v=1.4

API request adds an 8GB CentOS Linux virtual server accessible at a public ip of 192.200.10.101

Page 8: GoGrid API - Presented at Cloud Connect Event 2010

Sample Code

#!/bin/bash

APIKEY=a43c234fb2343064SECRET=passwordGTIME=`date +%s` SERVER='https://api.gogrid.com/api' VERSION='1.4' FORMAT=json METHOD='/grid/server/list?'

function getMD5sum { HASH=$1$2$3 SIG=`echo -n $HASH | md5sum | cut -d' ' -f1`

} function buildBaseURL {

#without array, cleaner in bash URL="$1$2&sig=$3&format=$4&v=$5&api_key=$6"

} function getURL {

# have curl fail silently and spit out error code to STDERR curl -f $1

}

# Get to work getMD5sum $APIKEY $SECRET $GTIME buildBaseURL $SERVER $METHOD $SIG $FORMAT $VERSION $APIKEY getURL $URL

Page 10: GoGrid API - Presented at Cloud Connect Event 2010

Challenges• Keeping it Simple (KISS)• SOAP vs REST vs HTTP• Consistent Terminology (Common Actions/Verbs)• Liberal Inputs > Conservative Output• Flexibility

• Versioning / Backward Compatibility• Rules:• Only add attributes to objects• Never remove attributes to objects• Never remove parameters from API request calls

• Test harnesses to test regressions

Page 11: GoGrid API - Presented at Cloud Connect Event 2010

Who is this all for?

Who here wants to leverage cloud infrastructure to improve the efficiency of

their engineering team’s development, staging, or production systems?

YOU!

Page 12: GoGrid API - Presented at Cloud Connect Event 2010

For More Information

• Website – www.GoGrid.com• Wiki – wiki.gogrid.com• Blog – blog.GoGrid.com• Twitter - @GoGrid• Facebook – www.facebook.com/gogrid