Skip to content

Commit 29ce3a2

Browse files
feat: [SecurityCompliance] Updated docs for the APIs (#8706)
* docs: Updated docs for the APIs feat: Adding client libraries for Monitoring API Compliance Manager Service PiperOrigin-RevId: 825918020 Source-Link: googleapis/googleapis@86356cc Source-Link: googleapis/googleapis-gen@add75b6 Copy-Tag: eyJwIjoiU2VjdXJpdHlDb21wbGlhbmNlLy5Pd2xCb3QueWFtbCIsImgiOiJhZGQ3NWI2Y2RiNjlhN2I2N2ZmZjljMGZlNTYwZjlmOWE5ZTQyODMwIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent cfeac0b commit 29ce3a2

36 files changed

Lines changed: 6703 additions & 0 deletions
11.7 KB
Binary file not shown.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudsecuritycompliance_v1_generated_Monitoring_AggregateFrameworkComplianceReport_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\CloudSecurityCompliance\V1\AggregateFrameworkComplianceReportRequest;
28+
use Google\Cloud\CloudSecurityCompliance\V1\AggregateFrameworkComplianceReportResponse;
29+
use Google\Cloud\CloudSecurityCompliance\V1\Client\MonitoringClient;
30+
31+
/**
32+
* Gets the aggregated compliance report over time for a given scope.
33+
*
34+
* @param string $formattedName The name of the aggregated compliance report over time to
35+
* retrieve.
36+
*
37+
* The supported format is:
38+
* `organizations/{organization_id}/locations/{location}/frameworkComplianceReports/{framework_compliance_report}`
39+
* Please see {@see MonitoringClient::frameworkComplianceReportName()} for help formatting this field.
40+
*/
41+
function aggregate_framework_compliance_report_sample(string $formattedName): void
42+
{
43+
// Create a client.
44+
$monitoringClient = new MonitoringClient();
45+
46+
// Prepare the request message.
47+
$request = (new AggregateFrameworkComplianceReportRequest())
48+
->setName($formattedName);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var AggregateFrameworkComplianceReportResponse $response */
53+
$response = $monitoringClient->aggregateFrameworkComplianceReport($request);
54+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
55+
} catch (ApiException $ex) {
56+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
57+
}
58+
}
59+
60+
/**
61+
* Helper to execute the sample.
62+
*
63+
* This sample has been automatically generated and should be regarded as a code
64+
* template only. It will require modifications to work:
65+
* - It may require correct/in-range values for request initialization.
66+
* - It may require specifying regional endpoints when creating the service client,
67+
* please see the apiEndpoint client configuration option for more details.
68+
*/
69+
function callSample(): void
70+
{
71+
$formattedName = MonitoringClient::frameworkComplianceReportName(
72+
'[PROJECT]',
73+
'[LOCATION]',
74+
'[FRAMEWORK_COMPLIANCE_REPORT]'
75+
);
76+
77+
aggregate_framework_compliance_report_sample($formattedName);
78+
}
79+
// [END cloudsecuritycompliance_v1_generated_Monitoring_AggregateFrameworkComplianceReport_sync]
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudsecuritycompliance_v1_generated_Monitoring_FetchFrameworkComplianceReport_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\CloudSecurityCompliance\V1\Client\MonitoringClient;
28+
use Google\Cloud\CloudSecurityCompliance\V1\FetchFrameworkComplianceReportRequest;
29+
use Google\Cloud\CloudSecurityCompliance\V1\FrameworkComplianceReport;
30+
31+
/**
32+
* Fetches the framework compliance report for a given scope.
33+
*
34+
* @param string $formattedName The name of the framework compliance report to retrieve. Please see
35+
* {@see MonitoringClient::frameworkComplianceReportName()} for help formatting this field.
36+
*/
37+
function fetch_framework_compliance_report_sample(string $formattedName): void
38+
{
39+
// Create a client.
40+
$monitoringClient = new MonitoringClient();
41+
42+
// Prepare the request message.
43+
$request = (new FetchFrameworkComplianceReportRequest())
44+
->setName($formattedName);
45+
46+
// Call the API and handle any network failures.
47+
try {
48+
/** @var FrameworkComplianceReport $response */
49+
$response = $monitoringClient->fetchFrameworkComplianceReport($request);
50+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
53+
}
54+
}
55+
56+
/**
57+
* Helper to execute the sample.
58+
*
59+
* This sample has been automatically generated and should be regarded as a code
60+
* template only. It will require modifications to work:
61+
* - It may require correct/in-range values for request initialization.
62+
* - It may require specifying regional endpoints when creating the service client,
63+
* please see the apiEndpoint client configuration option for more details.
64+
*/
65+
function callSample(): void
66+
{
67+
$formattedName = MonitoringClient::frameworkComplianceReportName(
68+
'[PROJECT]',
69+
'[LOCATION]',
70+
'[FRAMEWORK_COMPLIANCE_REPORT]'
71+
);
72+
73+
fetch_framework_compliance_report_sample($formattedName);
74+
}
75+
// [END cloudsecuritycompliance_v1_generated_Monitoring_FetchFrameworkComplianceReport_sync]
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudsecuritycompliance_v1_generated_Monitoring_GetLocation_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\CloudSecurityCompliance\V1\Client\MonitoringClient;
28+
use Google\Cloud\Location\GetLocationRequest;
29+
use Google\Cloud\Location\Location;
30+
31+
/**
32+
* Gets information about a location.
33+
*
34+
* This sample has been automatically generated and should be regarded as a code
35+
* template only. It will require modifications to work:
36+
* - It may require correct/in-range values for request initialization.
37+
* - It may require specifying regional endpoints when creating the service client,
38+
* please see the apiEndpoint client configuration option for more details.
39+
*/
40+
function get_location_sample(): void
41+
{
42+
// Create a client.
43+
$monitoringClient = new MonitoringClient();
44+
45+
// Prepare the request message.
46+
$request = new GetLocationRequest();
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var Location $response */
51+
$response = $monitoringClient->getLocation($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
// [END cloudsecuritycompliance_v1_generated_Monitoring_GetLocation_sync]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudsecuritycompliance_v1_generated_Monitoring_ListControlComplianceSummaries_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\CloudSecurityCompliance\V1\Client\MonitoringClient;
29+
use Google\Cloud\CloudSecurityCompliance\V1\ControlComplianceSummary;
30+
use Google\Cloud\CloudSecurityCompliance\V1\ListControlComplianceSummariesRequest;
31+
32+
/**
33+
* Lists the control compliance summary for a given scope.
34+
*
35+
* @param string $formattedParent The parent scope for the framework overview page. Please see
36+
* {@see MonitoringClient::frameworkComplianceReportName()} for help formatting this field.
37+
*/
38+
function list_control_compliance_summaries_sample(string $formattedParent): void
39+
{
40+
// Create a client.
41+
$monitoringClient = new MonitoringClient();
42+
43+
// Prepare the request message.
44+
$request = (new ListControlComplianceSummariesRequest())
45+
->setParent($formattedParent);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var PagedListResponse $response */
50+
$response = $monitoringClient->listControlComplianceSummaries($request);
51+
52+
/** @var ControlComplianceSummary $element */
53+
foreach ($response as $element) {
54+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
55+
}
56+
} catch (ApiException $ex) {
57+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
58+
}
59+
}
60+
61+
/**
62+
* Helper to execute the sample.
63+
*
64+
* This sample has been automatically generated and should be regarded as a code
65+
* template only. It will require modifications to work:
66+
* - It may require correct/in-range values for request initialization.
67+
* - It may require specifying regional endpoints when creating the service client,
68+
* please see the apiEndpoint client configuration option for more details.
69+
*/
70+
function callSample(): void
71+
{
72+
$formattedParent = MonitoringClient::frameworkComplianceReportName(
73+
'[PROJECT]',
74+
'[LOCATION]',
75+
'[FRAMEWORK_COMPLIANCE_REPORT]'
76+
);
77+
78+
list_control_compliance_summaries_sample($formattedParent);
79+
}
80+
// [END cloudsecuritycompliance_v1_generated_Monitoring_ListControlComplianceSummaries_sync]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudsecuritycompliance_v1_generated_Monitoring_ListFindingSummaries_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\CloudSecurityCompliance\V1\Client\MonitoringClient;
29+
use Google\Cloud\CloudSecurityCompliance\V1\FindingSummary;
30+
use Google\Cloud\CloudSecurityCompliance\V1\ListFindingSummariesRequest;
31+
32+
/**
33+
* Lists the finding summary by category for a given scope.
34+
*
35+
* @param string $formattedParent The parent scope for the framework overview page. Please see
36+
* {@see MonitoringClient::organizationLocationName()} for help formatting this field.
37+
*/
38+
function list_finding_summaries_sample(string $formattedParent): void
39+
{
40+
// Create a client.
41+
$monitoringClient = new MonitoringClient();
42+
43+
// Prepare the request message.
44+
$request = (new ListFindingSummariesRequest())
45+
->setParent($formattedParent);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var PagedListResponse $response */
50+
$response = $monitoringClient->listFindingSummaries($request);
51+
52+
/** @var FindingSummary $element */
53+
foreach ($response as $element) {
54+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
55+
}
56+
} catch (ApiException $ex) {
57+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
58+
}
59+
}
60+
61+
/**
62+
* Helper to execute the sample.
63+
*
64+
* This sample has been automatically generated and should be regarded as a code
65+
* template only. It will require modifications to work:
66+
* - It may require correct/in-range values for request initialization.
67+
* - It may require specifying regional endpoints when creating the service client,
68+
* please see the apiEndpoint client configuration option for more details.
69+
*/
70+
function callSample(): void
71+
{
72+
$formattedParent = MonitoringClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');
73+
74+
list_finding_summaries_sample($formattedParent);
75+
}
76+
// [END cloudsecuritycompliance_v1_generated_Monitoring_ListFindingSummaries_sync]

0 commit comments

Comments
 (0)