def create_api_service(persistence_service, cluster_state_service, endpoint, context_factory, clock=reactor):
 api_root = Resource()
 user = ConfigurationAPIUserV1(persistence_service, cluster_state_service, clock)
 api_root.putChild('v1', user.app.resource())
 api_root._v1_user = user
 return StreamServerEndpointService(endpoint, TLSMemoryBIOFactory(context_factory, False, Site(api_root)))

def create_api_service ( persistence_service , cluster_state_service , endpoint , context_factory , clock = reactor ) : api_root = Resource ( ) user = ConfigurationAPIUserV1 ( persistence_service , cluster_state_service , clock ) api_root . putChild ( 'v1' , user . app . resource ( ) ) api_root . _v1_user = user return StreamServerEndpointService ( endpoint , TLSMemoryBIOFactory ( context_factory , False , Site ( api_root ) ) )
create a twisted service that serves the api on the given endpoint .