Skip to content

Commit 88270b7

Browse files
committed
Adds metadata file and support for creating the Express subdirectory in S3 for PHP, and moves those files.
1 parent 529c7f0 commit 88270b7

File tree

8 files changed

+37
-59
lines changed

8 files changed

+37
-59
lines changed

.doc_gen/cross-content/phrases-code-examples.ent

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@
162162
<!ENTITY CFJS10 'JavaScript runtime 1.0 for &CF; Functions'>
163163
<!ENTITY CFJS20long 'JavaScript runtime 2.0 for &CFlong; Functions'>
164164
<!ENTITY CFJS20 'JavaScript runtime 2.0 for &CF; Functions'>
165+
166+
<!-- S3 only entity to account for super-short usage -->
167+
<!ENTITY S3only 'S3'>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
s3-directory-buckets_Scenario_ExpressBasics:
2+
synopsis_list:
3+
- Set up a VPC and VPC Endpoint
4+
- Set up the S3 Express Policies, Roles, and User to work with S3 Express buckets
5+
- Create two S3 Clients
6+
- Create two buckets
7+
- Create an object and copy it over
8+
- Demonstrate performance difference
9+
- Populate the buckets to show the lexicographical difference
10+
- Prompt the user to see if they want to clean up the resources
11+
category: Basics
12+
languages:
13+
PHP:
14+
versions:
15+
- sdk_version: 3
16+
github: php/example_code/s3
17+
sdkguide:
18+
excerpts:
19+
- description: Run a scenario demonstrating the basics of &S3; Express One Zone.
20+
snippet_tags:
21+
- php.example_code.s3.ExpressBasics
22+
- php.example_code.s3.service.S3Service
23+
services:
24+
s3-directory-buckets: {CreateBucket, CopyObject, GetObject, PutObject, ListObjects, DeleteObject, DeleteBucket}

.doc_gen/metadata/s3_metadata.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,32 +3481,6 @@ s3_Scenario_ConditionalRequests:
34813481
- python.example_code.s3.S3ConditionalRequests.wrapper
34823482
services:
34833483
s3: {GetObject, PutObject, CopyObject}
3484-
s3_Scenario_ExpressBasics:
3485-
title: Learn the basics of Amazon S3 Express One Zone with an &AWS; SDK
3486-
title_abbrev: Learn the basics of S3 Express One Zone
3487-
synopsis_list:
3488-
- Set up a VPC and VPC Endpoint
3489-
- Set up the S3 Express Policies, Roles, and User to work with S3 Express buckets
3490-
- Create two S3 Clients
3491-
- Create two buckets
3492-
- Create an object and copy it over
3493-
- Demonstrate performance difference
3494-
- Populate the buckets to show the lexicographical difference
3495-
- Prompt the user to see if they want to clean up the resources
3496-
category: Basics
3497-
languages:
3498-
PHP:
3499-
versions:
3500-
- sdk_version: 3
3501-
github: php/example_code/s3
3502-
sdkguide:
3503-
excerpts:
3504-
- description:
3505-
snippet_tags:
3506-
- php.example_code.s3.ExpressBasics
3507-
- php.example_code.s3.service.S3Service
3508-
services:
3509-
s3: {CreateVpc, DescribeRouteTables, CreateVpcEndpoint, CreateBucket, CopyObject, GetObject, PutObject, ListObjects, DeleteObject, DeleteBucket, DeleteVpcEndpoint, DeleteVpc}
35103484
s3_Scenario_DownloadS3Directory:
35113485
title: Download S3 'directories' from an &S3long; (&S3;) bucket
35123486
title_abbrev: Download S3 'directories'

