Problem/Motivation

  • After entering all the information and hitting Save button, an error message saying required IAM permissions are missing appears. This error message should show before entering the info.

Proposed resolution

  • Instead of showing error messages when opening an add resource form, show Add <Resource Name> button only when all required IAM permissions are set for the add operation.

User interface changes

  • If the required IAM permission is missing for adding a resource, Add <Resource Name> button will now show.

Issue fork cloud-3206834

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kumikoono created an issue. See original summary.

kumikoono’s picture

Status: Active » Needs review
StatusFileSize
new10.35 KB

Picked NetworkInterface resource for review.

yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for adding the validation. I posted my comments. Please check. Thanks.

  • yas committed ad9f271 on 3.x authored by kumikoono
    Issue #3206834 by kumikoono, yas: Show the Add button only when IAM...
kumikoono’s picture

Status: Needs work » Needs review
  • Incorporated the comments
  • Added more resources. (Note: Volume and Snapshot are to be fixed.)
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. I posted my comments. Please check the ones. Thanks

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new25.05 KB
  • Revertes logger changes
  • Supportes Add button control for all AWS resources
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. I put my above comments. Please check the ones. Thanks

kumikoono’s picture

StatusFileSize
new32.95 KB

@yas Thanks for your review.
Per our discussion, I refactored the changes to rebase on Issue #3209211.
I also incorporated your comments.

kumikoono’s picture

Status: Needs work » Needs review
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. I posted my comments. Please check the ones. Thanks

baldwinlouie’s picture

@kumikoono, Thank you for the patch. I posted my comments above.

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new56.28 KB

@yas @baldwin
Thanks for your review. Per our discussion, I tried to minimize the changes to move forward breaking Ec2Service class into per-resource class.

kumikoono’s picture

StatusFileSize
new56.29 KB

Fixed coding rule violations.

kumikoono’s picture

StatusFileSize
new56.71 KB

Thanks for your comments, @yas @baldwin.
I incorporate your comments.

kumikoono’s picture

StatusFileSize
new58.16 KB

Created a new branch and a new merge request.

baldwinlouie’s picture

@kumikoono, thank you for the updated patch. It looks good to me.

baldwinlouie’s picture

@yas and @kumikoono, Thank you for adding the test cases. The tests look good to me.

kumikoono’s picture

StatusFileSize
new65.71 KB

@yas @baldwind Thanks for your review. I'll add more test cases to cover other resources.

yas’s picture

Status: Needs review » Needs work

@baldwinlouie

Thank you for your review.

@kumikoono

Thank you for the update and refactoring. I reviewed the patch and the logic looks good to me now. I posted my comments above. Please check the ones. Thanks

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new102.54 KB

@yas Thanks for your review.

  • Added test cases to cover all the resource added access control
  • Changes the constant names
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. There look some leftovers in my previous comment and I posted my new comments above. Could you please check them? Thanks

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new102.49 KB
yas’s picture

@kumikoono

Thank you for the update. I found the one thing that we needed to modify the header comment at Ec2Service::describeInstances(). Thanks

kumikoono’s picture

Status: Needs work » Needs review

Incorporated your comment on the original code.

We know the original code is missing return type hints and has wrong return type comments, but this patch limits the fixes to the related functions.

yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. Yes I understand the patch limits the fixes to the related function basically. From a code reviewer's point of view, you removed $params += $this->getDefaultParameters(); from Ec2Service::describeInstances(), so I posted my comment to fix that header comment. I couldn't find the other similar cases in Ec2Service since it looks all the other functions have {@inheritdoc} as a header comment so we don't have to modify or fix those in the Ec2Service class. So could you please fix it?

kumikoono’s picture

Status: Needs work » Needs review

@yas Thanks for your explanation.
I found Ec2Service::describeInstances() has its own comment that was exactly the same text as the one in the Ec2ServiceInterface, and its signature is also the same. This means {@inheritdoc} is appropriate similar to other functions. I changed that part to be consistent. Is it OK to you?

yas’s picture

@kumikoono

Thank you for the update. Yes, it would be even better to change the header comment with {@inheritdoc}.

yas’s picture

StatusFileSize
new102.72 KB
yas’s picture

Status: Needs review » Reviewed & tested by the community

@kumikoono

Thank you for the update. It looks good to me now. I'll change the status to RTBC. Please continue to work on the same repository and change the status to Needs review when you are ready for the next milestone.

