Loading modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/aws_cloud/network_interface.ts +54 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,60 @@ const AWS_CLOUD_NETWORK_INTERFACE_TEMPLATE: EntityFormTemplate[] = [ ], submitButtonLabel: 'Delete' }, { cloudServiceProvider: 'aws_cloud', entityName: 'network_interface', actionType: 'edit', entityRecords: [ { type: 'panel', panelName: 'Network interface', keyValueRecords: [ { type: 'default', labelName: 'Network interface name', name: 'name', defaultValue: '', required: true }, { type: 'default', labelName: 'Description', name: 'description', defaultValue: '' }, { type: 'default', labelName: 'Network interface ID', name: 'network_interface_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Instance ID', name: 'instance_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Allocation ID', name: 'allocation_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Mac Address', name: 'mac_address', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Device Index', name: 'device_index', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Status', name: 'status', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Delete on Termination', name: 'delete_on_termination', defaultValue: '', readOnly: true }, { type: 'datetime', labelName: 'Created', name: 'created', readOnly: true, defaultValue: 0 }, ] }, { type: 'panel', panelName: 'Network', keyValueRecords: [ { type: 'default', labelName: 'Security group', name: 'security_groups', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'VPC ID', name: 'vpc_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'CIDR Block', name: 'cidr_block', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Subnet ID', name: 'subnet_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Public IPs', name: 'public_ips', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Primary Private IP', name: 'primary_private_ip', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Secondary Private IPs', name: 'secondary_private_ips', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Private DNS', name: 'private_dns', defaultValue: '', readOnly: true }, ] }, { type: 'panel', panelName: 'Attachment', keyValueRecords: [ { type: 'default', labelName: 'Attachment ID', name: 'attachment_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Attachment Owner', name: 'attachment_owner', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Attachment Status', name: 'attachment_status', defaultValue: '', readOnly: true }, ] }, { type: 'panel', panelName: 'Owner', keyValueRecords: [ { type: 'default', labelName: 'AWS account ID', name: 'account_id', defaultValue: '', readOnly: true }, ] } ] }, ] export default AWS_CLOUD_NETWORK_INTERFACE_TEMPLATE; modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +14 −0 Original line number Diff line number Diff line Loading @@ -1168,6 +1168,20 @@ entity.aws_cloud_network_interface.delete: requirements: _permission: 'delete any aws cloud network interface' entity.aws_cloud_network_interface.edit: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_network_interface/{entity_id}/edit' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity' entity_type_id: aws_cloud_network_interface 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 network interface+edit own aws cloud network interface' entity.aws_cloud_network_interface.security_group_options_default: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_network_interface/security_group_options' defaults: Loading modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +6 −0 Original line number Diff line number Diff line Loading @@ -943,6 +943,12 @@ class ApiController extends ControllerBase implements ApiControllerInterface { case 'edit_aws_cloud_key_pair': $method_name = 'editKeyPair'; break; case 'edit_aws_cloud_network_interface': /** @var \Drupal\aws_cloud\Entity\Ec2\NetworkInterfaceInterface $entity */ $entity->setName($request->get('name', '')); $entity->setDescription($request->get('description', '')); $method_name = 'editNetworkInterface'; break; case 'import_aws_cloud_key_pair': /** @var \Drupal\aws_cloud\Entity\Ec2\KeyPairInterface $entity */ Loading modules/cloud_service_providers/aws_cloud/src/Form/Ec2/NetworkInterfaceEditForm.php +124 −20 Original line number Diff line number Diff line Loading @@ -2,9 +2,26 @@ namespace Drupal\aws_cloud\Form\Ec2; use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; use Drupal\aws_cloud\Entity\Ec2\SecurityGroupLinkQuery; 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; use Drupal\cloud\Service\EntityLinkRendererInterface; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; use Drupal\Core\Messenger\Messenger; use Drupal\Core\Plugin\CachedDiscoveryClearerInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Form controller for the CloudScripting entity edit forms. Loading @@ -13,6 +30,111 @@ use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; */ class NetworkInterfaceEditForm extends AwsCloudContentForm { /** * The AWS Cloud Operations service. * * @var \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface */ protected $awsCloudOperationsService; /** * NetworkInterfaceEditForm 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\Core\Entity\EntityRepositoryInterface $entity_repository * The entity repository service. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info * The entity type bundle service. * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. * @param \Drupal\Core\Messenger\Messenger $messenger * The Messenger Service. * @param \Drupal\cloud\Service\EntityLinkRendererInterface $entity_link_renderer * The entity link render service. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The Entity Type Manager. * @param \Drupal\Core\Cache\CacheBackendInterface $cacheRender * A cache backend interface instance. * @param \Drupal\Core\Plugin\CachedDiscoveryClearerInterface $plugin_cache_clearer * A plugin cache clear instance. * @param \Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface $cloud_config_plugin_manager * The cloud service provider plugin manager (CloudConfigPluginManager). * @param \Drupal\Core\Session\AccountInterface $current_user * The current user. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The route match. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter. * @param \Drupal\Core\Render\RendererInterface $renderer * The general renderer. * @param \Drupal\cloud\Service\CloudServiceInterface $cloud_service * The Cloud service. */ public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, Messenger $messenger, EntityLinkRendererInterface $entity_link_renderer, EntityTypeManagerInterface $entity_type_manager, CacheBackendInterface $cacheRender, CachedDiscoveryClearerInterface $plugin_cache_clearer, CloudConfigPluginManagerInterface $cloud_config_plugin_manager, AccountInterface $current_user, RouteMatchInterface $route_match, DateFormatterInterface $date_formatter, RendererInterface $renderer, CloudServiceInterface $cloud_service ) { parent::__construct( $ec2_service, $entity_repository, $entity_type_bundle_info, $time, $messenger, $entity_link_renderer, $entity_type_manager, $cacheRender, $plugin_cache_clearer, $cloud_config_plugin_manager, $current_user, $route_match, $date_formatter, $renderer, $cloud_service ); $this->awsCloudOperationsService = $aws_cloud_operations_service; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('entity.repository'), $container->get('entity_type.bundle.info'), $container->get('datetime.time'), $container->get('messenger'), $container->get('entity.link_renderer'), $container->get('entity_type.manager'), $container->get('cache.render'), $container->get('plugin.cache_clearer'), $container->get('plugin.manager.cloud_config_plugin'), $container->get('current_user'), $container->get('current_route_match'), $container->get('date.formatter'), $container->get('renderer'), $container->get('cloud') ); } /** * {@inheritdoc} */ Loading Loading @@ -212,25 +334,7 @@ class NetworkInterfaceEditForm extends AwsCloudContentForm { * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state): void { parent::save($form, $form_state); $entity = $this->entity; $this->ec2Service->setCloudContext($entity->getCloudContext()); $params = [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Description' => ['Value' => $entity->getDescription()], ]; if (method_exists($this->ec2Service, 'modifyNetworkInterfaceAttribute')) { $this->ec2Service->modifyNetworkInterfaceAttribute($params); } $this->updateNameAndCreatedByTags($entity, $entity->getNetworkInterfaceId()); $this->clearCacheValues($entity->getCacheTags()); $this->dispatchSaveEvent($entity); $this->awsCloudOperationsService->editNetworkInterface($this->entity, $form, $form_state); } } modules/cloud_service_providers/aws_cloud/src/Service/AwsCloud/AwsCloudOperationsService.php +46 −0 Original line number Diff line number Diff line Loading @@ -1674,6 +1674,52 @@ class AwsCloudOperationsService implements AwsCloudOperationsServiceInterface { } } /** * {@inheritdoc} */ public function editNetworkInterface(NetworkInterfaceInterface $entity, array $form, FormStateInterface $form_state): bool { try { $this->ec2Service->setCloudContext($entity->getCloudContext()); $this->saveAwsCloudContent($entity, $form, $form_state); $params = [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Description' => ['Value' => $entity->getDescription()], ]; if (method_exists($this->ec2Service, 'modifyNetworkInterfaceAttribute')) { $this->ec2Service->modifyNetworkInterfaceAttribute($params); } $this->updateNameAndCreatedByTags($entity, $entity->getNetworkInterfaceId()); // Update OpenStack REST NetworkInterfaces. if ($this->ec2Service instanceof OpenStackRestService) { // Delete old tags. $this->ec2Service->deleteTags( [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'EntityType' => $entity->getEntityTypeId(), ]); $this->ec2Service->updateNetworkInterface([ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Name' => $entity->getName(), 'Description' => $entity->getDescription(), ]); } $this->clearCacheValues($entity->getCacheTags()); $this->dispatchSaveEvent($entity); return TRUE; } catch (\Exception $e) { $this->handleException($e); return FALSE; } } /** * {@inheritdoc} */ Loading Loading
modules/cloud_dashboard/cloud_dashboard/src/constant/form_template/aws_cloud/network_interface.ts +54 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,60 @@ const AWS_CLOUD_NETWORK_INTERFACE_TEMPLATE: EntityFormTemplate[] = [ ], submitButtonLabel: 'Delete' }, { cloudServiceProvider: 'aws_cloud', entityName: 'network_interface', actionType: 'edit', entityRecords: [ { type: 'panel', panelName: 'Network interface', keyValueRecords: [ { type: 'default', labelName: 'Network interface name', name: 'name', defaultValue: '', required: true }, { type: 'default', labelName: 'Description', name: 'description', defaultValue: '' }, { type: 'default', labelName: 'Network interface ID', name: 'network_interface_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Instance ID', name: 'instance_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Allocation ID', name: 'allocation_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Mac Address', name: 'mac_address', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Device Index', name: 'device_index', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Status', name: 'status', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Delete on Termination', name: 'delete_on_termination', defaultValue: '', readOnly: true }, { type: 'datetime', labelName: 'Created', name: 'created', readOnly: true, defaultValue: 0 }, ] }, { type: 'panel', panelName: 'Network', keyValueRecords: [ { type: 'default', labelName: 'Security group', name: 'security_groups', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'VPC ID', name: 'vpc_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'CIDR Block', name: 'cidr_block', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Subnet ID', name: 'subnet_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Public IPs', name: 'public_ips', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Primary Private IP', name: 'primary_private_ip', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Secondary Private IPs', name: 'secondary_private_ips', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Private DNS', name: 'private_dns', defaultValue: '', readOnly: true }, ] }, { type: 'panel', panelName: 'Attachment', keyValueRecords: [ { type: 'default', labelName: 'Attachment ID', name: 'attachment_id', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Attachment Owner', name: 'attachment_owner', defaultValue: '', readOnly: true }, { type: 'default', labelName: 'Attachment Status', name: 'attachment_status', defaultValue: '', readOnly: true }, ] }, { type: 'panel', panelName: 'Owner', keyValueRecords: [ { type: 'default', labelName: 'AWS account ID', name: 'account_id', defaultValue: '', readOnly: true }, ] } ] }, ] export default AWS_CLOUD_NETWORK_INTERFACE_TEMPLATE;
modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +14 −0 Original line number Diff line number Diff line Loading @@ -1168,6 +1168,20 @@ entity.aws_cloud_network_interface.delete: requirements: _permission: 'delete any aws cloud network interface' entity.aws_cloud_network_interface.edit: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_network_interface/{entity_id}/edit' defaults: _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::operateEntity' entity_type_id: aws_cloud_network_interface 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 network interface+edit own aws cloud network interface' entity.aws_cloud_network_interface.security_group_options_default: path: '/cloud_dashboard/aws_cloud/{cloud_context}/aws_cloud_network_interface/security_group_options' defaults: Loading
modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php +6 −0 Original line number Diff line number Diff line Loading @@ -943,6 +943,12 @@ class ApiController extends ControllerBase implements ApiControllerInterface { case 'edit_aws_cloud_key_pair': $method_name = 'editKeyPair'; break; case 'edit_aws_cloud_network_interface': /** @var \Drupal\aws_cloud\Entity\Ec2\NetworkInterfaceInterface $entity */ $entity->setName($request->get('name', '')); $entity->setDescription($request->get('description', '')); $method_name = 'editNetworkInterface'; break; case 'import_aws_cloud_key_pair': /** @var \Drupal\aws_cloud\Entity\Ec2\KeyPairInterface $entity */ Loading
modules/cloud_service_providers/aws_cloud/src/Form/Ec2/NetworkInterfaceEditForm.php +124 −20 Original line number Diff line number Diff line Loading @@ -2,9 +2,26 @@ namespace Drupal\aws_cloud\Form\Ec2; use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; use Drupal\aws_cloud\Entity\Ec2\SecurityGroupLinkQuery; 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; use Drupal\cloud\Service\EntityLinkRendererInterface; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; use Drupal\Core\Messenger\Messenger; use Drupal\Core\Plugin\CachedDiscoveryClearerInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Form controller for the CloudScripting entity edit forms. Loading @@ -13,6 +30,111 @@ use Drupal\aws_cloud\Entity\Ec2\PublicIpEntityLinkHtmlGenerator; */ class NetworkInterfaceEditForm extends AwsCloudContentForm { /** * The AWS Cloud Operations service. * * @var \Drupal\aws_cloud\Service\AwsCloud\AwsCloudOperationsServiceInterface */ protected $awsCloudOperationsService; /** * NetworkInterfaceEditForm 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\Core\Entity\EntityRepositoryInterface $entity_repository * The entity repository service. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info * The entity type bundle service. * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. * @param \Drupal\Core\Messenger\Messenger $messenger * The Messenger Service. * @param \Drupal\cloud\Service\EntityLinkRendererInterface $entity_link_renderer * The entity link render service. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The Entity Type Manager. * @param \Drupal\Core\Cache\CacheBackendInterface $cacheRender * A cache backend interface instance. * @param \Drupal\Core\Plugin\CachedDiscoveryClearerInterface $plugin_cache_clearer * A plugin cache clear instance. * @param \Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface $cloud_config_plugin_manager * The cloud service provider plugin manager (CloudConfigPluginManager). * @param \Drupal\Core\Session\AccountInterface $current_user * The current user. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The route match. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter. * @param \Drupal\Core\Render\RendererInterface $renderer * The general renderer. * @param \Drupal\cloud\Service\CloudServiceInterface $cloud_service * The Cloud service. */ public function __construct( AwsCloudOperationsServiceInterface $aws_cloud_operations_service, Ec2ServiceInterface $ec2_service, EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, Messenger $messenger, EntityLinkRendererInterface $entity_link_renderer, EntityTypeManagerInterface $entity_type_manager, CacheBackendInterface $cacheRender, CachedDiscoveryClearerInterface $plugin_cache_clearer, CloudConfigPluginManagerInterface $cloud_config_plugin_manager, AccountInterface $current_user, RouteMatchInterface $route_match, DateFormatterInterface $date_formatter, RendererInterface $renderer, CloudServiceInterface $cloud_service ) { parent::__construct( $ec2_service, $entity_repository, $entity_type_bundle_info, $time, $messenger, $entity_link_renderer, $entity_type_manager, $cacheRender, $plugin_cache_clearer, $cloud_config_plugin_manager, $current_user, $route_match, $date_formatter, $renderer, $cloud_service ); $this->awsCloudOperationsService = $aws_cloud_operations_service; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('aws_cloud.operations'), $container->get('aws_cloud.ec2'), $container->get('entity.repository'), $container->get('entity_type.bundle.info'), $container->get('datetime.time'), $container->get('messenger'), $container->get('entity.link_renderer'), $container->get('entity_type.manager'), $container->get('cache.render'), $container->get('plugin.cache_clearer'), $container->get('plugin.manager.cloud_config_plugin'), $container->get('current_user'), $container->get('current_route_match'), $container->get('date.formatter'), $container->get('renderer'), $container->get('cloud') ); } /** * {@inheritdoc} */ Loading Loading @@ -212,25 +334,7 @@ class NetworkInterfaceEditForm extends AwsCloudContentForm { * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state): void { parent::save($form, $form_state); $entity = $this->entity; $this->ec2Service->setCloudContext($entity->getCloudContext()); $params = [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Description' => ['Value' => $entity->getDescription()], ]; if (method_exists($this->ec2Service, 'modifyNetworkInterfaceAttribute')) { $this->ec2Service->modifyNetworkInterfaceAttribute($params); } $this->updateNameAndCreatedByTags($entity, $entity->getNetworkInterfaceId()); $this->clearCacheValues($entity->getCacheTags()); $this->dispatchSaveEvent($entity); $this->awsCloudOperationsService->editNetworkInterface($this->entity, $form, $form_state); } }
modules/cloud_service_providers/aws_cloud/src/Service/AwsCloud/AwsCloudOperationsService.php +46 −0 Original line number Diff line number Diff line Loading @@ -1674,6 +1674,52 @@ class AwsCloudOperationsService implements AwsCloudOperationsServiceInterface { } } /** * {@inheritdoc} */ public function editNetworkInterface(NetworkInterfaceInterface $entity, array $form, FormStateInterface $form_state): bool { try { $this->ec2Service->setCloudContext($entity->getCloudContext()); $this->saveAwsCloudContent($entity, $form, $form_state); $params = [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Description' => ['Value' => $entity->getDescription()], ]; if (method_exists($this->ec2Service, 'modifyNetworkInterfaceAttribute')) { $this->ec2Service->modifyNetworkInterfaceAttribute($params); } $this->updateNameAndCreatedByTags($entity, $entity->getNetworkInterfaceId()); // Update OpenStack REST NetworkInterfaces. if ($this->ec2Service instanceof OpenStackRestService) { // Delete old tags. $this->ec2Service->deleteTags( [ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'EntityType' => $entity->getEntityTypeId(), ]); $this->ec2Service->updateNetworkInterface([ 'NetworkInterfaceId' => $entity->getNetworkInterfaceId(), 'Name' => $entity->getName(), 'Description' => $entity->getDescription(), ]); } $this->clearCacheValues($entity->getCacheTags()); $this->dispatchSaveEvent($entity); return TRUE; } catch (\Exception $e) { $this->handleException($e); return FALSE; } } /** * {@inheritdoc} */ Loading