2 # -------------------------------------------------------------------------
3 # Copyright (c) 2015-2017 AT&T Intellectual Property
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
20 """Music - Common Methods"""
22 from oslo_log import log as logging
24 from conductor.common import db_backend
25 from conductor.common.music import api
27 LOG = logging.getLogger(__name__)
30 def music_api(configuration):
31 """Create or return a Music API instance"""
33 configuration = dict(configuration)
35 'host': configuration.get('host'),
36 'port': configuration.get('port'),
37 'version': configuration.get('version'),
38 'replication_factor': configuration.get('replication_factor'),
40 api_instance = db_backend.get_client(**kwargs)
42 # Create the keyspace if necessary
43 # TODO(jdandrea): Use oslo.config with a [music] section
44 # keyspace = conf.music.get('keyspace')
45 # api_instance.create_keyspace(keyspace)