public function action() { $action = parent::action(); if ($action !== null) { return $action; } $args = $this->getArgs(); $instanceId = $args['instance_id']; $bindingId = $args['binding_id']; $serviceBroker = $this->getServiceBroker($_GET['service_id']); $em = $this->getDoctrineBoot()->getEntityManager(); $repoServiceInstance = $em->getRepository(ServiceInstance::class); $repoBinding = $em->getRepository(\Sphring\MicroWebFramework\Model\Binding::class); $binding = $repoBinding->find($bindingId); $serviceInstance = $repoServiceInstance->find($instanceId); if ($binding === null || $serviceInstance === null) { $serviceBroker->responseGone(); return '{}'; } $returnFromMethod = $serviceBroker->unbinding($repoServiceInstance->find($instanceId), $repoBinding->find($bindingId)); $serviceBroker->afterUnbinding($instanceId, $bindingId); $em->flush(); if ($returnFromMethod !== null) { return $returnFromMethod; } return '{}'; }
public function action() { $action = parent::action(); if ($action !== null) { return $action; } $putData = $this->getInputData(); $data = json_decode($putData, true); $args = $this->getArgs(); $instanceId = $args['instance_id']; $bindingId = $args['binding_id']; $returnFromMethod = null; $serviceBroker = $this->getServiceBroker($data['service_id']); $em = $this->getDoctrineBoot()->getEntityManager(); $repoBinding = $em->getRepository(\Sphring\MicroWebFramework\Model\Binding::class); $em = $this->getDoctrineBoot()->getEntityManager(); $serviceInstance = $serviceBroker->beforeBinding($data, $instanceId, $bindingId); if ($this->response->getStatusCode() === Response::HTTP_CONFLICT) { return '{}'; } if ($this->response->getStatusCode() === Response::HTTP_CREATED) { $returnFromMethod = $serviceBroker->binding($serviceInstance, $repoBinding->find($bindingId)); } $em->flush(); if ($returnFromMethod !== null) { return $returnFromMethod; } return json_encode(['credentials' => $serviceInstance->getCredentials()]); }
public function action() { $action = parent::action(); if ($action !== null) { return $action; } $em = $this->getDoctrineBoot()->getEntityManager(); $repo = $em->getRepository(ServiceDescribe::class); $serviceDescribes = $repo->findAll(); $services = []; foreach ($serviceDescribes as $serviceDescribe) { $services['services'][] = $this->getServiceDescribeAsArray($serviceDescribe); } return json_encode($services); }
public function action() { $action = parent::action(); if ($action !== null) { return $action; } $putData = $this->getInputData(); $data = json_decode($putData, true); $args = $this->getArgs(); $instanceId = $args['instance_id']; $serviceBroker = $this->getServiceBroker($data['service_id']); $em = $this->getDoctrineBoot()->getEntityManager(); $serviceInstance = $serviceBroker->beforeProvisioning($data, $instanceId); $em->flush(); if ($serviceInstance === null) { return '{}'; } $returnFromMethod = $serviceBroker->provisioning($serviceInstance); if ($returnFromMethod !== null) { return $returnFromMethod; } return '{}'; }
public function action() { $action = parent::action(); if ($action !== null) { return $action; } $args = $this->getArgs(); $instanceId = $args['instance_id']; $serviceBroker = $this->getServiceBroker($_GET['service_id']); $em = $this->getDoctrineBoot()->getEntityManager(); $repo = $em->getRepository(ServiceInstance::class); $serviceInstance = $repo->find($instanceId); if ($serviceInstance === null) { $serviceBroker->afterDeprovisioning($instanceId); return '{}'; } $returnFromMethod = $serviceBroker->deprovisioning($serviceInstance); $serviceBroker->afterDeprovisioning($instanceId); $em->flush(); if ($returnFromMethod !== null) { return $returnFromMethod; } return '{}'; }