Skip to content
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: [SecurityCenterManagement] Adding support for new Security Center Management Apis #7331

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
* default.
*
* @param string $formattedParent Name of parent for the module. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* `organizations/{organization}/locations/{location}`,
* `folders/{folder}/locations/{location}`,
* or
* "projects/{project}/locations/{location}"
* `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function create_event_threat_detection_custom_module_sample(string $formattedParent): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
* SecurityHealthAnalyticsCustomModules for all CRM descendants of the given
* parent. These modules are enabled by default.
*
* @param string $formattedParent Name of the parent for the module. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* or
* "projects/{project}/locations/{location}"
* @param string $formattedParent Name of the parent organization, folder, or project of the
* module, specified in one of the following formats:
*
* * `organizations/{organization}/locations/{location}`
* * `folders/{folder}/locations/{location}`
* * `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function create_security_health_analytics_custom_module_sample(string $formattedParent): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
*
* Its format is:
*
* * "organizations/{organization}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}".
* * "folders/{folder}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}".
* * "projects/{project}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}". Please see
* * `organizations/{organization}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`.
* * `folders/{folder}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`.
* * `projects/{project}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`. Please see
* {@see SecurityCenterManagementClient::eventThreatDetectionCustomModuleName()} for help formatting this field.
*/
function delete_event_threat_detection_custom_module_sample(string $formattedName): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
*
* Its format is:
*
* * "organizations/{organization}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}".
* * "folders/{folder}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}".
* * "projects/{project}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}". Please see
* * `organizations/{organization}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}`.
* * `folders/{folder}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}`.
* * `projects/{project}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}`. Please see
* {@see SecurityCenterManagementClient::securityHealthAnalyticsCustomModuleName()} for help formatting this field.
*/
function delete_security_health_analytics_custom_module_sample(string $formattedName): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
*
* Its format is:
*
* * "organizations/{organization}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}".
* * "folders/{folder}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}".
* * "projects/{project}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}". Please see
* * `organizations/{organization}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}`.
* * `folders/{folder}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}`.
* * `projects/{project}/locations/{location}/effectiveEventThreatDetectionCustomModules/{effective_event_threat_detection_custom_module}`. Please see
* {@see SecurityCenterManagementClient::effectiveEventThreatDetectionCustomModuleName()} for help formatting this field.
*/
function get_effective_event_threat_detection_custom_module_sample(string $formattedName): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
/**
* Gets details of a single EffectiveSecurityHealthAnalyticsCustomModule.
*
* @param string $formattedName The resource name of the SHA custom module.
* @param string $formattedName The full resource name of the custom module, specified in one of
* the following formats:
*
* Its format is:
*
* * "organizations/{organization}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}".
* * "folders/{folder}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}".
* * "projects/{project}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}". Please see
* {@see SecurityCenterManagementClient::effectiveSecurityHealthAnalyticsCustomModuleName()} for help formatting this field.
* * `organizations/organization/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}`
* * `folders/folder/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}`
* * `projects/project/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}`
* Please see {@see SecurityCenterManagementClient::effectiveSecurityHealthAnalyticsCustomModuleName()} for help formatting this field.
*/
function get_effective_security_health_analytics_custom_module_sample(string $formattedName): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
*
* Its format is:
*
* * "organizations/{organization}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}".
* * "folders/{folder}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}".
* * "projects/{project}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}". Please see
* * `organizations/{organization}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`.
* * `folders/{folder}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`.
* * `projects/{project}/locations/{location}/eventThreatDetectionCustomModules/{event_threat_detection_custom_module}`. Please see
* {@see SecurityCenterManagementClient::eventThreatDetectionCustomModuleName()} for help formatting this field.
*/
function get_event_threat_detection_custom_module_sample(string $formattedName): void
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START securitycentermanagement_v1_generated_SecurityCenterManagement_GetSecurityCenterService_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\SecurityCenterManagement\V1\Client\SecurityCenterManagementClient;
use Google\Cloud\SecurityCenterManagement\V1\GetSecurityCenterServiceRequest;
use Google\Cloud\SecurityCenterManagement\V1\SecurityCenterService;

/**
* Gets service settings for the specified Security Command Center service.
*
* @param string $formattedName The Security Command Center service to retrieve.
*
* Formats:
*
* * organizations/{organization}/locations/{location}/securityCenterServices/{service}
* * folders/{folder}/locations/{location}/securityCenterServices/{service}
* * projects/{project}/locations/{location}/securityCenterServices/{service}
*
* The possible values for id {service} are:
*
* * container-threat-detection
* * event-threat-detection
* * security-health-analytics
* * vm-threat-detection
* * web-security-scanner
* Please see {@see SecurityCenterManagementClient::securityCenterServiceName()} for help formatting this field.
*/
function get_security_center_service_sample(string $formattedName): void
{
// Create a client.
$securityCenterManagementClient = new SecurityCenterManagementClient();

// Prepare the request message.
$request = (new GetSecurityCenterServiceRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
/** @var SecurityCenterService $response */
$response = $securityCenterManagementClient->getSecurityCenterService($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = SecurityCenterManagementClient::securityCenterServiceName(
'[PROJECT]',
'[LOCATION]',
'[SERVICE]'
);

get_security_center_service_sample($formattedName);
}
// [END securitycentermanagement_v1_generated_SecurityCenterManagement_GetSecurityCenterService_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
* given Resource Manager parent and its descendants.
*
* @param string $formattedParent Name of parent to list custom modules. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* `organizations/{organization}/locations/{location}`,
* `folders/{folder}/locations/{location}`,
* or
* "projects/{project}/locations/{location}"
* `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function list_descendant_event_threat_detection_custom_modules_sample(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
* Returns a list of all resident SecurityHealthAnalyticsCustomModules under
* the given CRM parent and all of the parent's CRM descendants.
*
* @param string $formattedParent Name of parent to list custom modules. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* or
* "projects/{project}/locations/{location}"
* @param string $formattedParent Name of the parent organization, folder, or project in which to
* list custom modules, specified in one of the following formats:
*
* * `organizations/{organization}/locations/{location}`
* * `folders/{folder}/locations/{location}`
* * `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function list_descendant_security_health_analytics_custom_modules_sample(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
* parent along with modules inherited from its ancestors.
*
* @param string $formattedParent Name of parent to list effective custom modules. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* `organizations/{organization}/locations/{location}`,
* `folders/{folder}/locations/{location}`,
* or
* "projects/{project}/locations/{location}"
* `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function list_effective_event_threat_detection_custom_modules_sample(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
* parent, and inherited modules, inherited from CRM ancestors (no
* descendants).
*
* @param string $formattedParent Name of parent to list effective custom modules. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* @param string $formattedParent Name of parent to list effective custom modules. specified in one
* of the following formats:
* * `organizations/{organization}/locations/{location}`
* * `folders/{folder}/locations/{location}`
* or
* "projects/{project}/locations/{location}"
* `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function list_effective_security_health_analytics_custom_modules_sample(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
* scope of the parent along with modules inherited from ancestors.
*
* @param string $formattedParent Name of parent to list custom modules. Its format is
* "organizations/{organization}/locations/{location}",
* "folders/{folder}/locations/{location}",
* `organizations/{organization}/locations/{location}`,
* `folders/{folder}/locations/{location}`,
* or
* "projects/{project}/locations/{location}"
* `projects/{project}/locations/{location}`
* Please see {@see SecurityCenterManagementClient::organizationLocationName()} for help formatting this field.
*/
function list_event_threat_detection_custom_modules_sample(string $formattedParent): void
Expand Down
Loading
Loading