Skip to content

huaweicloudsdk/osc_workspace

Repository files navigation

python-workspaceclient

This is a OpenStack Client plugin for HuaWei Workspace Management API which provides command-line scripts (integrated with openstack) and Python library for accessing the Workspace management API.

Installation

1. Install python-openstackclient

This project is a plugin of OpenStack Client. Therefor, you need to have OpenStack Client installed before using the plugin. You can install OpenStack Client by pip:

pip install python-openstackclient

To get more information about python-openstackclient, please check the official site OpenStack Client

2. Install plugin

Currently, We can install the plugin from source code

$ git clone https://github.com/Huawei/OpenStackClient_Workspace
python-workspaceclient
$ cd python-workspaceclient
# use python setup.py develop for test purpose
$ python setup.py install
$ pip install -r requirements.txt

Command Line Client Usage

This plugin is integrated with `OpenStack Client`_ , so the command line
client has all features openstack provided.

User help command:

$ openstack --help
usage: openstack [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]
             [--os-cloud <cloud-config-name>]
             [--os-region-name <auth-region-name>]
             [--os-cacert <ca-bundle-file>] [--os-cert <certificate-file>]
             [--os-key <key-file>] [--verify | --insecure]
             [--os-default-domain <auth-domain>]
             [--os-interface <interface>] [--timing] [--os-beta-command]
             [--os-profile hmac-key]
             [--os-compute-api-version <compute-api-version>]
             [--os-network-api-version <network-api-version>]
             [--os-image-api-version <image-api-version>]
             [--os-volume-api-version <volume-api-version>]
             [--os-identity-api-version <identity-api-version>]
             [--os-object-api-version <object-api-version>]
             [--os-queues-api-version <queues-api-version>]
             [--os-clustering-api-version <clustering-api-version>]
             [--os-search-api-version <search-api-version>]
             .......

Provided Commands

The command line client is self-documenting. Use the --help or -h flag to access the usage options. You can find more command line client examples here

desktop list
desktop detail list
desktop create
desktop delete
desktop reboot
desktop start
desktop stop
desktop edit
desktop show
desktop user list
desktop login list
workspace enable
workspace show
workspace edit
workspace disable
workspace policy show
workspace policy edit
workspace product list
workspace job show

Python Library Usage

The full api is documented in the Workspace Offical Document site

Here's an example of listing metric types using Python library with keystone V3 authentication:

>>> from keystoneauth1 import session
>>> from keystoneauth1 import identity
>>> from cloudeyeclient.v1 import client

>>> # Use Keystone API v3 for authentication as example
>>> auth = identity.v3.Password(auth_url=u'http://localhost:5000/v3',
...                             username=u'admin_user',
...                             user_domain_name=u'Default',
...                             password=u'password',
...                             project_name=u'demo',
...                             project_domain_name=u'Default')

>>> # Next create a Keystone session using the auth plugin we just created
>>> session = session.Session(auth=auth)

>>> # Now we use the session to create a CloudEye client
>>> client = client.Client(session=session)

>>> # Then we can access all Workspace API
>>> # Let's try get workspace API
>>> client.workspaces.get()
<Metric domain_type=LITE_AD ....>

Note

The example above must be running and configured to use the Keystone Middleware.

For more information on setting this up please visit: KeyStone

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages