SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Introduction to the CloudStack
API
Sebastien Goasguen
@sebgoa
Outline
• Documentation
• Clients
• Exploration
• Integration port
• Signing requests
• REST or not REST
Documentation
http://cloudstack.apache.org/docs/api/apidocs-4.0.0/TOC_Root_Admin.html
http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.1-incubating/html/API_Developers_Guide/index.html
Clients
• 15 clients and
counting… on Github
• Java, Python, Perl,
Ruby, C#, php, Clojure
Exploration
• Use a debugger console
• E.g Firebug
• As you navigate the UI,
check the http calls that
are being made
• Identify the methods
• Identify the parameters
passed to each call
HTTP
based
• API calls made via HTTP(s)
• Pass name of the call as command
• Pass list of key/value pairs as arguments to
the call
• GET method
• Response can be XML or JSON
• Query API that is RESTlike
http://gehrcke.de/2009/06/aws-about-api/
Integration Port
• Unauthenticated call
– Dangerous
– Don’t open it all
– Certainly don’t open it to the public internet
• Set the port on the UI
Using the
integration port
http://localhost:8096/client/api?command=listUsers&response=json
curl 'http://localhost:8096/client/api?command=listUsers&response=json'
{ "listusersresponse" : { "count":3 ,"user" : [ {"id":"7ed6d5da-93b2-4545-a502-
23d20b48ef2a","username":"admin","firstname":"admin","lastname":"cloud","created":"2012-07-
05T12:18:27-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155-
4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-
kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg”…
http://localhost:8096/client/api?command=listUsers
curl http://localhost:8096/client/api?command=listUsers
<?xml version="1.0" encoding="ISO-8859-1"?><listusersresponse cloud-stack-version="3.0.3.2012-07-
04T06:31:57Z"><count>3</count><user><id>7ed6d5da-93b2-4545-a502-
23d20b48ef2a</id><username>admin</username><firstname>admin</firstname><lastname>cloud</lastname><
created>2012-07-05T12:18:27-
0700</created><state>enabled</state><account>admin</account><accounttype>1</accounttype><domainid>
8a111e58-e155-4482-93ce-
84efff3c7c77</domainid><domain>ROOT</domain><apikey>plgWJfZK4gyS3mOMTVmjUVg-X-
jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg…
http://www.shapeblue.com/2012/05/10/using-the-api-for-advanced-network-management/
Authenticated calls
• Using http(s)
• API endpoint for the cloud
– http://localhost:8080/client/api?
• Command key to pass the name of the call
• Key/value pairs for the arguments
• API key of the user making the call
• Signature for authorization
API Keys
• Generate API keys for the user that will access
the cloud
Creating the signature
• Form the request url: list of key=value
pairs joined by & and encoded for http
transport
• Compute the signature:
– lower case values, replace + with %20
– generate the hmac using sha1 hash function
– Base64 encode the digest
– Encode for http transport
• Form the entire request adding the signature:
&signature=
Example
>>> request
{'apikey': 'plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-
kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg', 'command': 'listUsers',
'response': 'json'}
>>>request_url="&".join(["=".join([r,urllib.quote_plus(request[r])
]) for r in request.keys()])
>>>sig_url="&".join(["=".join([r.lower(),urllib.quote_plus(request
[r]).lower()]) for r in sorted(request.iterkeys())])
>>>sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,si
g_url,hashlib.sha1).digest()).strip())
>>> req=url+request_url+'&signature='+sig
>>> res=urllib2.urlopen(req)
>>> res.read()
REST
• REST stands for Representational State
Transfer
• Architectural style to design web services
introduced by Roy Fielding (former ASF chair)
• Premise:
– HTTP protocol is enough to create web services
and change the state of web resources
– HTTP methods can be used to change the state
– Eases web services design compared to SOAP
http://en.wikipedia.org/wiki/Roy_Fielding
http://en.wikipedia.org/wiki/Representational_State_Transfer
REST
• REST style web services couple be
implemented with other protocol than http
• But http provides all that is needed
http://en.wikipedia.org/wiki/Representational_State_Transfer
REST API
• The CloudStack API is a query API
• It is RESTlike but not RESTfull
• Example:
listUsers() a GET vs GET
updateUser() a GET vs PATCH
createUser() a GET vs POST
deleteUser() a GET vs DELETE
http://gehrcke.de/2009/06/aws-about-api/
http://publish.luisrei.com/articles/flaskrest.html
Exercise
• Build a REST interface to CloudStack
• Use Flask a Lightweight Python web
framework
http://flask.pocoo.org
http://publish.luisrei.com/articles/flaskrest.html
Exercise
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
Flask allows you to define web routes and
functions that get executed when these routes
are called.
Exercise
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
do_the_login()
else:
show_the_login_form()
curl -X DELETE
http://localhost:5000/user/b3b60a8dfdf6f-4ce6-a6f9-
6194907457a5
{ "deleteuserresponse" : { "success" : "true"} }
https://github.com/runseb/cloudstack-flask
http://buildacloud.org/blog/253-to-rest-or-not-to-rest.html
Info
• Apache Top Level Project (TLP)
• http://cloudstack.apache.org
• #cloudstack and #cloudstack-dev on irc.freenode.net
• @CloudStack on Twitter
• http://www.slideshare.net/cloudstack
• dev-subscribe@cloudstack.apache.org
• users-subscribe@cloudstack.apache.org
Welcoming contributions and feedback, Join the fun !

Weitere ähnliche Inhalte

Was ist angesagt?

Volume Encryption In CloudStack
Volume Encryption In CloudStackVolume Encryption In CloudStack
Volume Encryption In CloudStackShapeBlue
 
VXLAN Integration with CloudStack Advanced Zone
VXLAN Integration with CloudStack Advanced ZoneVXLAN Integration with CloudStack Advanced Zone
VXLAN Integration with CloudStack Advanced ZoneYoshikazu Nojima
 
Backroll: Production Grade KVM Backup Solution Integrated in CloudStack
Backroll: Production Grade KVM Backup Solution Integrated in CloudStackBackroll: Production Grade KVM Backup Solution Integrated in CloudStack
Backroll: Production Grade KVM Backup Solution Integrated in CloudStackShapeBlue
 
KubeVirt (Kubernetes and Cloud Native Toronto)
KubeVirt (Kubernetes and Cloud Native Toronto)KubeVirt (Kubernetes and Cloud Native Toronto)
KubeVirt (Kubernetes and Cloud Native Toronto)Stephen Gordon
 
VM Autoscaling With CloudStack VR As Network Provider
VM Autoscaling With CloudStack VR As Network ProviderVM Autoscaling With CloudStack VR As Network Provider
VM Autoscaling With CloudStack VR As Network ProviderShapeBlue
 
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013Gluster.org
 
Building a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir MelnikBuilding a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir MelnikShapeBlue
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniZalando Technology
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetesJanakiram MSV
 
Paul Angus - CloudStack Backup and Recovery Framework
Paul Angus - CloudStack Backup and Recovery FrameworkPaul Angus - CloudStack Backup and Recovery Framework
Paul Angus - CloudStack Backup and Recovery FrameworkShapeBlue
 
What's Coming In CloudStack 4.18
What's Coming In CloudStack 4.18What's Coming In CloudStack 4.18
What's Coming In CloudStack 4.18ShapeBlue
 
CloudStack networking
CloudStack networkingCloudStack networking
CloudStack networkingShapeBlue
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요Jo Hoon
 
Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)DongHyeon Kim
 
