Skip to content

cym8408011/OpenStackClient_Auto-Scaling

 
 

Repository files navigation

python-asclient

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

Installation

Currently, We can install the plugin from source code

$ git clone https://github.com/Huawei/OpenStackClient_Auto-Scaling python-asclient
$ cd python-asclient
# 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

Python Library Usage

The full api is documented in the AutoScaling 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 asclient.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 AutoScaling client
>>> client = client.Client(session=session)

>>> # Then we can access all AutoScaling API
>>> client.groups.get(group_id)
<AutoScalingGroup name= ....>

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

Releases

No releases published

Packages

No packages published

Languages

  • HTML 50.5%
  • Python 43.8%
  • JavaScript 4.4%
  • CSS 1.3%