python-senlinclient/senlinclient/client.py
tengqm 28b9213548 Revised common client to use session
The previous version was using an endpoint.  With sessions we may be
able to provide a Shell like environment without having to create
connections each time.
2015-01-16 15:06:31 +08:00

25 lines
886 B
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from senlinclient.common import utils
def Client(api_ver, session, **kwargs):
'''Import versioned client module.
:param api_ver: API version required.
:param endpoint: endpoint URL requested.
'''
module = utils.import_versioned_module(api_ver, 'client')
cls = getattr(module, 'Client')
return cls(session)