Commit 391a425c authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3119115 by Xiaohua Guan, yas: Manage VPC Peering Connections

parent 38d50939
Loading
Loading
Loading
Loading
+35
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.install: 35 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2357,5 +2357,40 @@ function aws_cloud_update_8217() {
      continue;
    }
  }
}

/**
 * Add view and entity type for aws_cloud_vpc_peering_connection.
 */
function aws_cloud_update_8218() {
  try {
    // Add entity type aws_cloud_vpc_peering_connection.
    $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
    $entity_type = \Drupal::entityTypeManager()->getDefinition('aws_cloud_vpc_peering_connection');
    if (!empty($entity_type)) {
      $definition_update_manager->uninstallEntityType($entity_type);
      $definition_update_manager->installEntityType($entity_type);
    }

    $files = [
      'views.view.aws_cloud_vpc_peering_connection.yml',
      'system.action.aws_cloud_vpc_peering_connection_delete_action.yml',
    ];
    cloud_update_yml_definitions($files, 'aws_cloud');

    // Update VPC Peering Connections.
    /* @var \Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface $ec2_service */
    $ec2_service = \Drupal::service('aws_cloud.ec2');
    $entities = \Drupal::service('plugin.manager.cloud_config_plugin')->loadConfigEntities('aws_cloud');

    foreach ($entities as $entity) {
      /* @var \Drupal\cloud\Entity\CloudConfig $entity */
      $ec2_service->setCloudContext($entity->getCloudContext());
      $ec2_service->updateVpcPeeringConnectionsWithoutBatch();
    }
  }
  catch (\Exception $e) {
    // @TODO: Add error handling.
    \Drupal::messenger()->addError("An error occurred: {$e}");
  }
}
+38
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.links.action.yml: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -444,6 +444,44 @@ entity.aws_cloud_vpc.delete:
    - entity.aws_cloud_vpc.canonical


################
# AWS Cloud VPC Peering Connection.
################

entity.aws_cloud_vpc_peering_connection.add_form:
  route_name: entity.aws_cloud_vpc_peering_connection.add_form
  title: 'Add AWS Cloud VPC Peering Connection'
  appears_on:
    - view.aws_cloud_vpc_peering_connection.list

entity.aws_cloud_vpc_peering_connection.collection:
  route_name: view.aws_cloud_vpc_peering_connection.list
  title: 'List AWS Cloud VPC Peering Connections'
  appears_on:
    - entity.aws_cloud_vpc_peering_connection.add_form
    - entity.aws_cloud_vpc_peering_connection.edit_form
    - entity.aws_cloud_vpc_peering_connection.delete_form
    - entity.aws_cloud_vpc_peering_connection.canonical

entity.aws_cloud_vpc_peering_connection.refresh:
  route_name: entity.aws_cloud_vpc_peering_connection.list_update
  title: 'Refresh'
  appears_on:
    - view.aws_cloud_vpc_peering_connection.list

entity.aws_cloud_vpc_peering_connection.edit:
  route_name: entity.aws_cloud_vpc_peering_connection.edit_form
  title: 'Edit'
  appears_on:
    - entity.aws_cloud_vpc_peering_connection.canonical

entity.aws_cloud_vpc_peering_connection.delete:
  route_name: entity.aws_cloud_vpc_peering_connection.delete_form
  title: 'Delete'
  appears_on:
    - entity.aws_cloud_vpc_peering_connection.canonical


###################
# AWS Cloud Subnet.
###################
+6
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.links.task.yml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -101,6 +101,12 @@ aws_cloud.local_tasks.vpc:
  base_route: 'aws_cloud.local_tasks.cloud_context'
  weight: 10

aws_cloud.local_tasks.vpc_peering_connection:
  title: 'VPC Peering Connections'
  route_name: 'view.aws_cloud_vpc_peering_connection.list'
  base_route: 'aws_cloud.local_tasks.cloud_context'
  weight: 10

aws_cloud.local_tasks.subnet:
  title: 'Subnets'
  route_name: 'view.aws_cloud_subnet.list'
+1
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.module: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -702,6 +702,7 @@ function aws_cloud_update_ec2_resources(
  $ec2_service->updateSnapshots();
  $ec2_service->updateVolumes();
  $ec2_service->updateVpcs();
  $ec2_service->updateVpcPeeringConnections();
  $ec2_service->updateSubnets();
  $ec2_service->updateCloudServerTemplates();

+28
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.permissions.yml: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -276,6 +276,34 @@ delete own aws cloud vpc:
  title: 'Delete own AWS Cloud vpc'
  description: 'Allow users to delete own Amazon vpc'

#############
# Amazon VPC Peering Connection.
#############
add aws cloud vpc peering connection:
  title: 'Add AWS Cloud vpc peering connection'
  description: 'Allow users to add Amazon vpc peering connection'
list aws cloud vpc peering connection:
  title: 'List AWS Cloud vpc peering connection'
  description: 'Allow users to list Amazon vpc peering connection'
view any aws cloud vpc peering connection:
  title: 'View any AWS Cloud vpc peering connection'
  description: 'Allow users to view any Amazon vpc peering connection'
edit any aws cloud vpc peering connection:
  title: 'Edit any AWS Cloud vpc peering connection'
  description: 'Allow users to edit any Amazon vpc peering connection'
delete any aws cloud vpc peering connection:
  title: 'Delete any AWS Cloud vpc peering connection'
  description: 'Allow users to delete any Amazon vpc peering connection'
view own aws cloud vpc peering connection:
  title: 'View own AWS Cloud vpc peering connection'
  description: 'Allow users to view own Amazon vpc peering connection'
edit own aws cloud vpc peering connection:
  title: 'Edit own AWS Cloud vpc peering connection'
  description: 'Allow users to edit own Amazon vpc peering connection'
delete own aws cloud vpc peering connection:
  title: 'Delete own AWS Cloud vpc peering connection'
  description: 'Allow users to delete own Amazon vpc peering connection'

####################
# Amazon VPC Subnet.
####################
Loading