Loading modules/cloud_service_providers/aws_cloud/aws_cloud.links.action.yml +7 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.links.action.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ entity.aws_cloud_instance.collection: - entity.aws_cloud_instance.edit_form - entity.aws_cloud_instance.delete_form entity.aws_cloud_instance.create_image_form: route_name: entity.aws_cloud_instance.create_image_form title: 'Create an Instance Image' appears_on: - entity.aws_cloud_instance.edit_form - entity.aws_cloud_instance.canonical #################### # AWS Cloud Image Loading modules/cloud_service_providers/aws_cloud/aws_cloud.module +37 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.module: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -169,6 +169,15 @@ function aws_cloud_cron() { $aws_ec2_service->updateSnapshots(); $aws_ec2_service->updateVolumes(); // Update any pending images in the DB. Pending images are usually // created from an active instance. $images = aws_cloud_get_pending_images($entity->getCloudContext()); if (count($images)) { $aws_ec2_service->updateImages([ 'ImageIds' => $images ]); } // @todo: re-enabled instance bundling } // Notify owners if their instances have been running for to long. Loading Loading @@ -212,6 +221,12 @@ function aws_cloud_entity_operation(EntityInterface $entity) { ]; } } // Create Image $operations['create_image'] = [ 'title' => t('Create Image'), 'url' => $entity->toUrl('create-image-form'), 'weight' => 21, ]; } } else if ($entity->getEntityTypeId() == 'aws_cloud_volume') { Loading Loading @@ -249,6 +264,11 @@ function aws_cloud_entity_operation_alter(array &$operations, EntityInterface $e unset($operations['delete']); } } if ($entity->getEntityTypeId() == 'aws_cloud_image') { if ($entity->getStatus() == 'pending') { unset($operations['delete']); } } } /** Loading Loading @@ -316,6 +336,23 @@ function aws_cloud_get_expired_instances($cloud_context) { return $expired_instances; } function aws_cloud_get_pending_images($cloud_context) { $images = []; /* @var \Drupal\Core\Entity\EntityStorageInterface $entity_storage $entity_storage */ $entity_storage = \Drupal::entityTypeManager()->getStorage('aws_cloud_image'); $entity_ids = $entity_storage ->getQuery() ->condition('status', 'pending') ->condition('cloud_context', $cloud_context, '=') ->execute(); $entities = $entity_storage->loadMultiple($entity_ids); foreach ($entities as $entity) { /* @var \Drupal\aws_cloud\Entity\Ec2\Image $entity */ $images[] = $entity->getImageId(); } return $images; } /** * Implements hook_mail(). */ Loading modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +8 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -146,6 +146,14 @@ entity.aws_cloud_instance.start_form: requirements: _entity_access: 'aws_cloud_instance.edit' entity.aws_cloud_instance.create_image_form: path: '/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}/create_image' defaults: _entity_form: 'aws_cloud_instance.create_image' _title: 'Create Image from Instance' requirements: _entity_access: 'aws_cloud_instance.edit' # AWS Cloud Images Routes entity.aws_cloud_image.canonical: Loading modules/cloud_service_providers/aws_cloud/src/Aws/Ec2/ImageInterface.php +15 Changes for modules/cloud_service_providers/aws_cloud/src/Aws/Ec2/ImageInterface.php: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -144,6 +144,21 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface { */ public function setRefreshed($time); /** * {@inheritdoc} */ public function setImageOwnerId($owner); /** * {@inheritdoc} */ public function setName($name); /** * {@inheritdoc} */ public function setStatus($status); /** * {@inheritdoc} */ Loading modules/cloud_service_providers/aws_cloud/src/Entity/Ec2/Image.php +14 Changes for modules/cloud_service_providers/aws_cloud/src/Entity/Ec2/Image.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -229,6 +229,20 @@ class Image extends CloudContentEntityBase implements ImageInterface { return $this->set('name', $name); } /** * {@inheritdoc} */ public function setImageOwnerId($owner) { return $this->set('owner', $owner); } /** * {@inheritdoc} */ public function setStatus($status) { return $this->set('status', $status); } /** * {@inheritdoc} */ Loading Loading
modules/cloud_service_providers/aws_cloud/aws_cloud.links.action.yml +7 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.links.action.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ entity.aws_cloud_instance.collection: - entity.aws_cloud_instance.edit_form - entity.aws_cloud_instance.delete_form entity.aws_cloud_instance.create_image_form: route_name: entity.aws_cloud_instance.create_image_form title: 'Create an Instance Image' appears_on: - entity.aws_cloud_instance.edit_form - entity.aws_cloud_instance.canonical #################### # AWS Cloud Image Loading
modules/cloud_service_providers/aws_cloud/aws_cloud.module +37 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.module: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -169,6 +169,15 @@ function aws_cloud_cron() { $aws_ec2_service->updateSnapshots(); $aws_ec2_service->updateVolumes(); // Update any pending images in the DB. Pending images are usually // created from an active instance. $images = aws_cloud_get_pending_images($entity->getCloudContext()); if (count($images)) { $aws_ec2_service->updateImages([ 'ImageIds' => $images ]); } // @todo: re-enabled instance bundling } // Notify owners if their instances have been running for to long. Loading Loading @@ -212,6 +221,12 @@ function aws_cloud_entity_operation(EntityInterface $entity) { ]; } } // Create Image $operations['create_image'] = [ 'title' => t('Create Image'), 'url' => $entity->toUrl('create-image-form'), 'weight' => 21, ]; } } else if ($entity->getEntityTypeId() == 'aws_cloud_volume') { Loading Loading @@ -249,6 +264,11 @@ function aws_cloud_entity_operation_alter(array &$operations, EntityInterface $e unset($operations['delete']); } } if ($entity->getEntityTypeId() == 'aws_cloud_image') { if ($entity->getStatus() == 'pending') { unset($operations['delete']); } } } /** Loading Loading @@ -316,6 +336,23 @@ function aws_cloud_get_expired_instances($cloud_context) { return $expired_instances; } function aws_cloud_get_pending_images($cloud_context) { $images = []; /* @var \Drupal\Core\Entity\EntityStorageInterface $entity_storage $entity_storage */ $entity_storage = \Drupal::entityTypeManager()->getStorage('aws_cloud_image'); $entity_ids = $entity_storage ->getQuery() ->condition('status', 'pending') ->condition('cloud_context', $cloud_context, '=') ->execute(); $entities = $entity_storage->loadMultiple($entity_ids); foreach ($entities as $entity) { /* @var \Drupal\aws_cloud\Entity\Ec2\Image $entity */ $images[] = $entity->getImageId(); } return $images; } /** * Implements hook_mail(). */ Loading
modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml +8 Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -146,6 +146,14 @@ entity.aws_cloud_instance.start_form: requirements: _entity_access: 'aws_cloud_instance.edit' entity.aws_cloud_instance.create_image_form: path: '/clouds/aws_cloud/{cloud_context}/instance/{aws_cloud_instance}/create_image' defaults: _entity_form: 'aws_cloud_instance.create_image' _title: 'Create Image from Instance' requirements: _entity_access: 'aws_cloud_instance.edit' # AWS Cloud Images Routes entity.aws_cloud_image.canonical: Loading
modules/cloud_service_providers/aws_cloud/src/Aws/Ec2/ImageInterface.php +15 Changes for modules/cloud_service_providers/aws_cloud/src/Aws/Ec2/ImageInterface.php: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -144,6 +144,21 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface { */ public function setRefreshed($time); /** * {@inheritdoc} */ public function setImageOwnerId($owner); /** * {@inheritdoc} */ public function setName($name); /** * {@inheritdoc} */ public function setStatus($status); /** * {@inheritdoc} */ Loading
modules/cloud_service_providers/aws_cloud/src/Entity/Ec2/Image.php +14 Changes for modules/cloud_service_providers/aws_cloud/src/Entity/Ec2/Image.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -229,6 +229,20 @@ class Image extends CloudContentEntityBase implements ImageInterface { return $this->set('name', $name); } /** * {@inheritdoc} */ public function setImageOwnerId($owner) { return $this->set('owner', $owner); } /** * {@inheritdoc} */ public function setStatus($status) { return $this->set('status', $status); } /** * {@inheritdoc} */ Loading