1818 *
1919 * or as a PHPUnit test:
2020 * vendor/bin/phpunit S3ExpressBasicsTests.php
21- * /* */
21+ **/
2222
2323namespace S3 ;
2424use Aws \CloudFormation \CloudFormationClient ;
@@ -67,7 +67,7 @@ public function runExample()
6767 $ uuid = uniqid ();
6868
6969 echo <<<INTRO
70- Let's get started! First, please not that S3 Express One Zone works best when working within the AWS infrastructure,
70+ Let's get started! First, please note that S3 Express One Zone works best when working within the AWS infrastructure,
7171specifically when working in the same Availability Zone. To see the best results in this example, and when you implement
7272Directory buckets into your infrastructure, it is best to put your Compute resources in the same AZ as your Directory
7373bucket. \n
@@ -123,7 +123,7 @@ public function runExample()
123123 echo "Error waiting for the CloudFormation stack to create: {$ caught ->getAwsErrorMessage ()}\n" ;
124124 throw $ caught ;
125125 }
126- $ this ->resources ['StackName ' ] = $ stackName ;
126+ $ this ->resources ['stackName ' ] = $ stackName ;
127127 $ stackInfo = $ this ->cloudFormationClient ->describeStacks ([
128128 'StackName ' => $ result ['StackId ' ],
129129 ]);
@@ -138,10 +138,14 @@ public function runExample()
138138 $ expressUserName = $ output ['OutputValue ' ];
139139 }
140140 }
141+ $ this ->resources ['regularUserName ' ] = $ regularUserName ;
142+ $ this ->resources ['expressUserName ' ] = $ expressUserName ;
141143 $ regularKey = $ this ->iamService ->createAccessKey ($ regularUserName );
142144 $ regularCredentials = new Credentials ($ regularKey ['AccessKeyId ' ], $ regularKey ['SecretAccessKey ' ]);
145+ $ this ->resources ['regularKey ' ] = $ regularKey ['AccessKeyId ' ];
143146 $ expressKey = $ this ->iamService ->createAccessKey ($ expressUserName );
144147 $ expressCredentials = new Credentials ($ expressKey ['AccessKeyId ' ], $ expressKey ['SecretAccessKey ' ]);
148+ $ this ->resources ['expressKey ' ] = $ expressKey ['AccessKeyId ' ];
145149
146150 // 3. Create an additional client using the credentials with S3 Express permissions.
147151 echo "\n" ;
@@ -317,20 +321,13 @@ public function cleanUp()
317321 }
318322
319323 //delete the stack
320- if (isset ($ this ->resources ['StackName ' ])){
324+ if (isset ($ this ->resources ['stackName ' ])){
321325 $ this ->cloudFormationClient ->deleteStack ([
322- 'StackName ' => $ this ->resources ['StackName ' ],
326+ 'StackName ' => $ this ->resources ['stackName ' ],
323327 ]);
324- unset($ this ->resources ['StackName ' ]);
328+ unset($ this ->resources ['stackName ' ]);
325329 }
326330
327- // $this->iamService->deleteRole($this->resources['roleName']);
328- // unset($this->resources['roleName']);
329-
330- // delete User
331- // $this->iamService->deleteUser($this->resources['userName']);
332- // unset($this->resources['userName']);
333-
334331 // delete all the objects in both buckets
335332 if (isset ($ this ->resources ['objectKey ' ])){
336333 $ this ->s3Service ->deleteObject ($ this ->resources ['directoryBucketName ' ], $ this ->resources ['objectKey ' ]);
0 commit comments