~ubuntu-branches/ubuntu/wily/python-oslo.vmware/wily

« back to all changes in this revision

Viewing changes to doc/source/usage.rst

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-11 09:25:22 UTC
  • mfrom: (1.1.12) (2.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150811092522-6epbeuzn6a0jt750
Tags: 1.18.0-2ubuntu1
* Resync with Debian experimental.
* d/pydist-overrides: Map suds-jurko -> suds to ease backporting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Usage
3
3
========
4
4
 
5
 
To use in a project::
6
 
 
7
 
        from oslo_vmware import api
8
 
        from oslo_vmware import vim_util
9
 
 
10
 
        api_session = api.VMwareAPISession('10.1.2.3', 'administrator',
11
 
                                           'password', 10, 0.1,
12
 
                                           create_session=False, port=443)
13
 
        result = api_session.invoke_api(vim_util, 'get_objects',
14
 
                                        api_session.vim, 'HostSystem', 100)
 
5
Example usage of getting a handle to a vSphere session and retrieving all the
 
6
ESX hosts in a server::
 
7
 
 
8
    from oslo_vmware import api
 
9
    from oslo_vmware import vim_util
 
10
 
 
11
    # Get a handle to a vSphere API session
 
12
    session = api.VMwareAPISession(
 
13
        '10.1.2.3',      # vSphere host endpoint
 
14
        'administrator', # vSphere username
 
15
        'password',      # vSphere password
 
16
        10,              # Number of retries for connection failures in tasks
 
17
        0.1              # Poll interval for async tasks (in seconds)
 
18
    )
 
19
 
 
20
    # Example call to get all the managed objects of type "HostSystem"
 
21
    # on the server.
 
22
    result = session.invoke_api(
 
23
        vim_util,                           # Handle to VIM utility module
 
24
        'get_objects',                      # API method name to invoke
 
25
        session.vim, 'HostSystem', 100)     # Params to API method (*args)