Loading modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/aws_cloud/transit_gateway.ts +43 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,49 @@ const AWS_CLOUD_TRANSIT_GATEWAY_TEMPLATE: EntityFormTemplate[] = [ ] } ] }, { cloudServiceProvider: 'aws_cloud', entityName: 'transit_gateway', actionType: 'edit', entityRecords: [ { type: 'panel', panelName: 'Transit gateway', keyValueRecords: [ { type: 'default', labelName: 'Name', name: 'name', defaultValue: '', required: true }, { type: 'default', labelName: 'Description', name: 'description', defaultValue: '', required: false }, { type: 'default', labelName: 'Transit gateway ID', name: 'transit_gateway_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'State', name: 'state', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Amazon side ASN', name: 'amazon_side_asn', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Multicast support', name: 'multicast_support', defaultValue: '', readOnly: true }, { type: 'datetime', labelName: 'Created', name: 'created', defaultValue: 0, readOnly: true }, { type: 'boolean', labelName: 'DNS support', name: 'dns_support', defaultValue: true }, { type: 'boolean', labelName: 'VPN ECMP support', name: 'vpn_ecmp_support', defaultValue: true }, { type: 'boolean', labelName: 'Default route table association', name: 'default_route_table_association', defaultValue: true }, { type: 'select', labelName: 'Association Default Route Table ID', name: 'association_default_route_table_id', defaultValue: '', url: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables', defaultValueUrl: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/association_default_route_table_id', }, { type: 'boolean', labelName: 'Default route table propagation', name: 'default_route_table_propagation', defaultValue: true }, { type: 'select', labelName: 'Propagation Default Route Table ID', name: 'propagation_default_route_table_id', defaultValue: '', url: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables', defaultValueUrl: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/propagation_default_route_table_id', }, { type: 'boolean', labelName: 'Multicast support', name: 'multicast_support', defaultValue: false }, { type: 'boolean', labelName: 'Auto accept shared attachments', name: 'auto_accept_shared_attachments', defaultValue: false }, { type: 'key-value', labelName: 'Tags', name: 'tags', defaultValue: [] }, ] } ] } ] Loading modules/cloud_dashboard/cloud_dashboard/src/organisms/EntityFormPanel.tsx +14 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,20 @@ const showEntityFormBlockFlg = ( } } if (actionType === 'edit' && cloudServiceProvider === 'aws_cloud' && entityName === 'transit_gateway' ) { if (entityFormColumn.type === 'boolean' || entityFormColumn.type === 'select') { if (entityFormColumn.name === 'association_default_route_table_id') { return formData['default_route_table_association']; } if (entityFormColumn.name === 'propagation_default_route_table_id') { return formData['default_route_table_propagation']; } } } return true; } Loading modules/cloud_dashboard/cloud_dashboard/src/pages/EntityXxudPage.tsx +3 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,9 @@ const EntityXxudPageImpl = ({ cloudContext, entityFormTemplate, entityName, enti || keyValueRecord.type === 'hidden' || keyValueRecord.type === 'select') { if (keyValueRecord.defaultValueUrl !== undefined) { const replacedUrl = keyValueRecord.defaultValueUrl.replace('{cloud_context}', cloudContext); const replacedUrl = keyValueRecord.defaultValueUrl .replace('{cloud_context}', cloudContext) .replace('{entity_id}', entityId); if (!replacedUrl.endsWith('/')) { const jsonData = await getJsonData<string>(replacedUrl); if (jsonData.length > 0) { Loading modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +44 −0 Original line number Diff line number Diff line Loading @@ -1508,6 +1508,50 @@ entity.aws_cloud_transit_gateway.create: requirements: _permission: 'add aws cloud transit gateway' entity.aws_cloud_transit_gateway.edit: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/edit' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity' entity_type_id: aws_cloud_transit_gateway command: edit 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: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.route_tables: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getRouteTables' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.association_default_route_table_id: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/association_default_route_table_id' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getAssociationDefaultRouteTableId' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.propagation_default_route_table_id: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/propagation_default_route_table_id' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getPropagationDefaultRouteTableId' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_vpc.create: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_vpc/create' defaults: Loading modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +62 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\aws_cloud\Entity\Ec2\ElasticIp; use Drupal\aws_cloud\Entity\Ec2\InstanceInterface; use Drupal\aws_cloud\Entity\Ec2\IntermediateFormState; use Drupal\aws_cloud\Entity\Ec2\NetworkInterface; use Drupal\aws_cloud\Entity\Vpc\TransitGateway; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\CloudWatch\CloudWatchServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; Loading Loading @@ -908,6 +909,23 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $method_name = 'createTransitGateway'; break; case 'edit_aws_cloud_transit_gateway': /** @var \Drupal\aws_cloud\Entity\Vpc\TransitGatewayInterface $entity */ $entity->setName($request->get('name', '')); $entity->setDescription($request->get('description', '')); $entity->setAmazonSideAsn($request->get('amazon_side_asn', '')); // Use filter_var() to convert from string to boolean. $entity->setDnsSupport(filter_var($request->get('dns_support'), FILTER_VALIDATE_BOOLEAN)); $entity->setVpnEcmpSupport(filter_var($request->get('vpn_ecmp_support', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setDefaultRouteTableAssociation(filter_var($request->get('default_route_table_association', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setDefaultRouteTablePropagation(filter_var($request->get('default_route_table_propagation', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setMulticastSupport(filter_var($request->get('multicast_support', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setAutoAcceptSharedAttachments(filter_var($request->get('auto_accept_shared_attachments', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setAssociationDefaultRouteTableId($request->get('association_default_route_table_id', '')); $entity->setPropagationDefaultRouteTableId($request->get('propagation_default_route_table_id', '')); $method_name = 'editTransitGateway'; break; case 'create_aws_cloud_vpc': /** @var \Drupal\aws_cloud\Entity\Vpc\VpcInterface $entity */ $entity->setName($request->get('name', '')); Loading Loading @@ -1572,6 +1590,50 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new JsonResponse($output, Response::HTTP_OK); } /** * {@inheritdoc} */ public function getRouteTables(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); if (empty($entity)) { return new JsonResponse('', Response::HTTP_OK); } $tables = $this->entityTypeManager ->getStorage('aws_cloud_transit_gateway_route') ->loadByProperties([ 'cloud_context' => $entity->getCloudContext(), 'transit_gateway_id' => $entity->getTransitGatewayId(), ]); $output = []; foreach ($tables ?? [] as $table) { $output[] = [ 'value' => $table->getTransitGatewayRouteTableId(), 'label' => $table->getTransitGatewayRouteTableId(), ]; } return new JsonResponse($output, Response::HTTP_OK); } /** * {@inheritdoc} */ public function getAssociationDefaultRouteTableId(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); return new JsonResponse(empty($entity) ? '' : $entity->getAssociationDefaultRouteTableId(), Response::HTTP_OK); } /** * {@inheritdoc} */ public function getPropagationDefaultRouteTableId(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); return new JsonResponse(empty($entity) ? '' : $entity->getPropagationDefaultRouteTableId(), Response::HTTP_OK); } /** * {@inheritdoc} */ Loading Loading
modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/aws_cloud/transit_gateway.ts +43 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,49 @@ const AWS_CLOUD_TRANSIT_GATEWAY_TEMPLATE: EntityFormTemplate[] = [ ] } ] }, { cloudServiceProvider: 'aws_cloud', entityName: 'transit_gateway', actionType: 'edit', entityRecords: [ { type: 'panel', panelName: 'Transit gateway', keyValueRecords: [ { type: 'default', labelName: 'Name', name: 'name', defaultValue: '', required: true }, { type: 'default', labelName: 'Description', name: 'description', defaultValue: '', required: false }, { type: 'default', labelName: 'Transit gateway ID', name: 'transit_gateway_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'State', name: 'state', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Amazon side ASN', name: 'amazon_side_asn', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Multicast support', name: 'multicast_support', defaultValue: '', readOnly: true }, { type: 'datetime', labelName: 'Created', name: 'created', defaultValue: 0, readOnly: true }, { type: 'boolean', labelName: 'DNS support', name: 'dns_support', defaultValue: true }, { type: 'boolean', labelName: 'VPN ECMP support', name: 'vpn_ecmp_support', defaultValue: true }, { type: 'boolean', labelName: 'Default route table association', name: 'default_route_table_association', defaultValue: true }, { type: 'select', labelName: 'Association Default Route Table ID', name: 'association_default_route_table_id', defaultValue: '', url: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables', defaultValueUrl: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/association_default_route_table_id', }, { type: 'boolean', labelName: 'Default route table propagation', name: 'default_route_table_propagation', defaultValue: true }, { type: 'select', labelName: 'Propagation Default Route Table ID', name: 'propagation_default_route_table_id', defaultValue: '', url: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables', defaultValueUrl: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/propagation_default_route_table_id', }, { type: 'boolean', labelName: 'Multicast support', name: 'multicast_support', defaultValue: false }, { type: 'boolean', labelName: 'Auto accept shared attachments', name: 'auto_accept_shared_attachments', defaultValue: false }, { type: 'key-value', labelName: 'Tags', name: 'tags', defaultValue: [] }, ] } ] } ] Loading
modules/cloud_dashboard/cloud_dashboard/src/organisms/EntityFormPanel.tsx +14 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,20 @@ const showEntityFormBlockFlg = ( } } if (actionType === 'edit' && cloudServiceProvider === 'aws_cloud' && entityName === 'transit_gateway' ) { if (entityFormColumn.type === 'boolean' || entityFormColumn.type === 'select') { if (entityFormColumn.name === 'association_default_route_table_id') { return formData['default_route_table_association']; } if (entityFormColumn.name === 'propagation_default_route_table_id') { return formData['default_route_table_propagation']; } } } return true; } Loading
modules/cloud_dashboard/cloud_dashboard/src/pages/EntityXxudPage.tsx +3 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,9 @@ const EntityXxudPageImpl = ({ cloudContext, entityFormTemplate, entityName, enti || keyValueRecord.type === 'hidden' || keyValueRecord.type === 'select') { if (keyValueRecord.defaultValueUrl !== undefined) { const replacedUrl = keyValueRecord.defaultValueUrl.replace('{cloud_context}', cloudContext); const replacedUrl = keyValueRecord.defaultValueUrl .replace('{cloud_context}', cloudContext) .replace('{entity_id}', entityId); if (!replacedUrl.endsWith('/')) { const jsonData = await getJsonData<string>(replacedUrl); if (jsonData.length > 0) { Loading
modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +44 −0 Original line number Diff line number Diff line Loading @@ -1508,6 +1508,50 @@ entity.aws_cloud_transit_gateway.create: requirements: _permission: 'add aws cloud transit gateway' entity.aws_cloud_transit_gateway.edit: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/edit' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity' entity_type_id: aws_cloud_transit_gateway command: edit 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: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.route_tables: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/route_tables' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getRouteTables' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.association_default_route_table_id: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/association_default_route_table_id' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getAssociationDefaultRouteTableId' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_transit_gateway.propagation_default_route_table_id: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_transit_gateway/{entity_id}/propagation_default_route_table_id' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::getPropagationDefaultRouteTableId' methods: [ GET ] requirements: _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'edit any aws cloud transit gateway+edit own aws cloud transit gateway' entity.aws_cloud_vpc.create: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_vpc/create' defaults: Loading
modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +62 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\aws_cloud\Entity\Ec2\ElasticIp; use Drupal\aws_cloud\Entity\Ec2\InstanceInterface; use Drupal\aws_cloud\Entity\Ec2\IntermediateFormState; use Drupal\aws_cloud\Entity\Ec2\NetworkInterface; use Drupal\aws_cloud\Entity\Vpc\TransitGateway; use Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface; use Drupal\aws_cloud\Service\CloudWatch\CloudWatchServiceInterface; use Drupal\aws_cloud\Service\Ec2\Ec2ServiceInterface; Loading Loading @@ -908,6 +909,23 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $method_name = 'createTransitGateway'; break; case 'edit_aws_cloud_transit_gateway': /** @var \Drupal\aws_cloud\Entity\Vpc\TransitGatewayInterface $entity */ $entity->setName($request->get('name', '')); $entity->setDescription($request->get('description', '')); $entity->setAmazonSideAsn($request->get('amazon_side_asn', '')); // Use filter_var() to convert from string to boolean. $entity->setDnsSupport(filter_var($request->get('dns_support'), FILTER_VALIDATE_BOOLEAN)); $entity->setVpnEcmpSupport(filter_var($request->get('vpn_ecmp_support', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setDefaultRouteTableAssociation(filter_var($request->get('default_route_table_association', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setDefaultRouteTablePropagation(filter_var($request->get('default_route_table_propagation', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setMulticastSupport(filter_var($request->get('multicast_support', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setAutoAcceptSharedAttachments(filter_var($request->get('auto_accept_shared_attachments', FALSE), FILTER_VALIDATE_BOOLEAN)); $entity->setAssociationDefaultRouteTableId($request->get('association_default_route_table_id', '')); $entity->setPropagationDefaultRouteTableId($request->get('propagation_default_route_table_id', '')); $method_name = 'editTransitGateway'; break; case 'create_aws_cloud_vpc': /** @var \Drupal\aws_cloud\Entity\Vpc\VpcInterface $entity */ $entity->setName($request->get('name', '')); Loading Loading @@ -1572,6 +1590,50 @@ class ApiController extends ControllerBase implements ApiControllerInterface { return new JsonResponse($output, Response::HTTP_OK); } /** * {@inheritdoc} */ public function getRouteTables(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); if (empty($entity)) { return new JsonResponse('', Response::HTTP_OK); } $tables = $this->entityTypeManager ->getStorage('aws_cloud_transit_gateway_route') ->loadByProperties([ 'cloud_context' => $entity->getCloudContext(), 'transit_gateway_id' => $entity->getTransitGatewayId(), ]); $output = []; foreach ($tables ?? [] as $table) { $output[] = [ 'value' => $table->getTransitGatewayRouteTableId(), 'label' => $table->getTransitGatewayRouteTableId(), ]; } return new JsonResponse($output, Response::HTTP_OK); } /** * {@inheritdoc} */ public function getAssociationDefaultRouteTableId(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); return new JsonResponse(empty($entity) ? '' : $entity->getAssociationDefaultRouteTableId(), Response::HTTP_OK); } /** * {@inheritdoc} */ public function getPropagationDefaultRouteTableId(string $cloud_context, string $entity_id): JsonResponse { $entity = TransitGateway::load($entity_id); return new JsonResponse(empty($entity) ? '' : $entity->getPropagationDefaultRouteTableId(), Response::HTTP_OK); } /** * {@inheritdoc} */ Loading