Exemple #1
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()

    wsgi_app = api = falcon.API()
    api.add_route('/', versions)
    api.add_route('/v1/{keystone_id}/secrets', secrets)
    api.add_route('/v1/{keystone_id}/secrets/{secret_id}', secret)
    api.add_route('/v1/{keystone_id}/orders', orders)
    api.add_route('/v1/{keystone_id}/orders/{order_id}', order)

    return wsgi_app
    def setUp(self):
        self.policy = MagicMock()

        self.req = MagicMock()
        self.resp = MagicMock()
        self.policy = MagicMock()
        self.resource = res.VersionResource(self.policy)
Exemple #3
0
def create_admin_app(global_config, **local_conf):
    config.parse_args()

    versions = res.VersionResource()
    wsgi_app = api = falcon.API()
    api.add_route('/', versions)

    return wsgi_app
Exemple #4
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Queuing initialization
    CONF = cfg.CONF
    queue.init(CONF)

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()
    verifications = res.VerificationsResource()
    verification = res.VerificationResource()
    containers = res.ContainersResource()
    container = res.ContainerResource()

    # For performance testing only
    performance = res.PerformanceResource()
    performance_uri = 'mu-1a90dfd0-7e7abba4-4e459908-fc097d60'

    wsgi_app = api = falcon.API()
    if newrelic_loaded:
        wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)

    api.add_route('/', versions)
    api.add_route('/v1/{keystone_id}/secrets', secrets)
    api.add_route('/v1/{keystone_id}/secrets/{secret_id}', secret)
    api.add_route('/v1/{keystone_id}/orders', orders)
    api.add_route('/v1/{keystone_id}/orders/{order_id}', order)
    api.add_route('/v1/{keystone_id}/verifications', verifications)
    api.add_route('/v1/{keystone_id}/verifications/{verification_id}',
                  verification)
    api.add_route('/v1/{keystone_id}/containers/', containers)
    api.add_route('/v1/{keystone_id}/containers/{container_id}', container)

    # For performance testing only
    api.add_route('/{0}'.format(performance_uri), performance)

    return wsgi_app
    def setUp(self):
        super(WhenTestingVersionResource, self).setUp()

        self.resource = res.VersionResource()