Movatterモバイル変換


[0]ホーム

URL:


PPTX, PDF359,751 views

Cloudstack UI Customization

The document provides information on customizing and integrating with the CloudStack user interface and API. It discusses how to customize the UI through CSS edits, add new navigation sections, deal with cross-site request forgery, and enable simple single sign-on. It also covers working with the CloudStack API, including differences between session-based and API key authentication, signing requests, asynchronous commands, response formats, and pagination. The document is intended to help developers get started with customizing and integrating with the CloudStack platform.

Embed presentation

Downloaded 418 times
CloudStack IntegrationUI and API Customization and IntegrationCloudStack Developer On RampMay 3, 2012
What you will learn    • How to customize the CloudStack 3.0.x user interface     ᵒShowcase changes specific in the CSS to alter the look and feel of CloudStack     ᵒShowcase an example of how to add your own side navigation     ᵒDealing with Cross Site Request Forgery (CSRF)     ᵒSimple Single Signon     ᵒLocalization2
What you will learn• Working with the API ᵒSession Based Auth vs API Key Auth ᵒHow to sign a request with apiKey/secretKey ᵒAsynchronous commands ᵒResponse Format ᵒPagination• Q&A
Customizing the CloudStackUser InterfaceEditing the CSSLocalization
Editing the Logo, Navigation, and Title backgrounds#header div.logo {  background: url("../images/logo.png")  no-repeat scroll 0 center transparent;  float: left;  height: 47px;                                           #navigation ul li {                              .dashboard.admin  margin: 4px 0 0 19px;                                             background: url("../images/bg-nav-item.png")   .dashboard-container .top {  position: relative;                                             repeat-x scroll 0 0                               background: url("../images/  width: 170px;                                             transparent;                                      bg-breadcrumb.png")}                                             cursor: pointer;                                  repeat-x scroll 0 -1px transparent;                                             height: 50px;                                     border-radius: 7px 7px 0 0;                                             text-shadow: 0 1px 1px #FFFFFF;                   color: #FFFFFF;                                           }                                                   float: left;                                                                                               margin: 0 0 9px;                                                                                               padding: 4px 4px 8px;                                                                                               width: 100%;                                                                                            }
Editing the tables, status icons, and buttons                                                                                                 div.button.add {                                                                                                   background: url("../images/gradients.png")table tbody td, table th, table tbody td {                                                         repeat scroll 0 -98px transparent;                                             div.list-view td.state.on span {  border-right: 1px solid #BFBFBF;                                                                 border-left: 1px solid #808080;                                               background-image: url("../images/sprites.png");  clear: none;                                                                                     border-radius: 4px 4px 4px 4px;                                               background-position: 1px -460px;  color: #495A76;                                                                                  border-right: 1px solid #808080;                                               background-repeat: no-repeat;  font-size: 12px;                                                                                 color: #4A5A6D;                                               color: #008000;  min-width: 88px;                                                                                 cursor: pointer;                                             }  overflow: hidden;                                                                                float: right;  padding: 9px 5px 8px 0;                                                                          font-size: 11px;  vertical-align: middle;                                                                          font-weight: bold;  background-color: #f2f0f1                                                                        height: 12px;}                                                                                                  left: 0;                                                                                                   margin: 0 14px 0 0;                                                                                                   padding: 5px 7px 5px 6px;                                                                                                   position: relative;                                                                                                   text-shadow: 0 1px 1px #DEE5EA;                                                                                                   top: 5px;                                                                                                 }
Adding navigation buttons and functionality              1. Go to /ui/scripts/cloudStack.js   2. Find the sections array:              3. Add a new section to the array:     sections: {                                                       /**              sections: {                               * Dashboard                 /**                                    */                  * Dashboard                          dashboard: {},                  */                                   //'dashboard-user': {},                 dashboard: {},                        instances: {},                 //'dashboard-user': {},               storage: {},                 instances: {},                        network: {},                 storage: {},                          templates: {},                 network: {},                          events: {},                 templates: {},                        accounts: {},                 events: {},                           domains: {},                 accounts: {},                         system: {},                 domains: {},                          projects: {},                 system: {},                           'global-settings': {},                 projects: {},                         configuration: {}                'global-settings': {},               }                 configuration: {},                    // New section                    testSection: {}                }
Adding navigation buttons and functionality              4. Open /ui/index.jsp. Create HTML         5. Enclose a function in 'testSection',              somewhere in the 'template' div to         which returns a jQuery object              contain your HTML content, which will be   containing your template code, and              drawn in the browser pane:                 whatever other content you wish to                                                         be shown:                                                         sections: {                <!-- Templates -->                         /**                <div id="template">                         * Dashboard                                                            */                 <div class="testSection-tmpl">            dashboard: {},                   <h1>Test section</h1>                   //'dashboard-user': {},                                                           instances: {},                 </div>                                    storage: {},                </div>                                     network: {},                                                           templates: {},                                                           events: {},                                                           accounts: {},                                                           domains: {},                                                           system: {},                                                           projects: {},                                                           'global-settings': {},                                                           configuration: {},                                                           // New section                                                            testSection: {                                                             title: 'Title for section',                                                             show: function(args) {                                                              return $('#template .testSection-                                                         tmpl').clone();                                                                  }                                                              }                                                          }
Adding navigation buttons and functionality              6. Add the section to the pre-filter, so that it isn't filtered out for              the admin account:              --                sectionPreFilter: function(args) {                  if(isAdmin()) {                    return              ["dashboard", "instances", "storage", "network", "templates", "accounts", "domain              s", "events", "system", "global-settings", "configuration", "projects"];                  },                sectionPreFilter: function(args) {                  if(isAdmin()) {                    return              ["dashboard", "instances", "storage", "network", "templates", "accounts", "domain              s", "events", "system", "global-settings", "configuration", "projects",                   // New section                   "testSection"];                 },                 ...
Adding navigation buttons and functionality              7. (optional) Add an icon for your new section in the CSS, either at              the bottom of /ui/css/cloudstack3.css or in your own CSS file under              /ui/css folder. Make sure the size of the icon is ~32x32 pixels:              #navigation ul li.testSection span.icon {                background: url('../images/testSection-icon.png') no-repeat 0px 0px;              }
Cross Site Request Forgery (CSRF)• Type of malicious exploit of a website whereby unauthorized commands are  transmitted from a user that the website trusts. Unlike cross-site scripting  (XSS), which exploits the trust a user has for a particular site, CSRF exploits  the trust that a site has in a user's browse• What does CS do to prevent this? ᵒAfter execution of the login command you will get two session variables    • JSESSIONID – default cookie    • SESSIONKEY – random token that is passed along every API request       - http://<API URL>?sessionkey=<SESSIONKEY>&…
Simple Single Signonhttp://<api_url>?command=login&username=XXX&domainid=NNN&timestamp=YYY&signature=<secure-hash>• You do not need to pass in the API Key• The four parameters that must be passed in for the login command are  domainId, username, timestamp, and signature• security.singlesignon.key• security.singlesignon.tolerance.millis• SAML?
LocalizationᵒSupport for Japanese and Simplified ChineseᵒTakes advantage of the Java ResourceBundle to do localizationᵒSimply create a /WEB-INF/classes/resources/messages_<language code>.propertiesᵒServer side vs Client side processing
API
Session-based Auth vs API Key Auth• CloudStack supports two ways of authenticating via the API.• Session-based Auth ᵒUses default Java Servlet cookie based sessions ᵒUse the “login” API to get a JSESSIONID cookie and a SESSIONKEY token ᵒAll API commands require both cookie and token to authenticate ᵒHas a timeout as configured within Tomcat• API Key Auth ᵒWorks similarly to AWS API ᵒRequires a bit more coding to generate the signature ᵒAll API commands require a signature hash
SIGNING REQUEST WITH API KEY / SECRET KEYStep 1:commandString = command name + parameters + api keyURL encode each field-value pair within the commandstringStep 2:Lower case the entire commandString and sort it alphabetically via the field for each field-value pair.sortedCommandString :apiKey=vmwijj…&command=createvolume&diskofferingid=1&name=smallvolume=zoneid=1Step 3:Take the sortedCommandString and run it through the HMAC SHA-1 hashing algorithm (mostprogramming languages offer a utility method to do this) with the user’s Secret Key. Base64 encodethe resulting byte array in UTF-8 so that it can be safely transmitted via HTTP. The final stringproduced after Base64 encoding should be SyjAz5bggPk08I1DE34lnH9x%2f4%3D
Asynchronous CommandsᵒStarting with 3.0, in your standard CRUD (Create, Read, Update, Delete) of any first class objects in CloudStack, CUD are automatically asynchronous. R is synchronous.ᵒRather than returning a response object, it will return a job ID.ᵒIf it is a “Create” command, it will also return the object ID.ᵒWith the job ID, you can query the async job status via the queryAsyncJobResult command.ᵒThe queryAsyncJobResult response will return the following possible job status code:   • 0 - Job is still in progress. Continue to periodically poll for any status changes.   • 1 - Job has successfully completed. The job will return any successful response values     associated with command that was originally executed.   • 2 - Job has failed to complete. Please check the <jobresultcode> tag for failure reason code     and <jobresult> for the failure reason.
RESPONSE FORMATCloudStack supports two formats as the response to an API call.The default response is XML. If you would like the response to be in JSON, add &response=json to theCommand String.Sample XML Response:<listipaddressesresponse>   <allocatedipaddress>   <ipaddress>192.168.10.141</ipaddress>   <allocated>2009-09-18T13:16:10-0700</allocated>   <zoneid>4</zoneid>   <zonename>WC</zonename>   <issourcenat>true</issourcenat></allocatedipaddress> </listipaddressesresponse>Sample JSON Response:{ "listipaddressesresponse" : { "allocatedipaddress" : [ { "ipaddress" : "192.168.10.141", "allocated" : "2009-09-18T13:16:10-0700", "zoneid" : "4", "zonename" : "WC", "issourcenat" : "true" } ]
Pagination• Using the page and pagesize parameter     • page defines the current cursor to the list     • pagesize defines the number of items per request     • Pagesize is limited by the administrator     • Sample:          • listVirtualMachines&page=1&pagesize=500          • listVirtualMachines&page=2&pagesize=500
Q&A

Recommended

PPTX
Vmware Data Center Virtualization ESXI and vCenter
PDF
PPT
Active directory and application
PDF
Kubernetes
PPTX
Vmware training presentation
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
 
PPTX
What is Virtualization
PPTX
VMware vSphere technical presentation
PDF
Ansible
PDF
A Hands-on Introduction to Docker
PDF
Lecture5 virtualization
PPTX
OpenStack Quantum Intro (OS Meetup 3-26-12)
PDF
Microsoft Windows Server 2022 Overview
PPT
VMware Presentation
PPTX
Introduction to Hyper-V
PPTX
Virtualization
PPTX
What is Virtualization and its types & Techniques.What is hypervisor and its ...
PDF
X-Tour Nutanix 101
PDF
Getting Started with Kubernetes
PPTX
PDF
Introduction to DevOps | Edureka
PDF
Deploying CloudStack and Ceph with flexible VXLAN and BGP networking
PPTX
Virtualization 101: Everything You Need To Know To Get Started With VMware
PPT
Virtualization
PPTX
Openstack
PPTX
Virtual Infrastructure Overview
PPTX
Microsoft Azure Overview Class 1
PPTX
CloudStack Overview

More Related Content

PPTX
Vmware Data Center Virtualization ESXI and vCenter
PDF
PPT
Active directory and application
PDF
Kubernetes
PPTX
Vmware training presentation
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
 
PPTX
What is Virtualization
PPTX
VMware vSphere technical presentation
Vmware Data Center Virtualization ESXI and vCenter
Active directory and application
Kubernetes
Vmware training presentation
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
 
What is Virtualization
VMware vSphere technical presentation

What's hot

PDF
Ansible
PDF
A Hands-on Introduction to Docker
PDF
Lecture5 virtualization
PPTX
OpenStack Quantum Intro (OS Meetup 3-26-12)
PDF
Microsoft Windows Server 2022 Overview
PPT
VMware Presentation
PPTX
Introduction to Hyper-V
PPTX
Virtualization
PPTX
What is Virtualization and its types & Techniques.What is hypervisor and its ...
PDF
X-Tour Nutanix 101
PDF
Getting Started with Kubernetes
PPTX
PDF
Introduction to DevOps | Edureka
PDF
Deploying CloudStack and Ceph with flexible VXLAN and BGP networking
PPTX
Virtualization 101: Everything You Need To Know To Get Started With VMware
PPT
Virtualization
PPTX
Openstack
PPTX
Virtual Infrastructure Overview
PPTX
Microsoft Azure Overview Class 1
Ansible
A Hands-on Introduction to Docker
Lecture5 virtualization
OpenStack Quantum Intro (OS Meetup 3-26-12)
Microsoft Windows Server 2022 Overview
VMware Presentation
Introduction to Hyper-V
Virtualization
What is Virtualization and its types & Techniques.What is hypervisor and its ...
X-Tour Nutanix 101
Getting Started with Kubernetes
Introduction to DevOps | Edureka
Deploying CloudStack and Ceph with flexible VXLAN and BGP networking
Virtualization 101: Everything You Need To Know To Get Started With VMware
Virtualization
Openstack
Virtual Infrastructure Overview
Microsoft Azure Overview Class 1

Viewers also liked

PPTX
CloudStack Overview
PPT
Intro to CloudStack API
PDF
CloudStack-Developer-Day
PPTX
Introduction to cloudstack 4.2 networking
PPTX
Building Clouds with Apache CloudStack - the business use-cases
PDF
Integrating CloudStack & Ceph
PDF
CloudStack徹底入門読書会 第4章 4.6 グローバル設定について
PDF
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
PDF
Who the heck are you? Integrating CloudStack Authentication
PPTX
Sk planet 이야기
PPTX
성공하는 애자일을 위한 짧은 이야기
PDF
New Features for Ceph with Cinder and Beyond
PPTX
Hypervisor Capabilities in Apache CloudStack 4.3
PPTX
Cloudstack 101 - an introduction to Coudstack
PDF
Operating CloudStack: the easy way (automation!)
PDF
DevOpsDays Amsterdam Cosmic workshop
PDF
Bringing New Experience with Openstack and Fuel (Ihor Dvoretskyi, Oleksandr M...
PPTX
Apache CloudStack's Plugin Model: Balancing the Cathedral with a Bazaar
PDF
스크럼, 이걸 왜 하나요
CloudStack Overview
Intro to CloudStack API
CloudStack-Developer-Day
Introduction to cloudstack 4.2 networking
Building Clouds with Apache CloudStack - the business use-cases
Integrating CloudStack & Ceph
CloudStack徹底入門読書会 第4章 4.6 グローバル設定について
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
Who the heck are you? Integrating CloudStack Authentication
Sk planet 이야기
성공하는 애자일을 위한 짧은 이야기
New Features for Ceph with Cinder and Beyond
Hypervisor Capabilities in Apache CloudStack 4.3
Cloudstack 101 - an introduction to Coudstack
Operating CloudStack: the easy way (automation!)
DevOpsDays Amsterdam Cosmic workshop
Bringing New Experience with Openstack and Fuel (Ihor Dvoretskyi, Oleksandr M...
Apache CloudStack's Plugin Model: Balancing the Cathedral with a Bazaar
스크럼, 이걸 왜 하나요

Similar to Cloudstack UI Customization

PDF
Html standards presentation
KEY
Finding a Better Way to CSS: Navigating Sass with Compass
KEY
Stylesheets of the future with Sass and Compass
PDF
CSS Quick Reference / Cheat Sheet - Scott DeLoach, ClickStart
PDF
Css Cheat Sheet
PDF
Css cheat sheet
PDF
Css Cheat Sheet
KEY
Simplifying CSS With Sass
TXT
Corilennyg gmail-com-rsp2
PDF
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
KEY
Organizing & Simplifying CSS [with Sass]
KEY
Liquid pres
KEY
Liquid pres
KEY
Liquid pres
KEY
Liquid pres
PDF
Sencha Touch
PDF
Save time by using SASS/SCSS
PDF
Doing more with LESS
KEY
Messy css
KEY
User Interface Development with Mulberry
Html standards presentation
Finding a Better Way to CSS: Navigating Sass with Compass
Stylesheets of the future with Sass and Compass
CSS Quick Reference / Cheat Sheet - Scott DeLoach, ClickStart
Css Cheat Sheet
Css cheat sheet
Css Cheat Sheet
Simplifying CSS With Sass
Corilennyg gmail-com-rsp2
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
Organizing & Simplifying CSS [with Sass]
Liquid pres
Liquid pres
Liquid pres
Liquid pres
Sencha Touch
Save time by using SASS/SCSS
Doing more with LESS
Messy css
User Interface Development with Mulberry

More from CloudStack - Open Source Cloud Computing Project

PPTX
Introduction to CloudStack: How to Deploy and Manage Infrastructure-as-a-Serv...
PPTX
Apache CloudStack from API to UI
PPTX
vBACD- July 2012 - Crash Course in Open Source Cloud Computing
PPT
vBACD - Introduction to Opscode Chef - 2/29
PDF
vBACD - Distributed Petabyte-Scale Cloud Storage with GlusterFS - 2/28
PDF
CloudStack Hyderabad Meetup: Using CloudStack to build IaaS clouds
PPT
vBACD - Introduction to Puppet, Configuration Management and IT Automation So...
PPTX
vBACD - Crash Course in Open Source Cloud Computing - 2/28
PPTX
vBACD - Deploying Infrastructure-as-a-Service with CloudStack - 2/28
PPTX
vBACD July 2012 - Deploying Private PaaS with ActiveState Stackato
PDF
CloudStack Hyderabad Meetup: How the Apache community works
PDF
CloudStack Hyderabad Meetup: Migrating applications to IaaS clouds
PPTX
vBACD July 2012 - Xen Cloud Platform
PPTX
PPTX
PPTX
CloudStack technical overview
PDF
Build a Cloud Day San Francisco - Ubuntu Cloud
PDF
vBACD July 2012 - Scaling Storage with Ceph
PDF
vBACD July 2012 - Apache Hadoop, Now and Beyond
Introduction to CloudStack: How to Deploy and Manage Infrastructure-as-a-Serv...
Apache CloudStack from API to UI
vBACD- July 2012 - Crash Course in Open Source Cloud Computing
vBACD - Introduction to Opscode Chef - 2/29
vBACD - Distributed Petabyte-Scale Cloud Storage with GlusterFS - 2/28
CloudStack Hyderabad Meetup: Using CloudStack to build IaaS clouds
vBACD - Introduction to Puppet, Configuration Management and IT Automation So...
vBACD - Crash Course in Open Source Cloud Computing - 2/28
vBACD - Deploying Infrastructure-as-a-Service with CloudStack - 2/28
vBACD July 2012 - Deploying Private PaaS with ActiveState Stackato
CloudStack Hyderabad Meetup: How the Apache community works
CloudStack Hyderabad Meetup: Migrating applications to IaaS clouds
vBACD July 2012 - Xen Cloud Platform
CloudStack technical overview
Build a Cloud Day San Francisco - Ubuntu Cloud
vBACD July 2012 - Scaling Storage with Ceph
vBACD July 2012 - Apache Hadoop, Now and Beyond

Recently uploaded

PDF
Security Forum Sessions from Houston 2025 Event
PPTX
Conversational Agents – Building Intelligent Assistants [Virtual Hands-on Wor...
PDF
Making Sense of Raster: From Bit Depth to Better Workflows
PDF
Digit Expo 2025 - EICC Edinburgh 27th November
PDF
The year in review - MarvelClient in 2025
PDF
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
PDF
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
PPTX
Chapter 3 Introduction to number system.pptx
PPTX
Software Analysis &Design ethiopia chap-2.pptx
PDF
API-First Architecture in Financial Systems
PDF
Usage Control for Process Discovery through a Trusted Execution Environment
PDF
The major tech developments for 2026 by Pluralsight, a research and training ...
PDF
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
PDF
Session 1 - Solving Semi-Structured Documents with Document Understanding
PDF
Is It Possible to Have Wi-Fi Without an Internet Provider
DOCX
Introduction to the World of Computers (Hardware & Software)
PDF
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape
PPTX
Cybercrime in the Digital Age: Risks, Impact & Protection
PPTX
Protecting Data in an AI Driven World - Cybersecurity in 2026
PPTX
Data Privacy and Protection: Safeguarding Information in a Connected World
Security Forum Sessions from Houston 2025 Event
Conversational Agents – Building Intelligent Assistants [Virtual Hands-on Wor...
Making Sense of Raster: From Bit Depth to Better Workflows
Digit Expo 2025 - EICC Edinburgh 27th November
The year in review - MarvelClient in 2025
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
Dev Dives: AI that builds with you - UiPath Autopilot for effortless RPA & AP...
Chapter 3 Introduction to number system.pptx
Software Analysis &Design ethiopia chap-2.pptx
API-First Architecture in Financial Systems
Usage Control for Process Discovery through a Trusted Execution Environment
The major tech developments for 2026 by Pluralsight, a research and training ...
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
Session 1 - Solving Semi-Structured Documents with Document Understanding
Is It Possible to Have Wi-Fi Without an Internet Provider
Introduction to the World of Computers (Hardware & Software)
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape
Cybercrime in the Digital Age: Risks, Impact & Protection
Protecting Data in an AI Driven World - Cybersecurity in 2026
Data Privacy and Protection: Safeguarding Information in a Connected World

Cloudstack UI Customization

  • 1.
    CloudStack IntegrationUI andAPI Customization and IntegrationCloudStack Developer On RampMay 3, 2012
  • 2.
    What you willlearn • How to customize the CloudStack 3.0.x user interface ᵒShowcase changes specific in the CSS to alter the look and feel of CloudStack ᵒShowcase an example of how to add your own side navigation ᵒDealing with Cross Site Request Forgery (CSRF) ᵒSimple Single Signon ᵒLocalization2
  • 3.
    What you willlearn• Working with the API ᵒSession Based Auth vs API Key Auth ᵒHow to sign a request with apiKey/secretKey ᵒAsynchronous commands ᵒResponse Format ᵒPagination• Q&A
  • 4.
    Customizing the CloudStackUserInterfaceEditing the CSSLocalization
  • 7.
    Editing the Logo,Navigation, and Title backgrounds#header div.logo { background: url("../images/logo.png") no-repeat scroll 0 center transparent; float: left; height: 47px; #navigation ul li { .dashboard.admin margin: 4px 0 0 19px; background: url("../images/bg-nav-item.png") .dashboard-container .top { position: relative; repeat-x scroll 0 0 background: url("../images/ width: 170px; transparent; bg-breadcrumb.png")} cursor: pointer; repeat-x scroll 0 -1px transparent; height: 50px; border-radius: 7px 7px 0 0; text-shadow: 0 1px 1px #FFFFFF; color: #FFFFFF; } float: left; margin: 0 0 9px; padding: 4px 4px 8px; width: 100%; }
  • 10.
    Editing the tables,status icons, and buttons div.button.add { background: url("../images/gradients.png")table tbody td, table th, table tbody td { repeat scroll 0 -98px transparent; div.list-view td.state.on span { border-right: 1px solid #BFBFBF; border-left: 1px solid #808080; background-image: url("../images/sprites.png"); clear: none; border-radius: 4px 4px 4px 4px; background-position: 1px -460px; color: #495A76; border-right: 1px solid #808080; background-repeat: no-repeat; font-size: 12px; color: #4A5A6D; color: #008000; min-width: 88px; cursor: pointer; } overflow: hidden; float: right; padding: 9px 5px 8px 0; font-size: 11px; vertical-align: middle; font-weight: bold; background-color: #f2f0f1 height: 12px;} left: 0; margin: 0 14px 0 0; padding: 5px 7px 5px 6px; position: relative; text-shadow: 0 1px 1px #DEE5EA; top: 5px; }
  • 13.
    Adding navigation buttonsand functionality 1. Go to /ui/scripts/cloudStack.js 2. Find the sections array: 3. Add a new section to the array: sections: { /** sections: { * Dashboard /** */ * Dashboard dashboard: {}, */ //'dashboard-user': {}, dashboard: {}, instances: {}, //'dashboard-user': {}, storage: {}, instances: {}, network: {}, storage: {}, templates: {}, network: {}, events: {}, templates: {}, accounts: {}, events: {}, domains: {}, accounts: {}, system: {}, domains: {}, projects: {}, system: {}, 'global-settings': {}, projects: {}, configuration: {} 'global-settings': {}, } configuration: {}, // New section testSection: {} }
  • 14.
    Adding navigation buttonsand functionality 4. Open /ui/index.jsp. Create HTML 5. Enclose a function in 'testSection', somewhere in the 'template' div to which returns a jQuery object contain your HTML content, which will be containing your template code, and drawn in the browser pane: whatever other content you wish to be shown: sections: { <!-- Templates --> /** <div id="template"> * Dashboard */ <div class="testSection-tmpl"> dashboard: {}, <h1>Test section</h1> //'dashboard-user': {}, instances: {}, </div> storage: {}, </div> network: {}, templates: {}, events: {}, accounts: {}, domains: {}, system: {}, projects: {}, 'global-settings': {}, configuration: {}, // New section testSection: { title: 'Title for section', show: function(args) { return $('#template .testSection- tmpl').clone(); } } }
  • 15.
    Adding navigation buttonsand functionality 6. Add the section to the pre-filter, so that it isn't filtered out for the admin account: -- sectionPreFilter: function(args) { if(isAdmin()) { return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domain s", "events", "system", "global-settings", "configuration", "projects"]; }, sectionPreFilter: function(args) { if(isAdmin()) { return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domain s", "events", "system", "global-settings", "configuration", "projects", // New section "testSection"]; }, ...
  • 16.
    Adding navigation buttonsand functionality 7. (optional) Add an icon for your new section in the CSS, either at the bottom of /ui/css/cloudstack3.css or in your own CSS file under /ui/css folder. Make sure the size of the icon is ~32x32 pixels: #navigation ul li.testSection span.icon { background: url('../images/testSection-icon.png') no-repeat 0px 0px; }
  • 19.
    Cross Site RequestForgery (CSRF)• Type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browse• What does CS do to prevent this? ᵒAfter execution of the login command you will get two session variables • JSESSIONID – default cookie • SESSIONKEY – random token that is passed along every API request - http://<API URL>?sessionkey=<SESSIONKEY>&…
  • 20.
    Simple Single Signonhttp://<api_url>?command=login&username=XXX&domainid=NNN&timestamp=YYY&signature=<secure-hash>•You do not need to pass in the API Key• The four parameters that must be passed in for the login command are domainId, username, timestamp, and signature• security.singlesignon.key• security.singlesignon.tolerance.millis• SAML?
  • 21.
    LocalizationᵒSupport for Japaneseand Simplified ChineseᵒTakes advantage of the Java ResourceBundle to do localizationᵒSimply create a /WEB-INF/classes/resources/messages_<language code>.propertiesᵒServer side vs Client side processing
  • 22.
  • 23.
    Session-based Auth vsAPI Key Auth• CloudStack supports two ways of authenticating via the API.• Session-based Auth ᵒUses default Java Servlet cookie based sessions ᵒUse the “login” API to get a JSESSIONID cookie and a SESSIONKEY token ᵒAll API commands require both cookie and token to authenticate ᵒHas a timeout as configured within Tomcat• API Key Auth ᵒWorks similarly to AWS API ᵒRequires a bit more coding to generate the signature ᵒAll API commands require a signature hash
  • 24.
    SIGNING REQUEST WITHAPI KEY / SECRET KEYStep 1:commandString = command name + parameters + api keyURL encode each field-value pair within the commandstringStep 2:Lower case the entire commandString and sort it alphabetically via the field for each field-value pair.sortedCommandString :apiKey=vmwijj…&command=createvolume&diskofferingid=1&name=smallvolume=zoneid=1Step 3:Take the sortedCommandString and run it through the HMAC SHA-1 hashing algorithm (mostprogramming languages offer a utility method to do this) with the user’s Secret Key. Base64 encodethe resulting byte array in UTF-8 so that it can be safely transmitted via HTTP. The final stringproduced after Base64 encoding should be SyjAz5bggPk08I1DE34lnH9x%2f4%3D
  • 25.
    Asynchronous CommandsᵒStarting with3.0, in your standard CRUD (Create, Read, Update, Delete) of any first class objects in CloudStack, CUD are automatically asynchronous. R is synchronous.ᵒRather than returning a response object, it will return a job ID.ᵒIf it is a “Create” command, it will also return the object ID.ᵒWith the job ID, you can query the async job status via the queryAsyncJobResult command.ᵒThe queryAsyncJobResult response will return the following possible job status code: • 0 - Job is still in progress. Continue to periodically poll for any status changes. • 1 - Job has successfully completed. The job will return any successful response values associated with command that was originally executed. • 2 - Job has failed to complete. Please check the <jobresultcode> tag for failure reason code and <jobresult> for the failure reason.
  • 26.
    RESPONSE FORMATCloudStack supportstwo formats as the response to an API call.The default response is XML. If you would like the response to be in JSON, add &response=json to theCommand String.Sample XML Response:<listipaddressesresponse> <allocatedipaddress> <ipaddress>192.168.10.141</ipaddress> <allocated>2009-09-18T13:16:10-0700</allocated> <zoneid>4</zoneid> <zonename>WC</zonename> <issourcenat>true</issourcenat></allocatedipaddress> </listipaddressesresponse>Sample JSON Response:{ "listipaddressesresponse" : { "allocatedipaddress" : [ { "ipaddress" : "192.168.10.141", "allocated" : "2009-09-18T13:16:10-0700", "zoneid" : "4", "zonename" : "WC", "issourcenat" : "true" } ]
  • 27.
    Pagination• Using thepage and pagesize parameter • page defines the current cursor to the list • pagesize defines the number of items per request • Pagesize is limited by the administrator • Sample: • listVirtualMachines&page=1&pagesize=500 • listVirtualMachines&page=2&pagesize=500
  • 28.

[8]ページ先頭

©2009-2025 Movatter.jp