feat(parametermanager): Added samples for global & regional parameter manager#2079
Conversation
bshaffer
left a comment
There was a problem hiding this comment.
see my comments on #2071 (review)
bshaffer
left a comment
There was a problem hiding this comment.
this is really well done! I was able to run the tests locally and they all passed.
I made some minor suggestions for how to construct the JSON payload - it's more idiomatic to call json_encode on a PHP array than hardcode a string. But this is minor, so, approved!
| $parent = $client->parameterName($projectId, 'global', $parameterId); | ||
|
|
||
| // Build payload. | ||
| $payload = sprintf('{"username": "test-user", "password": "__REF__(//secretmanager.googleapis.com/%s)"}', $secretId); |
There was a problem hiding this comment.
This would be better off using json_encode:
| $payload = sprintf('{"username": "test-user", "password": "__REF__(//secretmanager.googleapis.com/%s)"}', $secretId); | |
| $payload = json_encode([ | |
| 'username' => 'test-user', | |
| 'password' => sprintf('__REF__(//secretmanager.googleapis.com/%s)', $secretId) | |
| ]); |
There was a problem hiding this comment.
I've updated payload using json_encode.
| $parent = $client->parameterName($projectId, $locationId, $parameterId); | ||
|
|
||
| // Build payload. | ||
| $payload = sprintf('{"username": "test-user", "password": "__REF__(//secretmanager.googleapis.com/%s)"}', $secretId); |
There was a problem hiding this comment.
Same with this one - better to use json_encode
There was a problem hiding this comment.
I've updated payload using json_encode.
parametermanager/src/quickstart.php
Outdated
| printf('Created parameter %s with format %s' . PHP_EOL, $newParameter->getName(), ParameterFormat::name($newParameter->getFormat())); | ||
|
|
||
| // Create a new ParameterVersionPayload object and set the json data. | ||
| $payload = '{"username": "test-user", "host": "localhost"}'; |
There was a problem hiding this comment.
Same with this one - better to use json_encode
| $payload = '{"username": "test-user", "host": "localhost"}'; | |
| $payload = json_encode(['username' => 'test-user', 'host' => 'localhost']); |
There was a problem hiding this comment.
I've updated payload using json_encode.
| printf('Created regional parameter %s with format %s' . PHP_EOL, $newParameter->getName(), ParameterFormat::name($newParameter->getFormat())); | ||
|
|
||
| // Create a new ParameterVersionPayload object and set the json data. | ||
| $payload = '{"username": "test-user", "host": "localhost"}'; |
There was a problem hiding this comment.
Same with this one - better to use json_encode
| $payload = '{"username": "test-user", "host": "localhost"}'; | |
| $payload = json_encode(['username' => 'test-user', 'host' => 'localhost']); |
There was a problem hiding this comment.
I've updated payload using json_encode.
|
Here is the summary of changes. You are about to add 30 region tags.
This comment is generated by snippet-bot.
|
|
@bshaffer Could you please look into it? |
|
@bshaffer Could you please look into this? |
Description
Created samples for Global and Regional Parameter Manager API
Samples (Global, Regional)
Checklist
Please merge this PR for me once it is approved