12 state change message bus, 13 developer tools in a web browser, 14 powershell and python code sample libraries – HP OneView User Manual

Page 76: Powershell library, Python library

Advertising
background image

The simplest way to make sure that you have retrieved all resources in a specific collection is to
always perform iterative GET requests using the returned nextPageUri until the value is null.
See the following example in pseudo-code based on any filters/queries and sort order:

currentCollection = doGet("/rest/server-hardware");
allResources = currentCollection.members;
While (currentCollection.nextPageUri) {
currentCollection = doGet(currentCollection.nextPageUri);
allResources.Append(currentCollection.members);
}

5.12 State Change Message Bus

The State-Change Message Bus (SCMB) is an interface that uses asynchronous messaging to notify
subscribers of changes to managed resources—both logical and physical. For example, you can
program applications to receive notifications when new server hardware is added to the managed
environment or when the health status of physical resources changes—without having to continuously
poll the appliance for status using the REST APIs. To learn more about receiving asynchronous
messages about changes in the appliance environment, see

“Using the State-Change Message

Bus (SCMB)” (page 203)

.

5.13 Developer tools in a web browser

You can use developer/debug tools in your web browser to view the REST API operations as they
happen in the UI. The UI uses REST APIs for all operations; therefore, anything you can do in the
UI can be done using REST API operations.

5.14 PowerShell and Python code sample libraries

Windows PowerShell and Python libraries are available on Git-compliant websites to download
and use for your REST API scripting. The libraries are currently under the MIT OpenSource license,
and you can modify the source code for your own purposes. Each library provides methods for
you to submit feedback, issues, and other discussions to HP.

About Git version control:

The repository layouts and overall workflows use a very standard simple workflow where the master
branch is always the top of tree trunk. HP tags each release and branches a release only to fix an
issue on a specific release.

To learn more about using Git, see

http://git-scm.com/book

.

NOTE:

If you have questions about REST API scripting or HP OneView in general, post your

questions to the user community forum at

http://www.hp.com/go/oneviewcommunity

.

PowerShell library

The PowerShell library is hosted on CodePlex and is available here:

http://

hponeview.codeplex.com

. To subscribe to the site and monitor the project, you need a valid

Microsoft or CodePlex account. Downloading releases or source code does not require
authentication.

For ease of use when the library is updated, a new installer is provided.

You can use a browser or a GIT Windows client to download the source code and samples. To
download the Windows client, see

http://windows.github.com/

.

The CodePlex site provides an issues tracker to submit issues or feature requests.

Python library

The Python library is hosted on a GitHub website and is available here:

https://github.com/

HewlettPackard/python-hpOneView

.

76

Using the REST APIs and other programmatic interfaces

Advertising