Hashicorp Vault Open Source vs Enterprise
Hashicorp Vault Open Source vs EnterpriseHashicorp Vault Open Source vs Enterprise
Hashicorp Vault Open Source vs EnterpriseStenio Ferreira
 
OpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesOpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesJalal Mostafa
 
How To Monetise & Bill CloudStack - A Practical Open Approach
How To Monetise & Bill CloudStack - A Practical Open ApproachHow To Monetise & Bill CloudStack - A Practical Open Approach
How To Monetise & Bill CloudStack - A Practical Open ApproachShapeBlue
 

Was ist angesagt? (20)

CloudStack Architecture
CloudStack ArchitectureCloudStack Architecture
CloudStack Architecture
 
Volume Encryption In CloudStack
Volume Encryption In CloudStackVolume Encryption In CloudStack
Volume Encryption In CloudStack
 
HashiCorp's Vault - The Examples
HashiCorp's Vault - The ExamplesHashiCorp's Vault - The Examples
HashiCorp's Vault - The Examples
 
VXLAN Integration with CloudStack Advanced Zone
VXLAN Integration with CloudStack Advanced ZoneVXLAN Integration with CloudStack Advanced Zone
VXLAN Integration with CloudStack Advanced Zone
 
Backroll: Production Grade KVM Backup Solution Integrated in CloudStack
Backroll: Production Grade KVM Backup Solution Integrated in CloudStackBackroll: Production Grade KVM Backup Solution Integrated in CloudStack
Backroll: Production Grade KVM Backup Solution Integrated in CloudStack
 