kumikoono’s picture

StatusFileSize
new91.53 KB

Instead of resolving many conflicts, I created a new branch (-2) as the base code for subsequent work.
This patch consists of the changes made on the previous branch (-1).

kumikoono’s picture

StatusFileSize
new102.28 KB
kumikoono’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new110.07 KB

The previous commits include

  • Support Import Image/Key Pair buttons. 26fd22ec
  • Apply the patch of Issue #3213753, allowing NULL return type, and extend it to similar functions. 60e085f4
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for adding the validations. I tried to apply the patch but the git error occurred as follows due to the merge at #3213753:

$ git apply -v /tmp/227.diff 
Checking patch modules/cloud_service_providers/aws_cloud/aws_cloud.routing.yml...
Checking patch modules/cloud_service_providers/aws_cloud/src/Controller/Config/AwsCloudConfigController.php...
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchService.php...
error: while searching for:
  /**
   * {@inheritdoc}
   */
  public function getMetricData(array $params = [], array $credentials = []): ResultInterface {
    return $this->execute('GetMetricData', $params, $credentials);
  }


error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchService.php:87
error: modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchService.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchServiceInterface.php...
error: while searching for:
   * @return \Aws\ResultInterface
   *   Result or NULL if there is an error.
   */
  public function getMetricData(array $params = [], array $credentials = []): ResultInterface;

}

