Skip to content

Commit 2474a58

Browse files
authored
Adds Storage Veneer samples and CLI (GoogleCloudPlatform#173)
1 parent 0c1668b commit 2474a58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3015
-550
lines changed

pubsub/cli/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ This simple command-line application demonstrates how to invoke Google Pub\Sub f
2323
5. Run `php pubsub.php`. The following commands are available:
2424

2525
```sh
26-
iam Manage IAM for Pub\Sub
27-
subscription Manage subscriptions for Pub\Sub
28-
topic Manage topics for Pub\Sub
29-
6. Run `php pubsub.php COMMAND --help` to print information about the usage of each command.
26+
iam Manage IAM for Pub\Sub
27+
subscription Manage subscriptions for Pub\Sub
28+
topic Manage topics for Pub\Sub
3029
```
30+
6. Run `php pubsub.php COMMAND --help` to print information about the usage of each command.
3131

3232
## Contributing changes
3333

storage/api/README.md

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
This simple command-line application demonstrates how to invoke Google Cloud Storage from PHP.
66

7+
## Licensing
8+
9+
* See [LICENSE](../../LICENSE)
10+
711
## Build and Run
8-
1. **Enable APIs** - [Enable the Cloud Storage JSON API](https://console.cloud.google.com/flows/enableapi?apiid=storage_api)
12+
1. **Enable APIs** - [Enable the Storage API](https://console.cloud.google.com/flows/enableapi?apiid=storage_api)
913
and create a new project or select an existing project.
1014
2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials"
1115
and select "Service Account Key". Create a new service account, use the JSON key type, and
@@ -15,41 +19,23 @@ This simple command-line application demonstrates how to invoke Google Cloud Sto
1519

1620
```sh
1721
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
18-
$ cd php-docs-samples/storage/api
22+
$ cd php-docs-samples/storage/cli
1923
```
2024
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
2125
Run `php composer.phar install` (if composer is installed locally) or `composer install`
2226
(if composer is installed globally).
23-
5. Run `php listBuckets.php YOUR_PROJECT_NAME` where YOUR_PROJECT_NAME is the
24-
project associated with the credentials from **step 2**.
27+
5. Run `php storage.php`. The following commands are available:
2528

2629
```sh
27-
$ php listBuckets.php my-project-name
28-
my-project-name-bucket1
29-
my-project-name-bucket2
30-
my-project-name-bucket3
30+
bucket-acl Manage the ACL for Cloud Storage buckets.
31+
bucket-default-acl Manage the default ACL for Cloud Storage buckets.
32+
buckets Manage Cloud Storage buckets
33+
encryption Upload and download Cloud Storage objects with encryption
34+
object-acl Manage the ACL for Cloud Storage objects
35+
objects Manage Cloud Storage objects
3136
```
32-
6. Run `php listObjects.php YOUR_PROJECT_NAME YOUR_BUCKET_NAME` where YOUR_PROJECT_NAME is the
33-
project associated with the credentials from **step 2** and YOUR_BUCKET_NAME is a bucket from the list of bucket names in **step 5**.
34-
35-
```sh
36-
$ php listBuckets.php my-project-name my-project-name-bucket1
37-
my-project-name-bucket1-object1
38-
my-project-name-bucket1-object2
39-
my-project-name-bucket1-object3
40-
```
41-
7. Run `php listObjects.php YOUR_PROJECT_NAME YOUR_BUCKET_NAME YOUR_OBJECT_NAME` where YOUR_PROJECT_NAME is the project associated with the credentials from **step 2** and YOUR_BUCKET_NAME is a bucket from the list of bucket names in **step 5** and YOUR_OBJECT_NAME is an object name from the list of objects in **step 6**.
42-
43-
```sh
44-
$ php downloadObject.php my-project-name my-project-name-bucket1 my-project-name-bucket1-object1 myfile.txt
45-
File written to myfile.txt
46-
```
47-
37+
6. Run `php storage.php COMMAND --help` to print information about the usage of each command.
4838

4939
## Contributing changes
5040

5141
* See [CONTRIBUTING.md](../../CONTRIBUTING.md)
52-
53-
## Licensing
54-
55-
* See [LICENSE](../../LICENSE)

storage/api/composer.json

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
{
22
"require": {
3-
"google/apiclient": "^2.0"
3+
"google/cloud": "0.9",
4+
"paragonie/random_compat": "^2.0",
5+
"symfony/console": " ^3.0"
6+
},
7+
"autoload": {
8+
"psr-4": {
9+
"Google\\Cloud\\Samples\\Storage\\": "src/"
10+
},
11+
"files": [
12+
"src/functions/add_bucket_acl.php",
13+
"src/functions/add_bucket_default_acl.php",
14+
"src/functions/add_object_acl.php",
15+
"src/functions/copy_object.php",
16+
"src/functions/create_bucket.php",
17+
"src/functions/delete_bucket.php",
18+
"src/functions/delete_bucket_acl.php",
19+
"src/functions/delete_bucket_default_acl.php",
20+
"src/functions/delete_object.php",
21+
"src/functions/delete_object_acl.php",
22+
"src/functions/download_encrypted_object.php",
23+
"src/functions/download_object.php",
24+
"src/functions/object_metadata.php",
25+
"src/functions/generate_encryption_key.php",
26+
"src/functions/get_bucket_acl.php",
27+
"src/functions/get_bucket_acl_for_entity.php",
28+
"src/functions/get_bucket_default_acl.php",
29+
"src/functions/get_bucket_default_acl_for_entity.php",
30+
"src/functions/get_object_acl.php",
31+
"src/functions/get_object_acl_for_entity.php",
32+
"src/functions/list_buckets.php",
33+
"src/functions/list_objects.php",
34+
"src/functions/make_public.php",
35+
"src/functions/move_object.php",
36+
"src/functions/rotate_encryption_key.php",
37+
"src/functions/upload_encrypted_object.php",
38+
"src/functions/upload_object.php"
39+
]
440
}
541
}

0 commit comments

Comments
 (0)