Loading modules/cloud_service_providers/aws_cloud/aws_cloud.services.yml +0 −4 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.services.yml: 0 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -60,10 +60,6 @@ services: class: Drupal\aws_cloud\Access\AwsCloudAccess arguments: ['@aws_cloud.ec2','@aws_cloud.iam', '@cloud.cache', '@database', '@config.factory'] aws_cloud.ec2_operations: class: Drupal\aws_cloud\Service\Ec2\Ec2OperationsService arguments: ['@entity_type.manager', '@aws_cloud.ec2'] aws_cloud.cloud_orchestrator_manager: class: Drupal\aws_cloud\Service\AwsCloud\AwsCloudCloudOrchestratorManager arguments: ['@aws_cloud.cloud_formation', '@entity_field.manager', '@entity_type.manager'] Loading modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +1 −46 Changes for modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php: 1 added line, 46 removed lines. Original line number Diff line number Diff line Loading @@ -3,12 +3,10 @@ namespace Drupal\aws_cloud\Controller\Ec2; use Drupal\aws_cloud\Entity\Ec2\ElasticIp; use Drupal\aws_cloud\Entity\Ec2\Instance; use Drupal\aws_cloud\Entity\Ec2\InstanceInterface; use Drupal\aws_cloud\Entity\Ec2\NetworkInterface; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\CloudWatch\CloudWatchServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; use Drupal\aws_cloud\Traits\AwsCloudEntityCheckTrait; use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface; Loading Loading @@ -57,13 +55,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { */ private $ec2Service; /** * The AWS Cloud EC2 operation service. * * @var \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface */ private $ec2OperationsService; /** * The Messenger service. * Loading Loading @@ -134,8 +125,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { * The AWS Cloud Operations service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service * Object for interfacing with AWS API. * @param \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface $ec2_operations_service * The AWS Cloud EC2 operations API service. * @param \Drupal\Core\Messenger\Messenger $messenger * Messenger Object. * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack Loading @@ -156,7 +145,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, Ec2OperationsServiceInterface $ec2_operations_service, Messenger $messenger, RequestStack $request_stack, RendererInterface $renderer, Loading @@ -168,7 +156,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $this->awsCloudOperationsService = $aws_cloud_operations_service; $this->ec2Service = $ec2_service; $this->ec2OperationsService = $ec2_operations_service; $this->messenger = $messenger; $this->requestStack = $request_stack; $this->renderer = $renderer; Loading @@ -193,7 +180,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('aws_cloud.ec2_operations'), $container->get('messenger'), $container->get('request_stack'), $container->get('renderer'), Loading Loading @@ -744,7 +730,7 @@ class ApiController extends ControllerBase implements ApiControllerInterface { } // Execute AWS API. $result = $this->ec2OperationsService->getConsoleOutput($entity); $result = $this->awsCloudOperationsService->getConsoleOutput($entity); return !empty($result) ? new JsonResponse([ Loading @@ -771,37 +757,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new JsonResponse(['result' => 'OK']); } /** * {@inheritdoc} */ public function operateInstance(Request $request, string $cloud_context, string $entity_id, string $command): JsonResponse { $entity = $command !== 'create' ? $this->getInstanceEntity($entity_id) : Instance::create(); if (empty($entity)) { return new JsonResponse([ 'result' => 'NG', 'reason' => 'The instance has already been deleted.', ], 404); } $result = FALSE; $method_name = "${command}Instance"; if (method_exists($this->ec2OperationsService, $method_name)) { $result = $this->ec2OperationsService->$method_name($entity, NULL); } return !empty($result) ? new JsonResponse([ 'result' => 'OK', ], 200) : new JsonResponse([ 'result' => 'NG', 'reason' => 'Internal Server Error', ], 500); } /** * {@inheritdoc} */ Loading modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiControllerInterface.php +0 −17 Changes for modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiControllerInterface.php: 0 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -174,23 +174,6 @@ interface ApiControllerInterface { */ public function refreshEntity(string $cloud_context, string $entity_type_id, string $entity_id): JsonResponse; /** * Operate AWS Cloud instance. * * @param \Symfony\Component\HttpFoundation\Request $request * HTTP request. * @param string $cloud_context * The cloud context. * @param string $entity_id * The entity ID. * @param string $command * Operation command. * * @return \Symfony\Component\HttpFoundation\JsonResponse * The JSON response. */ public function operateInstance(Request $request, string $cloud_context, string $entity_id, string $command): JsonResponse; /** * Operate OpenStack entity. * Loading modules/cloud_service_providers/aws_cloud/src/Form/Ec2/InstanceConsoleOutputForm.php +12 −14 Changes for modules/cloud_service_providers/aws_cloud/src/Form/Ec2/InstanceConsoleOutputForm.php: 12 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\aws_cloud\Form\Ec2; use Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface; use Drupal\cloud\Service\CloudServiceInterface; Loading Loading @@ -37,19 +37,19 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { private $ansiStringRenderer; /** * The AWS Cloud EC2 operation service. * The AWS Cloud Operations service. * * @var \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface * @var \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface */ private $ec2OperationsService; protected $awsCloudOperationsService; /** * InstanceConsoleOutputForm constructor. * * @param \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface $aws_cloud_operations_service * The AWS Cloud Operations service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service * The AWS Cloud or OpenStack EC2 Service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface $ec2_operations_service * The AWS Cloud EC2 operations API service. * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository * The entity repository service. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info Loading Loading @@ -81,8 +81,9 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { * @param \Drupal\cloud\Service\AnsiStringRendererInterface $ansi_string_renderer * The ANSI string renderer. */ public function __construct(Ec2ServiceInterface $ec2_service, Ec2OperationsServiceInterface $ec2_operations_service, public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, Loading Loading @@ -117,7 +118,7 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { ); $this->ansiStringRenderer = $ansi_string_renderer; $this->ec2OperationsService = $ec2_operations_service; $this->awsCloudOperationsService = $aws_cloud_operations_service; } /** Loading @@ -125,8 +126,8 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { */ public static function create(ContainerInterface $container) { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('aws_cloud.ec2_operations'), $container->get('entity.repository'), $container->get('entity_type.bundle.info'), $container->get('datetime.time'), Loading @@ -149,11 +150,8 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $cloud_context = ''): array { $entity = $this->entity; $output = $this->ec2OperationsService->getConsoleOutput($entity); $output = $this->awsCloudOperationsService->getConsoleOutput($this->entity); $form['log'] = $this->ansiStringRenderer->render($output); return $form; } Loading modules/cloud_service_providers/aws_cloud/src/Service/AwsCloud/AwsCloudOperationsService.php +235 −88 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
modules/cloud_service_providers/aws_cloud/aws_cloud.services.yml +0 −4 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.services.yml: 0 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -60,10 +60,6 @@ services: class: Drupal\aws_cloud\Access\AwsCloudAccess arguments: ['@aws_cloud.ec2','@aws_cloud.iam', '@cloud.cache', '@database', '@config.factory'] aws_cloud.ec2_operations: class: Drupal\aws_cloud\Service\Ec2\Ec2OperationsService arguments: ['@entity_type.manager', '@aws_cloud.ec2'] aws_cloud.cloud_orchestrator_manager: class: Drupal\aws_cloud\Service\AwsCloud\AwsCloudCloudOrchestratorManager arguments: ['@aws_cloud.cloud_formation', '@entity_field.manager', '@entity_type.manager'] Loading
modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +1 −46 Changes for modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php: 1 added line, 46 removed lines. Original line number Diff line number Diff line Loading @@ -3,12 +3,10 @@ namespace Drupal\aws_cloud\Controller\Ec2; use Drupal\aws_cloud\Entity\Ec2\ElasticIp; use Drupal\aws_cloud\Entity\Ec2\Instance; use Drupal\aws_cloud\Entity\Ec2\InstanceInterface; use Drupal\aws_cloud\Entity\Ec2\NetworkInterface; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\CloudWatch\CloudWatchServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; use Drupal\aws_cloud\Traits\AwsCloudEntityCheckTrait; use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface; Loading Loading @@ -57,13 +55,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { */ private $ec2Service; /** * The AWS Cloud EC2 operation service. * * @var \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface */ private $ec2OperationsService; /** * The Messenger service. * Loading Loading @@ -134,8 +125,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { * The AWS Cloud Operations service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service * Object for interfacing with AWS API. * @param \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface $ec2_operations_service * The AWS Cloud EC2 operations API service. * @param \Drupal\Core\Messenger\Messenger $messenger * Messenger Object. * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack Loading @@ -156,7 +145,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, Ec2OperationsServiceInterface $ec2_operations_service, Messenger $messenger, RequestStack $request_stack, RendererInterface $renderer, Loading @@ -168,7 +156,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $this->awsCloudOperationsService = $aws_cloud_operations_service; $this->ec2Service = $ec2_service; $this->ec2OperationsService = $ec2_operations_service; $this->messenger = $messenger; $this->requestStack = $request_stack; $this->renderer = $renderer; Loading @@ -193,7 +180,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('aws_cloud.ec2_operations'), $container->get('messenger'), $container->get('request_stack'), $container->get('renderer'), Loading Loading @@ -744,7 +730,7 @@ class ApiController extends ControllerBase implements ApiControllerInterface { } // Execute AWS API. $result = $this->ec2OperationsService->getConsoleOutput($entity); $result = $this->awsCloudOperationsService->getConsoleOutput($entity); return !empty($result) ? new JsonResponse([ Loading @@ -771,37 +757,6 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new JsonResponse(['result' => 'OK']); } /** * {@inheritdoc} */ public function operateInstance(Request $request, string $cloud_context, string $entity_id, string $command): JsonResponse { $entity = $command !== 'create' ? $this->getInstanceEntity($entity_id) : Instance::create(); if (empty($entity)) { return new JsonResponse([ 'result' => 'NG', 'reason' => 'The instance has already been deleted.', ], 404); } $result = FALSE; $method_name = "${command}Instance"; if (method_exists($this->ec2OperationsService, $method_name)) { $result = $this->ec2OperationsService->$method_name($entity, NULL); } return !empty($result) ? new JsonResponse([ 'result' => 'OK', ], 200) : new JsonResponse([ 'result' => 'NG', 'reason' => 'Internal Server Error', ], 500); } /** * {@inheritdoc} */ Loading
modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiControllerInterface.php +0 −17 Changes for modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiControllerInterface.php: 0 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -174,23 +174,6 @@ interface ApiControllerInterface { */ public function refreshEntity(string $cloud_context, string $entity_type_id, string $entity_id): JsonResponse; /** * Operate AWS Cloud instance. * * @param \Symfony\Component\HttpFoundation\Request $request * HTTP request. * @param string $cloud_context * The cloud context. * @param string $entity_id * The entity ID. * @param string $command * Operation command. * * @return \Symfony\Component\HttpFoundation\JsonResponse * The JSON response. */ public function operateInstance(Request $request, string $cloud_context, string $entity_id, string $command): JsonResponse; /** * Operate OpenStack entity. * Loading
modules/cloud_service_providers/aws_cloud/src/Form/Ec2/InstanceConsoleOutputForm.php +12 −14 Changes for modules/cloud_service_providers/aws_cloud/src/Form/Ec2/InstanceConsoleOutputForm.php: 12 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\aws_cloud\Form\Ec2; use Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface; use Drupal\cloud\Service\CloudServiceInterface; Loading Loading @@ -37,19 +37,19 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { private $ansiStringRenderer; /** * The AWS Cloud EC2 operation service. * The AWS Cloud Operations service. * * @var \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface * @var \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface */ private $ec2OperationsService; protected $awsCloudOperationsService; /** * InstanceConsoleOutputForm constructor. * * @param \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface $aws_cloud_operations_service * The AWS Cloud Operations service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service * The AWS Cloud or OpenStack EC2 Service. * @param \Drupal\aws_cloud\Service\Ec2\Ec2OperationsServiceInterface $ec2_operations_service * The AWS Cloud EC2 operations API service. * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository * The entity repository service. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info Loading Loading @@ -81,8 +81,9 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { * @param \Drupal\cloud\Service\AnsiStringRendererInterface $ansi_string_renderer * The ANSI string renderer. */ public function __construct(Ec2ServiceInterface $ec2_service, Ec2OperationsServiceInterface $ec2_operations_service, public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, Loading Loading @@ -117,7 +118,7 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { ); $this->ansiStringRenderer = $ansi_string_renderer; $this->ec2OperationsService = $ec2_operations_service; $this->awsCloudOperationsService = $aws_cloud_operations_service; } /** Loading @@ -125,8 +126,8 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { */ public static function create(ContainerInterface $container) { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('aws_cloud.ec2_operations'), $container->get('entity.repository'), $container->get('entity_type.bundle.info'), $container->get('datetime.time'), Loading @@ -149,11 +150,8 @@ class InstanceConsoleOutputForm extends AwsCloudContentForm { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $cloud_context = ''): array { $entity = $this->entity; $output = $this->ec2OperationsService->getConsoleOutput($entity); $output = $this->awsCloudOperationsService->getConsoleOutput($this->entity); $form['log'] = $this->ansiStringRenderer->render($output); return $form; } Loading
modules/cloud_service_providers/aws_cloud/src/Service/AwsCloud/AwsCloudOperationsService.php +235 −88 File changed.Preview size limit exceeded, changes collapsed. Show changes