'Replace the existing configuration with one given by flocker-deploy
command line tool.
:param applications: Configuration in Flocker-native or
Fig/Compose format.
:param deployment: Configuration of which applications run on
which nodes.'

@app.route('/configuration/_compose', methods=['POST'])
@private_api
@structured(inputSchema={'$ref': '/v1/endpoints.json#/definitions/configuration_compose'}, outputSchema={}, schema_store=SCHEMAS)
def replace_configuration(self, applications, deployment):

    try:
        configuration = FigConfiguration(applications)
        if (not configuration.is_valid_format()):
            configuration = FlockerConfiguration(applications)
        return self.persistence_service.save(model_from_configuration(deployment_state=self.cluster_state_service.as_deployment(), applications=configuration.applications(), deployment_configuration=deployment))
    except ConfigurationError as e:
        raise make_bad_request(code=BAD_REQUEST, description=unicode(e))
