Commit 6972be40 authored by Ryo Yamashita's avatar Ryo Yamashita Committed by Yas Naoi
Browse files

Issue #3301042 by Ryo Yamashita, yas: Add the function to delete AWS Cloud Key Pair in the SPA

parent fff085a0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,18 @@ const AWS_CLOUD_KEY_PAIR_TEMPLATE: EntityFormTemplate[] = [
      }
    ]
  },
  {
    cloudServiceProvider: 'aws_cloud',
    entityName: 'key_pair',
    actionType: 'delete',
    entityRecords: [
      {
        type: 'label',
        text: 'Are you sure you want to delete the {{entityName}} {{key_pair_name}}?'
      },
    ],
    submitButtonLabel: 'Delete'
  },
]

export default AWS_CLOUD_KEY_PAIR_TEMPLATE;
+10 −0
Original line number Diff line number Diff line
@@ -1076,6 +1076,16 @@ entity.aws_cloud_instance.stop:
  requirements:
    _entity_access: 'aws_cloud_instance.stop'

entity.aws_cloud_key_pair.delete:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_key_pair/{entity_id}/delete'
  defaults:
    _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity'
    entity_type_id: aws_cloud_key_pair
    command: delete
  methods: [POST]
  requirements:
    _permission: 'delete any aws cloud key pair'

entity.aws_cloud_security_group.create:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_security_group/{entity_id}/create'
  defaults:
+4 −0
Original line number Diff line number Diff line
@@ -838,6 +838,10 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
          $method_name = 'deleteInstance';
          break;

        case 'delete_aws_cloud_key_pair':
          $method_name = 'deleteKeyPair';
          break;

        case 'edit_aws_cloud_image':
          /** @var \Drupal\aws_cloud\Entity\Ec2\ImageInterface $entity */
          $entity->setName($request->get('name', ''));
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@ interface KeyPairInterface extends ContentEntityInterface, EntityOwnerInterface,
   */
  public function getCloudContext(): ?string;

  /**
   * {@inheritdoc}
   */
  public function getName(): ?string;

  /**
   * {@inheritdoc}
   */
+0 −2
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@ class ImageDeleteForm extends AwsDeleteUpdateEntityForm {
   *
   * @param \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface $aws_cloud_operations_service
   *   The AWS Cloud Operations service.
   * @param \Drupal\openstack\Service\OpenStackServiceFactoryInterface $openstack_service_factory
   *   Object for interfacing with OpenStack Service.
   * @param \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service
   *   The AWS Cloud EC2 service.
   * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
Loading