error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchServiceInterface.php:28
error: modules/cloud_service_providers/aws_cloud/src/Service/CloudWatch/CloudWatchServiceInterface.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php...
error: while searching for:
   * @param array $credentials
   *   The array of credentials.
   *
   * @return array
   *   Array of execution result or NULL if there is an error.
   *
   * @throws \Drupal\aws_cloud\Service\Ec2\Ec2ServiceException
   *   If the $params is empty or $ec2_client (Ec2Client) is NULL.
   */
  private function execute($operation, array $params = [], array $credentials = []) {
    $results = NULL;

    $ec2_client = $this->getEc2Client($credentials);
    if (empty($ec2_client)) {
      throw new Ec2ServiceException('No EC2 Client found.  Cannot perform API operations');
    }

    try {

error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php:379
error: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2ServiceException.php...
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2ServiceInterface.php...
error: while searching for:
   * @return \Aws\ResultInterface
   *   Result or NULL if there is an error.
   */
  public function authorizeSecurityGroupIngress(array $params = [], array $credentials = []): ResultInterface;

  /**
   * Calls the Amazon EC2 API endpoint AuthorizeSecurityGroupEgress.

error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2ServiceInterface.php:40
error: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2ServiceInterface.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/S3/S3Service.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/ElasticIpTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/ImageTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/KeyPairTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/NetworkInterfaceTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/SecurityGroupTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/SnapshotTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Ec2/VolumeTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/CarrierGatewayTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/InternetGatewayTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/SubnetTest.yml...
/tmp/227.diff:1700: new blank line at EOF.
+
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/TransitGatewayTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/VpcPeeringConnectionTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/mock_data/Functional/Vpc/VpcTest.yml...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ElasticIpTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ImageTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/KeyPairTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/NetworkInterfaceTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/SecurityGroupTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/SnapshotTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/VolumeTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/CarrierGatewayTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/InternetGatewayTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/SubnetTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/TransitGatewayTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/VpcPeeringConnectionTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/Vpc/VpcTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/cloud/config/AwsCloudConfigPermissionTest.php...
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Traits/AwsCloudTestMockTrait.php...
Checking patch src/Controller/CloudConfigController.php...

Could you please fix that?

kumikoono’s picture

As you see the history, the tests passed yesterday when I uploaded the patch. However, re-testing failed 15 hours later. It looks caused by the base file change. I'll rebase and update the patch.

  • 14 May 2021 at 08:19 UTC PHP 7.4 & MySQL 8, D9.0.11 Patch Failed to Apply
  • 13 May 2021 at 19:48 UTC PHP 7.4 & MySQL 8, D9.0.11 310 pass
kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new103.51 KB
yas’s picture

Status: Needs review » Reviewed & tested by the community

@kumikoono

Thank you for the update. I tested the patch and it looks good to me now. I'll change the status to RTBC. Please continue to work on the same repository and change the status to Needs review when you are ready for the next milestone.

kumikoono’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new122.08 KB

Adds-related button control with test cases.

Status: Needs review » Needs work

The last submitted patch, 43: 3206834-43.diff, failed testing. View results

kumikoono’s picture

Some tests are failing. I'll check them.

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new126 KB
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for adding the valications. I posted my comment above. Please check the ones. Thanks

kumikoono’s picture

StatusFileSize
new126.09 KB

@yas Thanks for your review.

  • Incorporated part of your suggestions. Some are not incorporated for the reasons I responded.
kumikoono’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 48: 3206834-48.diff, failed testing. View results

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new126.18 KB
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. I posted my comments above. Please check the ones. Thanks

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new137.07 KB

@yas @baldwinlouie Thanks for your review. I incorporated your suggestions.
Regarding the test failure with AwsCloudConfigTest, I moved the placeBlock() from the setup to the test case requiring the block.

yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. I posted my comment above. Please check them. Thanks.

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new143.09 KB
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for your update. I reviewed the entire patch. I put my comments above. Please check all unresolved comments incl. the previous leftovers.

Thanks

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new152.98 KB
yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. There are some leftovers. I also posted my comment above. Please check the ones. Thanks.

kumikoono’s picture

StatusFileSize
new149.25 KB
  • The previous patch included refactored code for the button access control for Aws resources other than launch template.
  • This patch incorporates all the remaining comments.
kumikoono’s picture

Status: Needs work » Needs review

kumikoono’s picture

This new branch, 3206834-4, is just rebased on the latest 3.x with the patch -59.

kumikoono’s picture

StatusFileSize
new153.46 KB

@yas @baldwininoue Thanks for your close review.

yas’s picture

Status: Needs review » Needs work

@kumikoono

Thank you for the update. Introducing Drupal\aws_cloud\Access\AwsCloudAccess makes the code even clearer. I posted my minor comments. Please check the ones.

@baldwinlouie

What do you think?

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new153.52 KB

@yas Thanks for review. Updated the patch.

baldwinlouie’s picture

@yas and @kumikoono,

Thank you for the updated patch. It looks good to me!

yas’s picture

Status: Needs review » Reviewed & tested by the community

@baldwinlouie

Thank you for your review.

@kumikoono

Thank you for the update. I'll change the status to RTBC. I'll merge the patch to 4.x branch when it's ready.

yas’s picture

Status: Reviewed & tested by the community » Needs work

@kumikoono

The patch is now behind against HEAD. Could you please rebase and resolve the conflicts? I'll change the status to Needs work. Thanks

yas’s picture

Version: 3.x-dev » 4.x-dev
kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new149.49 KB

Rebased onto 4.x and resolved conflicts.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@kumikoono

The tests have been passed successfully, so I'll merge the patch to 4.x and close this issue as Fixed.

yas’s picture

Status: Reviewed & tested by the community » Needs work

@kumikoono

I tried to merge the patch however the following errors occurred during the merge process due to the patch at #3209211: Refactor exceptions thrown on DryRun API calls in <AwsService>Service::execute(). So could you please rebase it again? Thanks

error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php:3664
error: modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php: patch does not apply
error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/S3/S3Service.php:7
error: modules/cloud_service_providers/aws_cloud/src/Service/S3/S3Service.php: patch does not apply
3206834-73.diff:1875: new blank line at EOF.

kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new152.92 KB

Rebased again.

kumikoono’s picture

StatusFileSize
new152.49 KB

Fixed coding rule violations.

kumikoono’s picture

Status: Needs review » Needs work
kumikoono’s picture

Status: Needs work » Needs review
StatusFileSize
new152 KB

Resolved issues with rebase.

yas’s picture

@kumikoono

Thank you for the rebase. I have one quick question at https://git.drupalcode.org/project/cloud/-/merge_requests/271#note_30289. Could you please give me the explanation? Thanks

kumikoono’s picture

StatusFileSize
new151.93 KB

@yas Can you review the updated patch?

yas’s picture

Status: Needs review » Reviewed & tested by the community

@kumikoono

Thank you for the update. It looks good. The tests have been passed successfully, so I'll merge the patch to 4.x and close this issue as Fixed. Thanks

  • yas committed 4e20e4f on 4.x authored by kumikoono
    Issue #3206834 by kumikoono, yas, baldwinlouie: Show the Add button only...

yas’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.