KubeVirt (Kubernetes and Cloud Native Toronto)
KubeVirt (Kubernetes and Cloud Native Toronto)KubeVirt (Kubernetes and Cloud Native Toronto)
KubeVirt (Kubernetes and Cloud Native Toronto)
 
VM Autoscaling With CloudStack VR As Network Provider
VM Autoscaling With CloudStack VR As Network ProviderVM Autoscaling With CloudStack VR As Network Provider
VM Autoscaling With CloudStack VR As Network Provider
 
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
 
Building a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir MelnikBuilding a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir Melnik
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
 
Paul Angus - CloudStack Backup and Recovery Framework
Paul Angus - CloudStack Backup and Recovery FrameworkPaul Angus - CloudStack Backup and Recovery Framework
Paul Angus - CloudStack Backup and Recovery Framework
 
What's Coming In CloudStack 4.18
What's Coming In CloudStack 4.18What's Coming In CloudStack 4.18
What's Coming In CloudStack 4.18
 
CloudStack networking
CloudStack networkingCloudStack networking
CloudStack networking
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
 
Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)
 
Hashicorp Vault Open Source vs Enterprise
Hashicorp Vault Open Source vs EnterpriseHashicorp Vault Open Source vs Enterprise
Hashicorp Vault Open Source vs Enterprise
 
OpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesOpenStack Architecture and Use Cases
OpenStack Architecture and Use Cases
 
How To Monetise & Bill CloudStack - A Practical Open Approach
How To Monetise & Bill CloudStack - A Practical Open ApproachHow To Monetise & Bill CloudStack - A Practical Open Approach
How To Monetise & Bill CloudStack - A Practical Open Approach
 

Andere mochten auch

Apache CloudStack Google Summer of Code
Apache CloudStack Google Summer of CodeApache CloudStack Google Summer of Code
Apache CloudStack Google Summer of CodeSebastien Goasguen
 
Cloud Automation with ProActive
Cloud Automation with ProActiveCloud Automation with ProActive
Cloud Automation with ProActiveBrian AMEDRO
 
BtrCloud CloudStack Plugin
BtrCloud CloudStack PluginBtrCloud CloudStack Plugin
BtrCloud CloudStack Pluginbuildacloud
 
UShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackUShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackbuildacloud
 
Apalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and BillingApalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and Billingbuildacloud
 
Network Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient networkNetwork Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient networkCloudflare
 
4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success4 Prerequisites for DevOps Success
4 Prerequisites for DevOps SuccessCloudCheckr
 
Vivienda romana
Vivienda romana Vivienda romana
Vivienda romana mfierro1
 
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법철민 신
 
Sk planet 이야기
Sk planet 이야기Sk planet 이야기
Sk planet 이야기종범 고
 
Collaboration for Dummies
Collaboration for DummiesCollaboration for Dummies
Collaboration for DummiesAvaya Inc.
 
성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기종범 고
 
스크럼, 이걸 왜 하나요
스크럼, 이걸 왜 하나요스크럼, 이걸 왜 하나요
스크럼, 이걸 왜 하나요Insub Lee
 

Andere mochten auch (20)

Git 101 for CloudStack
Git 101 for CloudStackGit 101 for CloudStack
Git 101 for CloudStack
 
Apache CloudStack Google Summer of Code
Apache CloudStack Google Summer of CodeApache CloudStack Google Summer of Code
Apache CloudStack Google Summer of Code
 
CloudStack and BigData
CloudStack and BigDataCloudStack and BigData
CloudStack and BigData
 
DevCloud and CloudMonkey
DevCloud and CloudMonkeyDevCloud and CloudMonkey
DevCloud and CloudMonkey
 
Cloud Automation with ProActive
Cloud Automation with ProActiveCloud Automation with ProActive
Cloud Automation with ProActive
 
BtrCloud CloudStack Plugin
BtrCloud CloudStack PluginBtrCloud CloudStack Plugin
BtrCloud CloudStack Plugin
 
UShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackUShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStack
 
Build a Cloud Day Paris
Build a Cloud Day ParisBuild a Cloud Day Paris
Build a Cloud Day Paris
 
Apalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and BillingApalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and Billing
 
Network Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient networkNetwork Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient network
 
4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success
 
Vivienda romana
Vivienda romana Vivienda romana
Vivienda romana
 
Cloudstack UI Customization
Cloudstack UI CustomizationCloudstack UI Customization
Cloudstack UI Customization
 
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
 
Sk planet 이야기
Sk planet 이야기Sk planet 이야기
Sk planet 이야기
 
Collaboration for Dummies
Collaboration for DummiesCollaboration for Dummies
Collaboration for Dummies
 
Analytics Roles: Part 1
Analytics Roles: Part 1 Analytics Roles: Part 1
Analytics Roles: Part 1
 
성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기
 
Cloud stack for_beginners
Cloud stack for_beginnersCloud stack for_beginners
Cloud stack for_beginners
 
스크럼, 이걸 왜 하나요
스크럼, 이걸 왜 하나요스크럼, 이걸 왜 하나요
스크럼, 이걸 왜 하나요
 

Ähnlich wie Intro to CloudStack API

Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - BasicsSang-Min Park
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tourStefan Schimanski
 
REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!Stormpath
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKitJoone Hur
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEreneechemel
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleBackand Cohen
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server Masahiro Nagano
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsPhilip Stehlik
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Innovecs
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM WebinarOro Inc.
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
Web Services Testing
Web Services TestingWeb Services Testing
Web Services TestingDataArt
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerSalesforce Developers
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray testkopiczko
 

Ähnlich wie Intro to CloudStack API (20)

Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - Basics
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tour
 
Why should I care about REST?
Why should I care about REST?Why should I care about REST?
Why should I care about REST?
 
REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD Example
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Web Services Testing
Web Services TestingWeb Services Testing
Web Services Testing
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray test
 
Apache mod authまわりとか
Apache mod authまわりとかApache mod authまわりとか
Apache mod authまわりとか
 
Azure F#unctions
Azure F#unctionsAzure F#unctions
Azure F#unctions
 

Mehr von Sebastien Goasguen

Kubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: KubelessKubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: KubelessSebastien Goasguen
 
On Docker and its use for LHC at CERN
On Docker and its use for LHC at CERNOn Docker and its use for LHC at CERN
On Docker and its use for LHC at CERNSebastien Goasguen
 
CloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use CasesCloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use CasesSebastien Goasguen
 
Kubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOSKubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOSSebastien Goasguen
 
Moving from Publican to Read The Docs
Moving from Publican to Read The DocsMoving from Publican to Read The Docs
Moving from Publican to Read The DocsSebastien Goasguen
 
SDN: Network Agility in the Cloud
SDN: Network Agility in the CloudSDN: Network Agility in the Cloud
SDN: Network Agility in the CloudSebastien Goasguen
 
CloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps AmsterdamCloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps AmsterdamSebastien Goasguen
 
Intro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud DayIntro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud DaySebastien Goasguen
 
CloudStack for Java User Group
CloudStack for Java User GroupCloudStack for Java User Group
CloudStack for Java User GroupSebastien Goasguen
 
Cloud Standards and CloudStack
Cloud Standards and CloudStackCloud Standards and CloudStack
Cloud Standards and CloudStackSebastien Goasguen
 

Mehr von Sebastien Goasguen (20)

Kubernetes Sealed secrets
Kubernetes Sealed secretsKubernetes Sealed secrets
Kubernetes Sealed secrets
 
Kubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: KubelessKubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: Kubeless
 
Serverless on Kubernetes
Serverless on KubernetesServerless on Kubernetes
Serverless on Kubernetes
 
Kubernetes kubecon-roundup
Kubernetes kubecon-roundupKubernetes kubecon-roundup
Kubernetes kubecon-roundup
 
On Docker and its use for LHC at CERN
On Docker and its use for LHC at CERNOn Docker and its use for LHC at CERN
On Docker and its use for LHC at CERN
 
CloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use CasesCloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use Cases
 
Kubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOSKubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOS
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
 
Moving from Publican to Read The Docs
Moving from Publican to Read The DocsMoving from Publican to Read The Docs
Moving from Publican to Read The Docs
 
Cloud and Big Data trends
Cloud and Big Data trendsCloud and Big Data trends
Cloud and Big Data trends
 
SDN: Network Agility in the Cloud
SDN: Network Agility in the CloudSDN: Network Agility in the Cloud
SDN: Network Agility in the Cloud
 
CloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps AmsterdamCloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps Amsterdam
 
CloudStack Clients and Tools
CloudStack Clients and ToolsCloudStack Clients and Tools
CloudStack Clients and Tools
 
Intro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud DayIntro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud Day
 
Apache CloudStack AlpesJUG
Apache CloudStack AlpesJUGApache CloudStack AlpesJUG
Apache CloudStack AlpesJUG
 
Building FOSS clouds
Building FOSS cloudsBuilding FOSS clouds
Building FOSS clouds
 
CloudStack for Java User Group
CloudStack for Java User GroupCloudStack for Java User Group
CloudStack for Java User Group
 
Avoiding cloud lock-in
Avoiding cloud lock-inAvoiding cloud lock-in
Avoiding cloud lock-in
 
Cloud Standards and CloudStack
Cloud Standards and CloudStackCloud Standards and CloudStack
Cloud Standards and CloudStack
 
MyCloud for $100k
MyCloud for $100kMyCloud for $100k
MyCloud for $100k
 

