Esempio n. 1
0
def make_client(instance):
    """Returns a CSS proxy"""

    conn = instance.sdk_connection

    # register unconditionally, since we need to override default CES
    sdk.register_otc_extensions(conn)

    LOG.debug('css client initialized using OpenStack OTC SDK: %s', conn.ces)
    return conn.css
Esempio n. 2
0
def make_client(instance):
    """Returns a KMS proxy"""

    conn = instance.sdk_connection

    if getattr(conn, 'kms', None) is None:
        LOG.debug('OTC extensions are not registered. Do that now')
        sdk.register_otc_extensions(conn)

    LOG.debug('KMS client initialized using OpenStack OTC SDK: %s', conn.kms)
    return conn.kms
#!/usr/bin/env python3
# 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.
"""
 Find connection
"""
import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

attrs = {
    "name_or_id": "name-or-uuid",
}

c = conn.dcaas.find_connection(**attrs)
print(c)
Esempio n. 4
0
 def setUp(self):
     super(BaseFunctionalTest, self).setUp()
     self.conn = connection.Connection(config=TEST_CLOUD_REGION)
     sdk.register_otc_extensions(self.conn)
Esempio n. 5
0
 def setUpClass(cls):
     super(BaseFunctionalTest, cls).setUpClass()
     cls.conn = connection.Connection(config=TEST_CLOUD_REGION)
     sdk.register_otc_extensions(cls.conn)