background image

VMware, Inc.

15

3

This

 

chapter

 

presents

 

an

 

example

 

of

 

using

 

the

 

vCloud

 

SDK

 

for

 

PHP

 

to

 

implement

 

a

 

structured

 

workflow

 

through

 

the

 

lifecycle

 

of

 

a

 

vApp.

The

 

helloVCloud.php

 

example,

 

included

 

in

 

the

 

samples

 

folder

 

of

 

the

 

SDK,

 

demonstrates

 

these

 

operations

 

supported

 

by

 

the

 

vCloud

 

SDK

 

for

 

PHP:

Logging

 

in

 

to

 

a

 

vCloud

 

organization

Browsing

 

the

 

organization

 

to

 

find

 

a

 

vDC

 

and

 

a

 

catalog

Instantiating

 

a

 

vApp

 

template

 

from

 

the

 

catalog

 

to

 

create

 

a

 

vApp

Operating

 

the

 

vApp

Logging

 

out

Like

 

all

 

example

 

the

 

programs,

 

helloVCloud.php

 

is

 

liberally

 

commented.

 

Read

 

the

 

comments

 

for

 

more

 

information

 

about

 

how

 

this

 

example

 

uses

 

the

 

features

 

of

 

the

 

vCloud

 

SDK

 

for

 

PHP.

 

Unlike

 

the

 

other

 

example

 

programs,

 

helloVCloud.php

 

does

 

not

 

read

 

its

 

runtime

 

options

 

from

 

the

 

file

 

config.php

.

 

You

 

must

 

supply

 

runtime

 

options

 

on

 

the

 

command

 

line.

 

To

 

see

 

a

 

summary

 

of

 

helloVCloud.php

 

options,

 

use

 

the

 

following

 

command:

php helloVCloud.php --help

To

 

run

 

the

 

helloVCloud.php

 

example,

 

use

 

the

 

following

 

command:

php helloVCloud.php -s 

server 

-u

 user@vcloudOrganization 

-p

 password 

-c

 config 

-o

=orgName 

-d

=vdcName 

-g

=catalogName 

-i

=item 

-a

=vAppName 

The

 

following

 

options

 

are

 

required:

server

 

is

 

the

 

hostname

 

or

 

IP

 

address

 

of

 

a

 

vCloud

 

Director

 

server.

username

 

is

 

the

 

name

 

of

 

a

 

vCloud

 

Director

 

user,

 

in

 

the

 

form

 

user

@

vcloudOrganization

,

 

who

 

has

 

rights

 

to

 

create

 

and

 

operate

 

vApps.

password

 

is

 

the

 

user’s

 

password.

The

 

following

 

options

 

are

 

optional:

config

 

is

 

a

 

set

 

of

 

HTTP

 

connection

 

parameters

 

in

 

the

 

form

 

of

 

a

 

PHP

 

array.

 

If

 

you

 

omit

 

this

 

option,

 

helloVCloud.php

 

accepts

 

any

 

server

 

certificate.

 

The

 

following

 

specification

 

of

 

config

 

enables

 

certificate

 

validation,

 

using

 

a

 

certificate

 

stored

 

in

 

/tmp/cert.crt

:

-c='ssl_verify_peer=>true, ssl_verify_host=>true, ssl_cafile=>/tmp/cert.crt'

orgName

 

is

 

the

 

name

 

of

 

the

 

organization

 

to

 

which

 

the

 

user

 

is

 

authenticating.

vdcName

 

is

 

the

 

name

 

of

 

a

 

vDC

 

in

 

that

 

organization

 

where

 

the

 

user

 

can

 

instantiate

 

and

 

deploy

 

the

 

vApp.

catalogName

 

is

 

the

 

name

 

of

 

a

 

catalog

 

in

 

the

 

user’s

 

organization.

Hello vCloud: A Structured Workflow 
Example

3

Содержание vCloud SDK 1.0

Страница 1: ...SDK 1 0 This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition To check for more recent editions of this documen...

Страница 2: ...ts about this documentation submit your feedback to docfeedback vmware com Copyright 2010 VMware Inc All rights reserved This product is protected by U S and international copyright and intellectual p...

Страница 3: ...ct 10 Creating an SDK Object 10 Using a Different HTTP Library 12 Using the HTML Reference Material 12 2 Setting Up for PHP Development 13 Prerequisites 13 Download and Install the vCloud SDK for PHP...

Страница 4: ...vCloud SDK for PHP Developer s Guide 4 VMware Inc...

Страница 5: ...ud Director This guide assumes you are familiar with the PHP programming language Representational State Transfer REST and RESTful programming conventions the Open Virtualization Format Specification...

Страница 6: ...ware com support services VMware Professional Services VMware Education Services courses offer extensive hands on labs case study examples and course materials designed to be used as on the job refere...

Страница 7: ...bout running the example applications included in the SDK This chapter includes the following topics vCloud Object Taxonomy on page 7 vCloud SDK for PHP Design on page 9 vCloud Object Taxonomy The vCl...

Страница 8: ...s floppy disks and CD ROMs An organization administrator specifies how resources from a provider vDC are distributed to the vDCs in an organization vCloud Catalogs Catalogs contain references to virtu...

Страница 9: ...fined in vCloud API vCloud administrative API and vCloud vSphere platform API extensions Classes in this package are generated from the vCloud API XML schema files Each class maps to a complex type de...

Страница 10: ...e Creating an SDK Object You can create an SDK object when you need to invoke a lifecycle operation such as create or modify on a vCloud API object Most class constructors for SDK objects require two...

Страница 11: ...minOrg getAdminVdcsRefs Catalog Org getCatalogRefs CatalogItem Catalog getCatalogItemRefs CatalogItem AdminCatalog getCatalogItemRefs Extension None See Creating Top Level Objects on page 12 Extension...

Страница 12: ...are_VCloud_SDK_Http_Client_Interface interface and then can call the VMware_VCloud_SDK_Service getService method specifying that client service VMware_VCloud_SDK_Service getService myHTTPClient Using...

Страница 13: ...ut the vCloud API XML schemas which define the objects and operations that the SDK supports familiarity with the details of the underlying objects and operations as described in the vCloud API Program...

Страница 14: ...e with the download or click No to exit without downloading 5 Choose a download option then click the link for the distribution format you want The vCloud SDK for PHP is distributed as a compressed ar...

Страница 15: ...help To run the helloVCloud php example use the following command php helloVCloud php s server u user vcloudOrganization p password c config o orgName d vdcName g catalogName i item a vAppName The fol...

Страница 16: ...ample creates All options but s u and p must be separated from their arguments by an equals sign For example php helloVCloud php s vcloud example com u user exampleOrg p Pa55w0rd o exampleOrg d exampl...

Страница 17: ...mples use for logging in names for objects such as catalogs and vDCs that the examples create and other values that you are required to specify when creating a vCloud API object You must edit this fil...

Страница 18: ...sed by all example code updateVmMemory php Edits the memory required by a virtual machine and reduces the existing value by half uploadVAppTemplate php Uploads an OVF package to create a vApp template...

Страница 19: ...kage used in examples 13 P packages in this SDK 9 PEAR HTTP_Request2 package 13 PHP versions supported 13 S sample programs privileges required to run 18 runtime environment for 17 sample programs pri...

Страница 20: ...vCloud SDK for PHP Developer s Guide 20 VMware Inc...

Отзывы: