Skip to content
Snippets Groups Projects
Commit ae38aa08 authored by Yas Naoi's avatar Yas Naoi
Browse files

Implemented Delete APIs

parent 07edf670
No related branches found
No related tags found
No related merge requests found
Showing
with 1386 additions and 127 deletions
<?php
/**
* @file
* Contains \Drupal\aws_cloud\Controller\Ec2\ElasticIpListBuilder.
*/
// udpated by yas 2016/05/25
// updated by yas 2016/05/23
// updated by yas 2016/05/21
// updated by yas 2016/05/20
// updated by yas 2016/05/19
// updated by yas 2016/05/18
// created by yas 2016/04/21
namespace Drupal\aws_cloud\Controller\Ec2;
use Drupal\cloud\Controller\CloudContentListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Provides a listing of ElasticIp.
*/
class ElasticIpListBuilder extends CloudContentListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header = array(
// The header gives the table the information it needs in order to make
// the query calls for ordering. TableSort uses the field information
// to know what database column to sort by.
// field should be 'field', not 'specifier' in ConfigEntity
array('data' => t('Name' ), 'specifier' => 'name', 'sort' => 'ASC'),
array('data' => t('Elastic IP' ), 'specifier' => 'elastic_ip' ),
array('data' => t('Allocation ID' ), 'specifier' => 'allocation_id' ),
array('data' => t('Instance' ), 'specifier' => 'instance_id' ),
array('data' => t('Private IP Address'), 'specifier' => 'private_ip_address' ),
array('data' => t('Scope' ), 'specifier' => 'scope' ),
array('data' => t('Public DNS' ), 'specifier' => 'public_dns' ),
);
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['name'] = \Drupal::l(
$this->getLabel($entity),
$entity->urlInfo('canonical')
// @FIXME to use image_id()
// ->setRouteParameter('aws_cloud_elastic_ip', $entity->elastic_ip() )
->setRouteParameter('aws_cloud_elastic_ip', $entity->id() )
->setRouteParameter('cloud_context' , $entity->cloud_context())
);
$row['elastic_ip' ] = $entity->elastic_ip();
$row['allocation_id' ] = $entity->allocation_id();
$row['instance_id' ] = $entity->instance_id();
$row['private_ip_address'] = $entity->private_ip_address();
$row['scope' ] = $entity->scope();
$row['public_dns' ] = $entity->public_dns();
return $row + parent::buildRow($entity);
}
}
...@@ -39,6 +39,25 @@ entity.aws_cloud_instance.collection: ...@@ -39,6 +39,25 @@ entity.aws_cloud_instance.collection:
- entity.aws_cloud_instance.delete_form - entity.aws_cloud_instance.delete_form
####################
# AWS Cloud Image
####################
entity.aws_cloud_image.add_form:
route_name: 'entity.aws_cloud_image.add_form'
title: 'Launch Image'
appears_on:
- entity.aws_cloud_image.collection
entity.aws_cloud_image.collection:
route_name: entity.aws_cloud_image.collection
title: 'List Images'
appears_on:
- entity.aws_cloud_image.add_form
- entity.aws_cloud_image.edit_form
- entity.aws_cloud_image.delete_form
############################# #############################
# AWS Cloud Network Interface # AWS Cloud Network Interface
############################# #############################
......
# updated by yas 2016/05/28
# updated by yas 2016/05/26 # updated by yas 2016/05/26
# updated by yas 2016/05/25 # updated by yas 2016/05/25
# updated by yas 2016/05/24 # updated by yas 2016/05/24
...@@ -16,59 +17,59 @@ ...@@ -16,59 +17,59 @@
###################### ######################
# AWS SDK API Callback # AWS SDK API Callback
###################### ######################
aws_cloud.refreshInstanceList: aws_cloud.updateInstanceList:
path: '/admin/cloud/aws_cloud/{cloud_context}/instance/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/instance/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshInstanceList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateInstanceList'
requirements: requirements:
_permission: 'list aws cloud instance' _permission: 'list aws cloud instance'
aws_cloud.refreshImageList: aws_cloud.updateImageList:
path: '/admin/cloud/aws_cloud/{cloud_context}/image/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/image/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshImageList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateImageList'
requirements: requirements:
_permission: 'list aws cloud image' _permission: 'list aws cloud image'
aws_cloud.refreshSecurityGroupList: aws_cloud.updateSecurityGroupList:
path: '/admin/cloud/aws_cloud/{cloud_context}/security_group/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/security_group/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshSecurityGroupList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateSecurityGroupList'
requirements: requirements:
_permission: 'list aws cloud security_group' _permission: 'list aws cloud security_group'
aws_cloud.refreshNetworkInterfaceList: aws_cloud.updateNetworkInterfaceList:
path: '/admin/cloud/aws_cloud/{cloud_context}/network_interface/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/network_interface/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshNetworkInterfaceList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateNetworkInterfaceList'
requirements: requirements:
_permission: 'list aws cloud network_interface' _permission: 'list aws cloud network_interface'
aws_cloud.refreshElasticIpList: aws_cloud.updateElasticIpList:
path: '/admin/cloud/aws_cloud/{cloud_context}/elastic_ip/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/elastic_ip/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshElasticIpList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateElasticIpList'
requirements: requirements:
_permission: 'list aws cloud elastic_ip' _permission: 'list aws cloud elastic_ip'
aws_cloud.refreshKeyPairList: aws_cloud.updateKeyPairList:
path: '/admin/cloud/aws_cloud/{cloud_context}/key_pair/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/key_pair/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshKeyPairList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateKeyPairList'
requirements: requirements:
_permission: 'list aws cloud key_pair' _permission: 'list aws cloud key_pair'
aws_cloud.refreshVolumeList: aws_cloud.updateVolumeList:
path: '/admin/cloud/aws_cloud/{cloud_context}/volume/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/volume/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshVolumeList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateVolumeList'
requirements: requirements:
_permission: 'list aws cloud volume' _permission: 'list aws cloud volume'
aws_cloud.refreshSnapshotList: aws_cloud.updateSnapshotList:
path: '/admin/cloud/aws_cloud/{cloud_context}/snapshot/refresh' path: '/admin/cloud/aws_cloud/{cloud_context}/snapshot/update'
defaults: defaults:
_controller: '\Drupal\aws_cloud\Controller\AwsSdk\ApiController::refreshSnapshotList' _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateSnapshotList'
requirements: requirements:
_permission: 'list aws cloud snapshot' _permission: 'list aws cloud snapshot'
...@@ -200,6 +201,14 @@ entity.aws_cloud_image.collection: ...@@ -200,6 +201,14 @@ entity.aws_cloud_image.collection:
requirements: requirements:
_permission: 'list aws cloud image' _permission: 'list aws cloud image'
entity.aws_cloud_image.add_form:
path: '/admin/cloud/aws_cloud/{cloud_context}/image/add'
defaults:
_entity_form: 'aws_cloud_image.add'
_title: 'Launch AWS Cloud Image'
requirements:
_permission: 'add aws cloud image'
entity.aws_cloud_image.edit_form: entity.aws_cloud_image.edit_form:
path: '/admin/cloud/aws_cloud/{cloud_context}/image/{aws_cloud_image}/edit' path: '/admin/cloud/aws_cloud/{cloud_context}/image/{aws_cloud_image}/edit'
defaults: defaults:
......
<?php
/**
* @file
* Contains \Drupal\aws_cloud\Aws\Ec2\ApiController.
*/
// created by yas 2016/05/28
namespace Drupal\aws_cloud\Aws\Ec2;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\aws_cloud\Aws\Config\ConfigInterface;
use Drupal\aws_cloud\Entity\Ec2\Instance;
use Drupal\aws_cloud\Entity\Ec2\Image;
use Drupal\aws_cloud\Entity\Ec2\SecurityGroup;
use Drupal\aws_cloud\Entity\Ec2\NetworkInterface;
use Drupal\aws_cloud\Entity\Ec2\ElasticIp;
use Drupal\aws_cloud\Entity\Ec2\KeyPair;
use Drupal\aws_cloud\Entity\Ec2\Volume;
use Drupal\aws_cloud\Entity\Ec2\Snapshot;
\Drupal::moduleHandler()->loadInclude('cloud', 'inc', 'cloud.constants');
/**
* {@inheritdoc}
*/
interface ApiControllerInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container);
/**
* {@inheritdoc}
*/
public function getEc2Client(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function updateInstanceList(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function updateImageList(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function updateSecurityGroupList(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function updateNetworkInterfaceList(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function updateElasticIpList(ConfigInterface $cloud_context);
/**
* @inheritdoc}
*/
public function updateKeyPairList(ConfigInterface $cloud_context);
/**
* @inheritdoc}
*/
public function updateVolumeList(ConfigInterface $cloud_context);
/**
* @inheritdoc}
*/
public function updateSnapshotList(ConfigInterface $cloud_context);
/**
* {@inheritdoc}
*/
public function terminateInstance(Instance $instance);
/**
* {@inheritdoc}
*/
public function deregisterImage(Image $image);
/**
* {@inheritdoc}
*/
public function deleteSecurityGroup(SecurityGroup $security_group);
/**
* {@inheritdoc}
*/
public function deleteNetworkInterface(NetworkInterface $network_interface);
/**
* {@inheritdoc}
*/
public function deleteElasticIp(ElasticIp $elastic_ip);
/**
* @inheritdoc}
*/
public function deleteKeyPair(KeyPair $key_pair);
/**
* @inheritdoc}
*/
public function deleteVolume(Volume $volume);
/**
* @inheritdoc}
*/
public function deleteSnapshot(Snapshot $snapshot);
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/19 // updated by yas 2016/05/19
// updated by yas 2016/05/18 // updated by yas 2016/05/18
...@@ -81,6 +82,16 @@ interface ElasticIpInterface extends ContentEntityInterface, EntityOwnerInterfac ...@@ -81,6 +82,16 @@ interface ElasticIpInterface extends ContentEntityInterface, EntityOwnerInterfac
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\ImageInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\ImageInterface.
*/ */
// updated by yas 2016/05/29
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/18 // updated by yas 2016/05/18
// created by yas 2016/04/19 // created by yas 2016/04/19
...@@ -28,6 +30,12 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface { ...@@ -28,6 +30,12 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface {
*/ */
public function cloud_context(); public function cloud_context();
/**
* {@inheritdoc}
*/
public function name();
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -123,6 +131,16 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface { ...@@ -123,6 +131,16 @@ interface ImageInterface extends ContentEntityInterface, EntityOwnerInterface {
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\InstanceInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\InstanceInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/20 // updated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -275,6 +276,16 @@ interface InstanceInterface extends ContentEntityInterface, EntityOwnerInterface ...@@ -275,6 +276,16 @@ interface InstanceInterface extends ContentEntityInterface, EntityOwnerInterface
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\KeyPairInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\KeyPairInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// udpated by yas 2016/05/20 // udpated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -51,6 +52,16 @@ interface KeyPairInterface extends ContentEntityInterface, EntityOwnerInterface ...@@ -51,6 +52,16 @@ interface KeyPairInterface extends ContentEntityInterface, EntityOwnerInterface
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\NetworkInterfaceInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\NetworkInterfaceInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/20 // updated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -159,6 +160,16 @@ interface NetworkInterfaceInterface extends ContentEntityInterface, EntityOwnerI ...@@ -159,6 +160,16 @@ interface NetworkInterfaceInterface extends ContentEntityInterface, EntityOwnerI
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\SecurityGroupInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\SecurityGroupInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/20 // updated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -66,6 +67,16 @@ interface SecurityGroupInterface extends ContentEntityInterface, EntityOwnerInte ...@@ -66,6 +67,16 @@ interface SecurityGroupInterface extends ContentEntityInterface, EntityOwnerInte
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\SnapshotInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\SnapshotInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/26 // updated by yas 2016/05/26
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/20 // updated by yas 2016/05/20
...@@ -93,6 +94,16 @@ interface SnapshotInterface extends ContentEntityInterface, EntityOwnerInterface ...@@ -93,6 +94,16 @@ interface SnapshotInterface extends ContentEntityInterface, EntityOwnerInterface
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Aws\Ec2\VolumeInterface. * Contains \Drupal\aws_cloud\Aws\Ec2\VolumeInterface.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/20 // updated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -116,6 +117,16 @@ interface VolumeInterface extends ContentEntityInterface, EntityOwnerInterface { ...@@ -116,6 +117,16 @@ interface VolumeInterface extends ContentEntityInterface, EntityOwnerInterface {
*/ */
public function changed(); public function changed();
/**
* {@inheritdoc}
*/
public function refreshed();
/**
* {@inheritdoc}
*/
public function setRefreshed($time);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
<?php <?php
/** /**
* @file * @file
* Contains \Drupal\aws_cloud\Controller\Ec2\ElasticIpListBuilder. * Contains \Drupal\aws_cloud\Controller\Ec2\ElasticIpListBuilder.
*/ */
// udpated by yas 2016/05/25 // udpated by yas 2016/05/25
// updated by yas 2016/05/23 // updated by yas 2016/05/23
// updated by yas 2016/05/21 // updated by yas 2016/05/21
// updated by yas 2016/05/20 // updated by yas 2016/05/20
// updated by yas 2016/05/19 // updated by yas 2016/05/19
// updated by yas 2016/05/18 // updated by yas 2016/05/18
// created by yas 2016/04/21 // created by yas 2016/04/21
namespace Drupal\aws_cloud\Controller\Ec2; namespace Drupal\aws_cloud\Controller\Ec2;
use Drupal\cloud\Controller\CloudContentListBuilder; use Drupal\cloud\Controller\CloudContentListBuilder;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
/** /**
* Provides a listing of ElasticIp. * Provides a listing of ElasticIp.
*/ */
class ElasticIpListBuilder extends CloudContentListBuilder { class ElasticIpListBuilder extends CloudContentListBuilder {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildHeader() { public function buildHeader() {
$header = array( $header = array(
// The header gives the table the information it needs in order to make // The header gives the table the information it needs in order to make
// the query calls for ordering. TableSort uses the field information // the query calls for ordering. TableSort uses the field information
// to know what database column to sort by. // to know what database column to sort by.
// field should be 'field', not 'specifier' in ConfigEntity // field should be 'field', not 'specifier' in ConfigEntity
array('data' => t('Name' ), 'specifier' => 'name', 'sort' => 'ASC'), array('data' => t('Name' ), 'specifier' => 'name', 'sort' => 'ASC'),
array('data' => t('Elastic IP' ), 'specifier' => 'elastic_ip' ), array('data' => t('Elastic IP' ), 'specifier' => 'elastic_ip' ),
array('data' => t('Allocation ID' ), 'specifier' => 'allocation_id' ), array('data' => t('Allocation ID' ), 'specifier' => 'allocation_id' ),
array('data' => t('Instance' ), 'specifier' => 'instance_id' ), array('data' => t('Instance' ), 'specifier' => 'instance_id' ),
array('data' => t('Private IP Address'), 'specifier' => 'private_ip_address' ), array('data' => t('Private IP Address'), 'specifier' => 'private_ip_address' ),
array('data' => t('Scope' ), 'specifier' => 'scope' ), array('data' => t('Scope' ), 'specifier' => 'scope' ),
array('data' => t('Public DNS' ), 'specifier' => 'public_dns' ), array('data' => t('Public DNS' ), 'specifier' => 'public_dns' ),
); );
return $header + parent::buildHeader(); return $header + parent::buildHeader();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildRow(EntityInterface $entity) { public function buildRow(EntityInterface $entity) {
$row['name'] = \Drupal::l( $row['name'] = \Drupal::l(
$this->getLabel($entity), $this->getLabel($entity),
$entity->urlInfo('canonical') $entity->urlInfo('canonical')
// @FIXME to use image_id() // @FIXME to use image_id()
// ->setRouteParameter('aws_cloud_elastic_ip', $entity->elastic_ip() ) // ->setRouteParameter('aws_cloud_elastic_ip', $entity->elastic_ip() )
->setRouteParameter('aws_cloud_elastic_ip', $entity->id() ) ->setRouteParameter('aws_cloud_elastic_ip', $entity->id() )
->setRouteParameter('cloud_context' , $entity->cloud_context()) ->setRouteParameter('cloud_context' , $entity->cloud_context())
); );
$row['elastic_ip' ] = $entity->elastic_ip(); $row['elastic_ip' ] = $entity->elastic_ip();
$row['allocation_id' ] = $entity->allocation_id(); $row['allocation_id' ] = $entity->allocation_id();
$row['instance_id' ] = $entity->instance_id(); $row['instance_id' ] = $entity->instance_id();
$row['private_ip_address'] = $entity->private_ip_address(); $row['private_ip_address'] = $entity->private_ip_address();
$row['scope' ] = $entity->scope(); $row['scope' ] = $entity->scope();
$row['public_dns' ] = $entity->public_dns(); $row['public_dns' ] = $entity->public_dns();
return $row + parent::buildRow($entity); return $row + parent::buildRow($entity);
} }
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Controller\Ec2\ImageListBuilder. * Contains \Drupal\aws_cloud\Controller\Ec2\ImageListBuilder.
*/ */
// updated by yas 2016/05/29
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/21 // updated by yas 2016/05/21
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -32,16 +33,17 @@ class ImageListBuilder extends CloudContentListBuilder { ...@@ -32,16 +33,17 @@ class ImageListBuilder extends CloudContentListBuilder {
// the query calls for ordering. TableSort uses the field information // the query calls for ordering. TableSort uses the field information
// to know what database column to sort by. // to know what database column to sort by.
// field should be 'field', not 'specifier' in ConfigEntity // field should be 'field', not 'specifier' in ConfigEntity
array('data' => t('AMI Name' ), 'specifier' => 'ami_name', 'sort' => 'ASC'), array('data' => t('Name' ), 'specifier' => 'name', 'sort' => 'ASC'),
array('data' => t('AMI ID' ), 'specifier' => 'image_id' ), array('data' => t('AMI Name' ), 'specifier' => 'ami_name' ),
array('data' => t('Source' ), 'specifier' => 'source' ), array('data' => t('AMI ID' ), 'specifier' => 'image_id' ),
array('data' => t('Owner' ), 'specifier' => 'owner' ), array('data' => t('Source' ), 'specifier' => 'source' ),
array('data' => t('Visibility' ), 'specifier' => 'visibility' ), array('data' => t('Owner' ), 'specifier' => 'owner' ),
array('data' => t('Status' ), 'specifier' => 'status' ), array('data' => t('Visibility' ), 'specifier' => 'visibility' ),
array('data' => t('Architecture' ), 'specifier' => 'architecture ' ), array('data' => t('Status' ), 'specifier' => 'status' ),
array('data' => t('Platform' ), 'specifier' => 'platform' ), array('data' => t('Architecture' ), 'specifier' => 'architecture ' ),
array('data' => t('Root Device '), 'specifier' => 'root_device type' ), array('data' => t('Platform' ), 'specifier' => 'platform' ),
array('data' => t('Virtualization' ), 'specifier' => 'virtualization_type' ), array('data' => t('Root Device '), 'specifier' => 'root_device type' ),
array('data' => t('Virtualization' ), 'specifier' => 'virtualization_type' ),
); );
return $header + parent::buildHeader(); return $header + parent::buildHeader();
...@@ -52,14 +54,17 @@ class ImageListBuilder extends CloudContentListBuilder { ...@@ -52,14 +54,17 @@ class ImageListBuilder extends CloudContentListBuilder {
*/ */
public function buildRow(EntityInterface $entity) { public function buildRow(EntityInterface $entity) {
$row['ami_name'] = \Drupal::l( $row['name'] = \Drupal::l(
$entity-> ami_name(), $this->getLabel($entity),
$entity->urlInfo('canonical') $entity->urlInfo('canonical')
// @FIXME to use image_id() // @FIXME to use instance_id()
// ->setRouteParameter('aws_cloud_image', $entity-> image_id() ) // ->setRouteParameter('aws_cloud_instance', $entity->instance_id() )
->setRouteParameter('aws_cloud_image', $entity->id() ) ->setRouteParameter('aws_cloud_instance', $entity->id() )
->setRouteParameter('cloud_context' , $entity->cloud_context()) ->setRouteParameter('cloud_context' , $entity->cloud_context())
); );
$row['ami_name' ] = $entity->ami_name();
$row['image_id' ] = $entity->image_id(); $row['image_id' ] = $entity->image_id();
$row['source' ] = $entity->source(); $row['source' ] = $entity->source();
$row['owner' ] = $entity->owner(); $row['owner' ] = $entity->owner();
......
...@@ -61,6 +61,7 @@ class InstanceListBuilder extends CloudContentListBuilder { ...@@ -61,6 +61,7 @@ class InstanceListBuilder extends CloudContentListBuilder {
->setRouteParameter('aws_cloud_instance', $entity->id() ) ->setRouteParameter('aws_cloud_instance', $entity->id() )
->setRouteParameter('cloud_context' , $entity->cloud_context()) ->setRouteParameter('cloud_context' , $entity->cloud_context())
); );
$row['instance_id' ] = $entity->instance_id(); $row['instance_id' ] = $entity->instance_id();
$row['public_ip' ] = $entity->public_ip(); $row['public_ip' ] = $entity->public_ip();
$row['instance_state' ] = $entity->instance_state(); $row['instance_state' ] = $entity->instance_state();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Contains \Drupal\aws_cloud\Entity\Ec2\ElasticIp. * Contains \Drupal\aws_cloud\Entity\Ec2\ElasticIp.
*/ */
// updated by yas 2016/05/28
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/23 // updated by yas 2016/05/23
// updated by yas 2016/05/19 // updated by yas 2016/05/19
...@@ -45,7 +46,7 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface; ...@@ -45,7 +46,7 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface;
* "access" = "Drupal\aws_cloud\Controller\Ec2\ElasticIpAccessControlHandler", * "access" = "Drupal\aws_cloud\Controller\Ec2\ElasticIpAccessControlHandler",
* }, * },
* base_table = "aws_cloud_elastic_ip", * base_table = "aws_cloud_elastic_ip",
* admin_permission = "administer aws cloud ec2 elastic ip", * admin_permission = "administer aws cloud elastic ip",
* fieldable = TRUE, * fieldable = TRUE,
* entity_keys = { * entity_keys = {
* "id" = "id" , * "id" = "id" ,
...@@ -58,7 +59,7 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface; ...@@ -58,7 +59,7 @@ use Drupal\aws_cloud\Aws\Ec2\ElasticIpInterface;
* "delete-form" = "/entity.aws_cloud_elastic_ip.delete_form", * "delete-form" = "/entity.aws_cloud_elastic_ip.delete_form",
* "collection" = "/entity.aws_cloud_elastic_ip.collection" * "collection" = "/entity.aws_cloud_elastic_ip.collection"
* }, * },
* field_ui_base_route = ".aws_cloud_elastic_ip.settings" * field_ui_base_route = "aws_cloud_elastic_ip.settings"
* ) * )
*/ */
class ElasticIp extends ContentEntityBase implements ElasticIpInterface { class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
...@@ -149,6 +150,20 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface { ...@@ -149,6 +150,20 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
return $this->get('changed')->value; return $this->get('changed')->value;
} }
/**
* {@inheritdoc}
*/
public function refreshed() {
return $this->get('refreshed')->value;
}
/**
* {@inheritdoc}
*/
public function setRefreshed($time) {
return $this->set('refreshed', $time);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -176,16 +191,14 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface { ...@@ -176,16 +191,14 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setOwnerId($owner_id) { public function setOwnerId($owner_id) {
$this->set('owner_id', $owner_id); return $this->set('owner_id', $owner_id);
return $this;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setOwner(UserInterface $account) { public function setOwner(UserInterface $account) {
$this->set('user_id', $account->id()); return $this->set('user_id', $account->id());
return $this;
} }
/** /**
...@@ -283,6 +296,10 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface { ...@@ -283,6 +296,10 @@ class ElasticIp extends ContentEntityBase implements ElasticIpInterface {
->setLabel(t('Changed')) ->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.')); ->setDescription(t('The time that the entity was last edited.'));
$fields['refreshed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Refreshed'))
->setDescription(t('The time that the entity was last refreshed.'));
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by')) ->setLabel(t('Authored by'))
->setDescription(t('The user ID of the AwsCloudEc2ElasticIp entity author.')) ->setDescription(t('The user ID of the AwsCloudEc2ElasticIp entity author.'))
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Contains \Drupal\aws_cloud\Entity\Ec2\Image. * Contains \Drupal\aws_cloud\Entity\Ec2\Image.
*/ */
// updated by yas 2016/05/29
// updated by yas 2016/05/28
// updated by yas 2016/05/26 // updated by yas 2016/05/26
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/23 // updated by yas 2016/05/23
...@@ -33,9 +35,9 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface; ...@@ -33,9 +35,9 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface;
* id = "aws_cloud_image", * id = "aws_cloud_image",
* label = @Translation("AWS Cloud Image"), * label = @Translation("AWS Cloud Image"),
* handlers = { * handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\ImageListBuilder", * "list_builder" = "Drupal\aws_cloud\Controller\Ec2\ImageListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\ImageViewsData", * "views_data" = "Drupal\aws_cloud\Entity\Ec2\ImageViewsData" ,
* *
* "form" = { * "form" = {
* "default" = "Drupal\aws_cloud\Form\Ec2\ImageEditForm" , * "default" = "Drupal\aws_cloud\Form\Ec2\ImageEditForm" ,
...@@ -46,7 +48,7 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface; ...@@ -46,7 +48,7 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface;
* "access" = "Drupal\aws_cloud\Controller\Ec2\ImageAccessControlHandler", * "access" = "Drupal\aws_cloud\Controller\Ec2\ImageAccessControlHandler",
* }, * },
* base_table = "aws_cloud_image", * base_table = "aws_cloud_image",
* admin_permission = "administer aws cloud ec2 image", * admin_permission = "administer aws cloud image",
* fieldable = TRUE, * fieldable = TRUE,
* entity_keys = { * entity_keys = {
* "id" = "id", * "id" = "id",
...@@ -54,8 +56,8 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface; ...@@ -54,8 +56,8 @@ use Drupal\aws_cloud\Aws\Ec2\ImageInterface;
* "uuid" = "uuid" * "uuid" = "uuid"
* }, * },
* links = { * links = {
* "canonical" = "/entity.aws_cloud_image.canonical", * "canonical" = "/entity.aws_cloud_image.canonical" ,
* "edit-form" = "/entity.aws_cloud_image.edit_form", * "edit-form" = "/entity.aws_cloud_image.edit_form" ,
* "delete-form" = "/entity.aws_cloud_image.delete_form", * "delete-form" = "/entity.aws_cloud_image.delete_form",
* "collection" = "/entity.aws_cloud_image.collection" * "collection" = "/entity.aws_cloud_image.collection"
* }, * },
...@@ -87,6 +89,13 @@ class Image extends ContentEntityBase implements ImageInterface { ...@@ -87,6 +89,13 @@ class Image extends ContentEntityBase implements ImageInterface {
return $this->get('image_id')->value; return $this->get('image_id')->value;
} }
/**
* {@inheritdoc}
*/
public function name() {
return $this->get('name')->value;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -220,6 +229,20 @@ class Image extends ContentEntityBase implements ImageInterface { ...@@ -220,6 +229,20 @@ class Image extends ContentEntityBase implements ImageInterface {
return $this->get('changed')->value; return $this->get('changed')->value;
} }
/**
* {@inheritdoc}
*/
public function refreshed() {
return $this->get('refreshed')->value;
}
/**
* {@inheritdoc}
*/
public function setRefreshed($time) {
return $this->set('refreshed', $time);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -253,8 +276,7 @@ class Image extends ContentEntityBase implements ImageInterface { ...@@ -253,8 +276,7 @@ class Image extends ContentEntityBase implements ImageInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setOwner(UserInterface $account) { public function setOwner(UserInterface $account) {
$this->set('user_id', $account->id()); return $this->set('user_id', $account->id());
return $this;
} }
/** /**
...@@ -403,6 +425,10 @@ class Image extends ContentEntityBase implements ImageInterface { ...@@ -403,6 +425,10 @@ class Image extends ContentEntityBase implements ImageInterface {
->setLabel(t('Changed')) ->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.')); ->setDescription(t('The time that the entity was last edited.'));
$fields['refreshed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Refreshed'))
->setDescription(t('The time that the entity was last refreshed.'));
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by')) ->setLabel(t('Authored by'))
->setDescription(t('The user ID of the AwsCloudEc2Image entity author.')) ->setDescription(t('The user ID of the AwsCloudEc2Image entity author.'))
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Contains \Drupal\aws_cloud\Entity\Ec2\Instance. * Contains \Drupal\aws_cloud\Entity\Ec2\Instance.
*/ */
// updated by yas 2016/05/29
// updated by yas 2016/05/28
// updated by yas 2016/05/26 // updated by yas 2016/05/26
// updated by yas 2016/05/25 // updated by yas 2016/05/25
// updated by yas 2016/05/23 // updated by yas 2016/05/23
...@@ -33,7 +35,7 @@ use Drupal\aws_cloud\Aws\Ec2\InstanceInterface; ...@@ -33,7 +35,7 @@ use Drupal\aws_cloud\Aws\Ec2\InstanceInterface;
* id = "aws_cloud_instance", * id = "aws_cloud_instance",
* label = @Translation("AWS Cloud Instance"), * label = @Translation("AWS Cloud Instance"),
* handlers = { * handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" ,
* "list_builder" = "Drupal\aws_cloud\Controller\Ec2\InstanceListBuilder", * "list_builder" = "Drupal\aws_cloud\Controller\Ec2\InstanceListBuilder",
* "views_data" = "Drupal\aws_cloud\Entity\Ec2\InstanceViewsData" , * "views_data" = "Drupal\aws_cloud\Entity\Ec2\InstanceViewsData" ,
* *
...@@ -438,6 +440,20 @@ class Instance extends ContentEntityBase implements InstanceInterface { ...@@ -438,6 +440,20 @@ class Instance extends ContentEntityBase implements InstanceInterface {
return $this->get('changed')->value; return $this->get('changed')->value;
} }
/**
* {@inheritdoc}
*/
public function refreshed() {
return $this->get('refreshed')->value;
}
/**
* {@inheritdoc}
*/
public function setRefreshed($time) {
return $this->set('refreshed', $time);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -463,8 +479,7 @@ class Instance extends ContentEntityBase implements InstanceInterface { ...@@ -463,8 +479,7 @@ class Instance extends ContentEntityBase implements InstanceInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setOwnerId($uid) { public function setOwnerId($uid) {
$this->set('user_id', $uid); return $this->set('user_id', $uid);
return $this;
} }
/** /**
...@@ -741,6 +756,10 @@ class Instance extends ContentEntityBase implements InstanceInterface { ...@@ -741,6 +756,10 @@ class Instance extends ContentEntityBase implements InstanceInterface {
->setLabel(t('Changed')) ->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.')); ->setDescription(t('The time that the entity was last edited.'));
$fields['refreshed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Refreshed'))
->setDescription(t('The time that the entity was last refreshed.'));
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by')) ->setLabel(t('Authored by'))
->setDescription(t('The user ID of the Instance entity author.')) ->setDescription(t('The user ID of the Instance entity author.'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment