Commit fa40c506 authored by Masami  Suzuki's avatar Masami Suzuki Committed by Yas Naoi
Browse files

Issue #3311665 by Masami, yas, Ryo Yamashita: Add the function to delete AWS...

Issue #3311665 by Masami, yas, Ryo Yamashita: Add the function to delete AWS Subnet / VPC / VPC Peering Connection in the SPA
parent 8fd6cd47
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -48,7 +48,19 @@ const AWS_CLOUD_SUBNET_TEMPLATE: EntityFormTemplate[] = [
        ]
      }
    ]
  }
  },
  {
    cloudServiceProvider: 'aws_cloud',
    entityName: 'subnet',
    actionType: 'delete',
    entityRecords: [
      {
        type: 'label',
        text: 'Are you sure you want to delete the {{entityName}} {{name}}?'
      },
    ],
    submitButtonLabel: 'Delete'
  },
]

export default AWS_CLOUD_SUBNET_TEMPLATE;
+13 −1
Original line number Diff line number Diff line
@@ -62,7 +62,19 @@ const AWS_CLOUD_VPC_TEMPLATE: EntityFormTemplate[] = [
        ]
      }
    ]
  }
  },
  {
    cloudServiceProvider: 'aws_cloud',
    entityName: 'vpc',
    actionType: 'delete',
    entityRecords: [
      {
        type: 'label',
        text: 'Are you sure you want to delete the {{entityName}} {{name}}?'
      },
    ],
    submitButtonLabel: 'Delete'
  },
]

export default AWS_CLOUD_VPC_TEMPLATE;
+13 −1
Original line number Diff line number Diff line
@@ -191,7 +191,19 @@ const AWS_CLOUD_VPC_PEERING_CONNECTION: EntityFormTemplate[] = [
        ]
      }
    ]
  }
  },
  {
    cloudServiceProvider: 'aws_cloud',
    entityName: 'vpc_peering_connection',
    actionType: 'delete',
    entityRecords: [
      {
        type: 'label',
        text: 'Are you sure you want to delete the {{entityName}} {{name}}?'
      },
    ],
    submitButtonLabel: 'Delete'
  },
]

export default AWS_CLOUD_VPC_PEERING_CONNECTION;
+40 −0
Original line number Diff line number Diff line
@@ -1604,6 +1604,18 @@ entity.aws_cloud_vpc.edit:
  options:
    perm: 'edit any aws cloud vpcy+edit own aws cloud vpc'

entity.aws_cloud_vpc.delete:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_vpc/{entity_id}/delete'
  defaults:
    _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity'
    entity_type_id: aws_cloud_vpc
    command: delete
  methods: [ POST ]
  requirements:
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
  options:
    perm: 'delete any aws cloud vpcy+delete own aws cloud vpc'

entity.aws_cloud_subnet.create:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_subnet/create'
  defaults:
@@ -1629,6 +1641,20 @@ entity.aws_cloud_subnet.edit:
  options:
    perm: 'edit any aws cloud subnet+edit own aws cloud subnet'

entity.aws_cloud_subnet.delete:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_subnet/{entity_id}/delete'
  defaults:
    _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity'
    entity_type_id: aws_cloud_subnet
    command: delete
  methods: [ POST ]
  requirements:
    # Use custom access that will check for cloud_context and the desired permission.
    # Desired permission is passed as an option in the "perm" variable
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
  options:
    perm: 'delete any aws cloud subnet+delete own aws cloud subnet'

entity.aws_cloud_vpc_peering_connection.create:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_vpc_peering_connection/create'
  defaults:
@@ -1654,6 +1680,20 @@ entity.aws_cloud_vpc_peering_connection.edit:
  options:
    perm: 'edit any aws cloud vpc peering connection+edit own aws cloud vpc peering connection'

entity.aws_cloud_vpc_peering_connection.delete:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_vpc_peering_connection/{entity_id}/delete'
  defaults:
    _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity'
    entity_type_id: aws_cloud_vpc_peering_connection
    command: delete
  methods: [ POST ]
  requirements:
    # Use custom access that will check for cloud_context and the desired permission.
    # Desired permission is passed as an option in the "perm" variable
    _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
  options:
    perm: 'delete any aws cloud vpc peering connection+delete own aws cloud vpc peering connection'

entity.aws_cloud_snapshot.create:
  path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_snapshot/create'
  defaults:
+12 −0
Original line number Diff line number Diff line
@@ -1078,10 +1078,22 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
          $method_name = 'deleteSnapshot';
          break;

        case 'delete_aws_cloud_subnet':
          $method_name = 'deleteSubnet';
          break;

        case 'delete_aws_cloud_volume':
          $method_name = 'deleteVolume';
          break;

        case 'delete_aws_cloud_vpc':
          $method_name = 'deleteVpc';
          break;

        case 'delete_aws_cloud_vpc_peering_connection':
          $method_name = 'deleteVpcPeeringConnection';
          break;

        case 'disassociate_aws_cloud_elastic_ip':
          $method_name = 'disassociateElasticIp';
          break;
Loading