Kürzlich hochgeladen

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Kürzlich hochgeladen (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Intro to CloudStack API

  • 1. Introduction to the CloudStack API Sebastien Goasguen @sebgoa
  • 2. Outline • Documentation • Clients • Exploration • Integration port • Signing requests • REST or not REST
  • 4. Clients • 15 clients and counting… on Github • Java, Python, Perl, Ruby, C#, php, Clojure
  • 5. Exploration • Use a debugger console • E.g Firebug • As you navigate the UI, check the http calls that are being made • Identify the methods • Identify the parameters passed to each call
  • 6. HTTP based • API calls made via HTTP(s) • Pass name of the call as command • Pass list of key/value pairs as arguments to the call • GET method • Response can be XML or JSON • Query API that is RESTlike http://gehrcke.de/2009/06/aws-about-api/
  • 7. Integration Port • Unauthenticated call – Dangerous – Don’t open it all – Certainly don’t open it to the public internet • Set the port on the UI
  • 8. Using the integration port http://localhost:8096/client/api?command=listUsers&response=json curl 'http://localhost:8096/client/api?command=listUsers&response=json' { "listusersresponse" : { "count":3 ,"user" : [ {"id":"7ed6d5da-93b2-4545-a502- 23d20b48ef2a","username":"admin","firstname":"admin","lastname":"cloud","created":"2012-07- 05T12:18:27-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155- 4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM- kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg”… http://localhost:8096/client/api?command=listUsers curl http://localhost:8096/client/api?command=listUsers <?xml version="1.0" encoding="ISO-8859-1"?><listusersresponse cloud-stack-version="3.0.3.2012-07- 04T06:31:57Z"><count>3</count><user><id>7ed6d5da-93b2-4545-a502- 23d20b48ef2a</id><username>admin</username><firstname>admin</firstname><lastname>cloud</lastname>< created>2012-07-05T12:18:27- 0700</created><state>enabled</state><account>admin</account><accounttype>1</accounttype><domainid> 8a111e58-e155-4482-93ce- 84efff3c7c77</domainid><domain>ROOT</domain><apikey>plgWJfZK4gyS3mOMTVmjUVg-X- jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg… http://www.shapeblue.com/2012/05/10/using-the-api-for-advanced-network-management/
  • 9. Authenticated calls • Using http(s) • API endpoint for the cloud – http://localhost:8080/client/api? • Command key to pass the name of the call • Key/value pairs for the arguments • API key of the user making the call • Signature for authorization
  • 10. API Keys • Generate API keys for the user that will access the cloud
  • 11. Creating the signature • Form the request url: list of key=value pairs joined by & and encoded for http transport • Compute the signature: – lower case values, replace + with %20 – generate the hmac using sha1 hash function – Base64 encode the digest – Encode for http transport • Form the entire request adding the signature: &signature=
  • 12. Example >>> request {'apikey': 'plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM- kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg', 'command': 'listUsers', 'response': 'json'} >>>request_url="&".join(["=".join([r,urllib.quote_plus(request[r]) ]) for r in request.keys()]) >>>sig_url="&".join(["=".join([r.lower(),urllib.quote_plus(request [r]).lower()]) for r in sorted(request.iterkeys())]) >>>sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,si g_url,hashlib.sha1).digest()).strip()) >>> req=url+request_url+'&signature='+sig >>> res=urllib2.urlopen(req) >>> res.read()
  • 13. REST • REST stands for Representational State Transfer • Architectural style to design web services introduced by Roy Fielding (former ASF chair) • Premise: – HTTP protocol is enough to create web services and change the state of web resources – HTTP methods can be used to change the state – Eases web services design compared to SOAP http://en.wikipedia.org/wiki/Roy_Fielding http://en.wikipedia.org/wiki/Representational_State_Transfer
  • 14. REST • REST style web services couple be implemented with other protocol than http • But http provides all that is needed http://en.wikipedia.org/wiki/Representational_State_Transfer
  • 15. REST API • The CloudStack API is a query API • It is RESTlike but not RESTfull • Example: listUsers() a GET vs GET updateUser() a GET vs PATCH createUser() a GET vs POST deleteUser() a GET vs DELETE http://gehrcke.de/2009/06/aws-about-api/ http://publish.luisrei.com/articles/flaskrest.html
  • 16. Exercise • Build a REST interface to CloudStack • Use Flask a Lightweight Python web framework http://flask.pocoo.org http://publish.luisrei.com/articles/flaskrest.html
  • 17. Exercise from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run(debug=True) Flask allows you to define web routes and functions that get executed when these routes are called.
  • 18. Exercise @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': do_the_login() else: show_the_login_form() curl -X DELETE http://localhost:5000/user/b3b60a8dfdf6f-4ce6-a6f9- 6194907457a5 { "deleteuserresponse" : { "success" : "true"} } https://github.com/runseb/cloudstack-flask http://buildacloud.org/blog/253-to-rest-or-not-to-rest.html
  • 19. Info • Apache Top Level Project (TLP) • http://cloudstack.apache.org • #cloudstack and #cloudstack-dev on irc.freenode.net • @CloudStack on Twitter • http://www.slideshare.net/cloudstack • dev-subscribe@cloudstack.apache.org • users-subscribe@cloudstack.apache.org Welcoming contributions and feedback, Join the fun !