5.5
Table Of Contents
- vCloud API Programming Guide
- Contents
- vCloud API Programming Guide
- About the VMware vCloud API
- Hello vCloud: A Simplified RESTful Workflow
- Exploring a Cloud
- Summary of vCloud API Browsing Requests
- Retrieve the Login URL and List of Supported API Versions
- Create a Login Session Using the Integrated Identity Provider
- Retrieve a List of Organizations Accessible to You
- Retrieve an Administrative View of a Cloud
- Retrieve a List of vSphere Platform Operations and Objects for a Cloud
- Provisioning an Organization
- Summary of vCloud API Provisioning Requests
- Upload an OVF Package to Create a vApp Template
- Download a vApp or vApp Template as OVF
- Upload a Media Image
- Download a Media Image
- Capturing and Importing vApps
- Managing Catalog Items
- Creating and Using Independent Disks
- View or Change the Owner of an Object
- Controlling Access to vApps and Catalogs
- Deploying and Operating vApps
- Summary of vCloud API vApp and Virtual Machine Operations Requests
- Create a vApp From a Template
- Create a vApp From an OVF Package
- Compose a vApp From Existing Virtual Machines
- Recompose a vApp to Add or Remove Virtual Machines
- Clone a vApp
- Capture a vApp as a Template
- Update vApp Access Controls
- Provide User Input Requested by a Virtual Machine
- Attach or Detach an Independent Disk
- Creating and Using vApp Snapshots
- Operate a vApp
- Configuring vApps and Virtual Machines
- Retrieve the Configuration Links for a vApp
- Retrieve the Configuration Links for a Virtual Machine
- Update Multiple Sections of a Virtual Machine
- Retrieve or Update a Modifiable Section
- Update a vApp Network Configuration
- Update the NetworkConnectionSection of a Virtual Machine
- Retrieve or Modify the CPU Configuration of a Virtual Machine
- Retrieve or Modify the GuestCustomizationSection of a Virtual Machine
- Retrieve or Modify ProductSection Elements
- Retrieve or Modify Groups of Related Sections in a Virtual Machine
- Retrieve or Modify the Hard Disk Configuration of a Virtual Machine
- Update the Storage Profile for a Virtual Machine
- Creating and Managing Organizations
- Summary of Administrative Requests
- Administrator Credentials and Privileges
- Organization Administration
- VDC Administration
- Network Administration
- Catalog Administration
- User and Group Administration
- Working With Roles and Rights
- Managing and Monitoring a Cloud
- Summary of System Administration Requests
- Retrieve or Update System Settings
- Attach a vCenter Server
- Finding Available vCenter Resources
- Create a Provider VDC
- Create an External Network
- Create a Network Pool
- Import a Virtual Machine from vCenter
- Relocate a Virtual Machine to a Different Datastore
- Truststore and Keytab Maintenance
- Retrieve the vSphere URL of an Object
- Working With Object Metadata
- Using the Query Service
- Configuring and Using Blocking Tasks and Notifications
- vCloud Director Extension Services
- XML Representations in the vCloud API
- Index
Create a Role
An organization administrator can create a role by aggregating a set of rights in a Role element and
POSTing it to the organization's add URL for roles.
Prerequisites
Verify that you are logged in to the vCloud API as an organization administrator or system administrator.
Procedure
1 Create a Role element that defines the role with a name and a set of rights.
To get the RightReference objects that populate the Role, retrieve the administrative view of the cloud,
using a request like this one:
GET https://vcloud.example.com/api/admin
The VCloud element returned by this request includes a RightReferences element that contains
RightReference elements that show the name and href for each right defined in the cloud. For example:
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: Copy"
href="https://vcloud.example.com/api/admin/right/4965b0e7-9ed8-371d-8b08-fc716d20bf4b" />
2 POST the Role element to the organization's add URL for roles.
See the request portion of “Example: Create a Role,” on page 231.
The server creates a Role element and returns its representation to the client.
Example: Create a Role
This example adds a role named vAppWrangler to the organization created in “Example: Create an
Organization,” on page 153. The rights associated with this new role are less comprehensive than those
associated with the built-in vApp Author role, but still include rights to perform many common vApp
operations.
NOTE This example uses href attributes that contain actual UUID values for specific rights, since these are
invariant across vCloud Director installations and releases.
Request:
POST https://vcloud.example.com/api/admin/roles
Content-Type: application/vnd.vmware.admin.role+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Role
name="vAppWrangler"
xmlns="http://www.vmware.com/vcloud/v1.5">
<Description>Create and manage vApps</Description>
<RightReferences>
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: Copy"
href="https://vcloud.example.com/api/admin/right/4965b0e7-9ed8-371d-8b08-
fc716d20bf4b" />
<RightReference
type="application/vnd.vmware.admin.right+xml"
Chapter 6 Creating and Managing Organizations
VMware, Inc. 231