Skip to content

Commit 99bdd75

Browse files
authored
docs(securitycenter): update comments to add new parent resource types (GoogleCloudPlatform#1864)
1 parent 3af3c8e commit 99bdd75

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

securitycenter/src/create_notification.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ function create_notification(
3535
string $topicName
3636
): void {
3737
$securityCenterClient = new SecurityCenterClient();
38-
$organizationName = $securityCenterClient::organizationName($organizationId);
38+
// 'parent' must be in one of the following formats:
39+
// "organizations/{orgId}"
40+
// "projects/{projectId}"
41+
// "folders/{folderId}"
42+
$parent = $securityCenterClient::organizationName($organizationId);
3943
$pubsubTopic = $securityCenterClient::topicName($projectId, $topicName);
4044

4145
$streamingConfig = (new StreamingConfig())->setFilter('state = "ACTIVE"');
@@ -45,7 +49,7 @@ function create_notification(
4549
->setStreamingConfig($streamingConfig);
4650

4751
$response = $securityCenterClient->createNotificationConfig(
48-
$organizationName,
52+
$parent,
4953
$notificationConfigId,
5054
$notificationConfig
5155
);

securitycenter/src/delete_notification.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function delete_notification(string $organizationId, string $notificationConfigI
2828
{
2929
$securityCenterClient = new SecurityCenterClient();
3030
$notificationConfigName = $securityCenterClient::notificationConfigName(
31+
// You can also use 'projectId' or 'folderId' instead of the 'organizationId'.
3132
$organizationId,
3233
$notificationConfigId
3334
);

securitycenter/src/get_notification.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function get_notification(string $organizationId, string $notificationConfigId):
2828
{
2929
$securityCenterClient = new SecurityCenterClient();
3030
$notificationConfigName = $securityCenterClient::notificationConfigName(
31+
// You can also use 'projectId' or 'folderId' instead of the 'organizationId'.
3132
$organizationId,
3233
$notificationConfigId
3334
);

securitycenter/src/list_notification.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626
function list_notification(string $organizationId): void
2727
{
2828
$securityCenterClient = new SecurityCenterClient();
29-
$organizationName = $securityCenterClient::organizationName($organizationId);
29+
// 'parent' must be in one of the following formats:
30+
// "organizations/{orgId}"
31+
// "projects/{projectId}"
32+
// "folders/{folderId}"
33+
$parent = $securityCenterClient::organizationName($organizationId);
3034

31-
foreach ($securityCenterClient->listNotificationConfigs($organizationName) as $element) {
35+
foreach ($securityCenterClient->listNotificationConfigs($parent) as $element) {
3236
printf('Found notification config %s' . PHP_EOL, $element->getName());
3337
}
3438

securitycenter/src/update_notification.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function update_notification(
4040
// Ensure this ServiceAccount has the 'pubsub.topics.setIamPolicy' permission on the topic.
4141
// https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy
4242
$pubsubTopic = $securityCenterClient::topicName($projectId, $topicName);
43+
// You can also use 'projectId' or 'folderId' instead of the 'organizationId'.
4344
$notificationConfigName = $securityCenterClient::notificationConfigName($organizationId, $notificationConfigId);
4445

4546
$streamingConfig = (new StreamingConfig())->setFilter('state = "ACTIVE"');

0 commit comments

Comments
 (0)