.tools/readmes/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
"base_folder": "php",
125125
"service_folder": 'php/example_code/{{service["name"]}}',
126126
"sdk_api_ref": 'https://docs.aws.amazon.com/aws-sdk-php/v3/api/namespace-Aws.{{service["name"] | capitalize}}.html',
127+
"service_folder_overrides": {
128+
"s3-directory-buckets": "php/example_code/s3/express",
129+
}
127130
}
128131
},
129132
"Python": {

php/example_code/s3/README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `php`
3939
Code examples that show you how to perform the essential operations within a service.
4040

4141
- [Learn the basics](GettingStartedWithS3.php)
42-
- [Learn the basics of S3 Express One Zone](S3ExpressBasics.php)
4342

4443

4544
### Single actions
@@ -97,26 +96,6 @@ This example shows you how to do the following:
9796
<!--custom.basics.s3_Scenario_GettingStarted.start-->
9897
<!--custom.basics.s3_Scenario_GettingStarted.end-->
9998

100-
#### Learn the basics of S3 Express One Zone
101-
102-
This example shows you how to do the following:
103-
104-
- Set up a VPC and VPC Endpoint
105-
- Set up the S3 Express Policies, Roles, and User to work with S3 Express buckets
106-
- Create two S3 Clients
107-
- Create two buckets
108-
- Create an object and copy it over
109-
- Demonstrate performance difference
110-
- Populate the buckets to show the lexicographical difference
111-
- Prompt the user to see if they want to clean up the resources
112-
113-
<!--custom.basic_prereqs.s3_Scenario_ExpressBasics.start-->
114-
<!--custom.basic_prereqs.s3_Scenario_ExpressBasics.end-->
115-
116-
117-
<!--custom.basics.s3_Scenario_ExpressBasics.start-->
118-
<!--custom.basics.s3_Scenario_ExpressBasics.end-->
119-
12099

121100
#### Create a presigned URL
122101

php/example_code/s3/ExpressRunner.php renamed to php/example_code/s3/express/ExpressRunner.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Aws\Exception\AwsException;
88
use AwsUtilities\RunnableExample;
9+
use S3\express\S3ExpressBasics;
910

1011
require_once __DIR__ . "/vendor/autoload.php";
1112

php/example_code/s3/S3ExpressBasics.php renamed to php/example_code/s3/express/S3ExpressBasics.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* vendor/bin/phpunit S3ExpressBasicsTests.php
2121
**/
2222

23-
namespace S3;
23+
namespace S3\express;
2424
use Aws\CloudFormation\CloudFormationClient;
2525
use Aws\CloudFormation\Exception\CloudFormationException;
2626
use Aws\Credentials\Credentials;
@@ -31,6 +31,7 @@
3131
use AwsUtilities\RunnableExample;
3232
use Ec2\EC2Service;
3333
use Iam\IAMService;
34+
use S3\S3Service;
3435
use function AwsUtilities\pressEnter;
3536
use function AwsUtilities\testable_readline;
3637

@@ -110,7 +111,7 @@ public function runExample()
110111

111112
$this->cloudFormationClient = new CloudFormationClient([]);
112113
$stackName = "cfn-stack-s3-express-basics-" . uniqid();
113-
$file = file_get_contents(__DIR__ . "/../../../resources/cfn/s3_express_basics/s3_express_template.yml");
114+
$file = file_get_contents(__DIR__ . "/../../../../resources/cfn/s3_express_basics/s3_express_template.yml");
114115
$result = $this->cloudFormationClient->createStack([
115116
'StackName' => $stackName,
116117
'TemplateBody' => $file,
@@ -138,14 +139,10 @@ public function runExample()
138139
$expressUserName = $output['OutputValue'];
139140
}
140141
}
141-
$this->resources['regularUserName'] = $regularUserName;
142-
$this->resources['expressUserName'] = $expressUserName;
143142
$regularKey = $this->iamService->createAccessKey($regularUserName);
144143
$regularCredentials = new Credentials($regularKey['AccessKeyId'], $regularKey['SecretAccessKey']);
145-
$this->resources['regularKey'] = $regularKey['AccessKeyId'];
146144
$expressKey = $this->iamService->createAccessKey($expressUserName);
147145
$expressCredentials = new Credentials($expressKey['AccessKeyId'], $expressKey['SecretAccessKey']);
148-
$this->resources['expressKey'] = $expressKey['AccessKeyId'];
149146

150147
// 3. Create an additional client using the credentials with S3 Express permissions.
151148
echo "\n";

php/example_code/s3/tests/S3ExpressBasicsTest.php renamed to php/example_code/s3/express/tests/S3ExpressBasicsTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
// Integration test runner for S3ExpressBasics.php.
77
//
88

9-
namespace S3\tests;
9+
namespace S3\express\tests;
1010

11-
use Aws\CloudFormation\CloudFormationClient;
1211
use Aws\S3\Exception\S3Exception;
13-
use Aws\S3\S3Client;
1412
use PHPUnit\Framework\TestCase;
15-
use S3\S3ExpressBasics;
16-
use S3\S3Service;
13+
use S3\express\S3ExpressBasics;
1714

1815
/**
1916
* @group integ
20-
* @covers \S3\S3ExpressBasics
17+
* @covers \S3\express\S3ExpressBasics
2118
* @covers \S3\S3Service
2219
*/
2320
class S3ExpressBasicsTest extends TestCase

0 commit comments

Comments
 (0)