Git Product home page Git Product logo

osc_workspace's Introduction

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

osc_workspace's People

Contributors

iamfive avatar chenensheng123 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.