-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(parametermanager): Added samples for global & regional parameter manager #2079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(parametermanager): Added samples for global & regional parameter manager #2079
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comments on #2071 (review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this one - better to use json_encode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
Description
Created samples for Global and Regional Parameter Manager API
Samples (Global, Regional)
Checklist
Please merge this PR for me once it is approved