コード例 #1
0
 /**
  * A basic functional test example.
  *
  * @return void
  */
 public function testCreate()
 {
     $_snapshot = Snapshot::create('bender');
 }
コード例 #2
0
 /**
  * @param \DreamFactory\Enterprise\Services\Jobs\ExportJob $job
  *
  * @return array The list of files in the instance's snapshot mount that were created.
  */
 public function export(ExportJob $job)
 {
     try {
         $_instance = $this->_findInstance($job->getInstanceId());
     } catch (ModelNotFoundException $_ex) {
         throw new \RuntimeException('Instance "' . $job->getInstanceId() . '" not found.', Response::HTTP_NOT_FOUND);
     }
     //  Get the portable services of this instance provisioner
     $_services = $this->getPortableServices($_instance->guest_location_nbr);
     //  Allow each service to export individually, collecting the output
     $_exports = [];
     foreach ($_services as $_type => $_service) {
         //@todo I think the following may be replaced with "$_exports[$_type] = $_service->export($job);"
         $_exports[$_type] = $_service->export(PortableServiceRequest::makeExport($_instance, $job->getTarget()));
     }
     return Snapshot::createFromExports($_instance, $_exports, $job->getTarget() ?: array_get($job->getOptions(), 'target'), array_get($job->getOptions(), 'keep-days'));
 }