-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(parametermanager): Added global and regional samples for parameter manager #2071
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
feat(parametermanager): Added global and regional samples for parameter manager #2071
Conversation
Here is the summary of changes. You are about to add 30 region tags.
This comment is generated by snippet-bot.
|
Raised a duplicate of this PR #2079 because Vatsal's CLA has expired, which is blocking the merge. Once the new PR is merged, will close the original one. |
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) | |
]); |
$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 - might be better to use json_encode
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.
$payload = '{"username": "test-user", "host": "localhost"}'; | |
$payload = json_encode(['username' => 'test-user', 'host' => 'localhost']); |
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 here
Closing as duplicate of #2079 |
Description
Created samples for Global and Regional Parameter Manager API
Samples (Global, Regional)
quickstart
parameter-structured-data
parameter-unstructured-data
add-parameter-version (structured, unstructured)
create-parameter-secret-reference
list-all-parameters
view-parameter-details
delete-parameter
list-all-parameters-versions
view-parameter-version-details
render-secret-parameter-version
disable-parameters-version
enable-disabled-parameters-version
delete-parameter-version
Checklist
../testing/vendor/bin/phpunit test/ -v
php-cs-fixer fix . --config .php-cs-fixer.dist.php