Skip to content

Commit 72b93b8

Browse files
committed
Update Cloud KMS samples
1 parent 261318a commit 72b93b8

Some content is hidden

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

59 files changed

+2395
-1700
lines changed

kms/README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,58 @@
77

88
## Description
99

10-
These samples show how to use the
11-
[Google Cloud KMS API](https://cloud.google.com/kms/docs/reference/libraries) from PHP.
10+
These samples demonstrate how to invoke [Google Cloud KMS][kms] from PHP.
1211

1312
## Build and Run
14-
1. **Enable APIs** - [Enable the KMS API](https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com)
13+
14+
1. **Enable APIs** - [Enable the KMS
15+
API](https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com)
1516
and create a new project or select an existing project.
16-
2. **Activate your Credentials** - If you do not already have an active set of credentials, create and download a [JSON Service Account key](https://console.cloud.google.com/apis/credentials/serviceaccountkey). Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` as the path to the downloaded JSON file.
17-
3. **Clone the repo** and cd into this directory
1817

19-
```
18+
1. **Download The Credentials** - Click "Go to credentials" after enabling the
19+
APIs. Click "New Credentials" and select "Service Account Key". Create a new
20+
service account, use the JSON key type, and select "Create". Once
21+
downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to
22+
the path of the JSON key that was downloaded.
23+
24+
1. **Clone the repo** and cd into this directory
25+
26+
```text
2027
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
2128
$ cd php-docs-samples/kms
2229
```
23-
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
24-
Run `php composer.phar install` (if composer is installed locally) or `composer install`
25-
(if composer is installed globally).
26-
5. Run `php src/SNIPPET_NAME.php`. The usage will print for each if no arguments
27-
are provided:
28-
```sh
29-
$ php src/create_dataset.php
30-
Usage: php src/list_keyrings.php PROJECT_ID LOCATION
31-
32-
$ php src/list_keyrings.php your-project-id us-west1
33-
Name: projects/your-project-id/locations/us-west1/keyRings/your-test-keyring
34-
Create Time: 2018-12-28 06:27:56
30+
31+
1. **Install dependencies** via [Composer][install-composer]. If composer is
32+
installed locally:
33+
34+
```text
35+
$ php composer.phar install
3536
```
3637
38+
If composer is installed globally:
39+
40+
```text
41+
$ composer install
42+
```
43+
44+
1. Execute the snippets in the [src/](src/) directory by running:
45+
46+
```text
47+
$ php src/SNIPPET_NAME.php
48+
```
49+
50+
The usage will print for each if no arguments are provided.
51+
52+
See the [Cloud KMS Documentation](https://cloud.google.com/kms/docs) for more
53+
information.
54+
3755
## Contributing changes
3856
3957
* See [CONTRIBUTING.md](../CONTRIBUTING.md)
4058
4159
## Licensing
4260
4361
* See [LICENSE](../LICENSE)
62+
63+
[install-composer]: http://getcomposer.org/doc/00-intro.md
64+
[kms]: https://cloud.google.com/kms

kms/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"google/cloud-kms": "^1.3.1"
3+
"google/cloud-kms": "^1.10.0"
44
}
55
}

kms/quickstart.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

kms/src/add_member_to_cryptokey_policy.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

kms/src/add_member_to_keyring_policy.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

kms/src/create_cryptokey.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

kms/src/create_cryptokey_version.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)