Add masakari openstackclient library

Implement openstackclient library for masakari.

Change-Id: Ia8a218624ffea6da5cbfdd0411c602e3c61e2c8a
This commit is contained in:
Takahiro Izumi 2016-11-02 07:04:19 +00:00
parent a25c7c0565
commit e182f6fefa
9 changed files with 117 additions and 0 deletions

View File

View File

@ -0,0 +1,28 @@
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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.
import oslo_i18n
_translators = oslo_i18n.TranslatorFactory(domain='masakariclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

View File

View File

@ -0,0 +1,39 @@
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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 openstack import connection
from openstack import profile
def create_connection(prof=None, user_agent=None, **kwargs):
if not prof:
prof = profile.Profile()
interface = kwargs.pop('interface', None)
region_name = kwargs.pop('region_name', None)
if interface:
prof.set_interface('vmha', interface)
if region_name:
prof.set_region('vmha', region_name)
prof.set_api_version('vmha', '1')
try:
conn = connection.Connection(profile=prof, user_agent=user_agent,
**kwargs)
except Exception as e:
raise e
return conn

View File

View File

@ -0,0 +1,22 @@
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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 openstack import proxy
class Proxy(proxy.BaseProxy):
"""Proxy class for vmha resource handling.
Create method for each action of each API.
"""

View File

@ -0,0 +1,26 @@
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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 openstack import service_filter
class VMHAService(service_filter.ServiceFilter):
"""The VMHA service."""
valid_versions = [service_filter.ValidVersion('v1')]
def __init__(self, version=None):
"""Create an vmha service."""
super(VMHAService, self).__init__(service_type='vmha',
version=version)

View File

@ -2,4 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
openstacksdk>=0.9.7 # Apache-2.0
oslo.i18n>=2.1.0 # Apache-2.0
pbr>=1.6 # Apache-2.0