Skip to content
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
4 changes: 3 additions & 1 deletion StorageControl/metadata/V2/StorageControl.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright 2026 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 storage_v2_generated_StorageControl_GetIntelligenceFinding_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\GetIntelligenceFindingRequest;
use Google\Cloud\Storage\Control\V2\IntelligenceFinding;

/**
* Gets the `IntelligenceFinding` for a project.
*
* @param string $formattedName The name of the `IntelligenceFinding` resource.
*
* Format:
* `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}`
* Please see {@see StorageControlClient::intelligenceFindingName()} for help formatting this field.
*/
function get_intelligence_finding_sample(string $formattedName): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

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

// Call the API and handle any network failures.
try {
/** @var IntelligenceFinding $response */
$response = $storageControlClient->getIntelligenceFinding($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 = StorageControlClient::intelligenceFindingName(
'[PROJECT]',
'[LOCATION]',
'[INTELLIGENCE_FINDING]'
);

get_intelligence_finding_sample($formattedName);
}
// [END storage_v2_generated_StorageControl_GetIntelligenceFinding_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/*
* Copyright 2026 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 storage_v2_generated_StorageControl_GetIntelligenceFindingRevision_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\GetIntelligenceFindingRevisionRequest;
use Google\Cloud\Storage\Control\V2\IntelligenceFindingRevision;

/**
* Gets the `IntelligenceFindingRevision` resource.
*
* @param string $formattedName The name of the `IntelligenceFindingRevision` resource.
* ## Format:
*
* `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}/revisions/{revision}`
* Please see {@see StorageControlClient::intelligenceFindingRevisionName()} for help formatting this field.
*/
function get_intelligence_finding_revision_sample(string $formattedName): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

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

// Call the API and handle any network failures.
try {
/** @var IntelligenceFindingRevision $response */
$response = $storageControlClient->getIntelligenceFindingRevision($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 = StorageControlClient::intelligenceFindingRevisionName(
'[PROJECT]',
'[LOCATION]',
'[INTELLIGENCE_FINDING]',
'[REVISION]'
);

get_intelligence_finding_revision_sample($formattedName);
}
// [END storage_v2_generated_StorageControl_GetIntelligenceFindingRevision_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/*
* Copyright 2026 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 storage_v2_generated_StorageControl_ListIntelligenceFindingRevisions_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\IntelligenceFindingRevision;
use Google\Cloud\Storage\Control\V2\ListIntelligenceFindingRevisionsRequest;

/**
* Lists all the revisions of an `IntelligenceFinding` resource.
*
* @param string $formattedParent The parent of the `IntelligenceFindingRevision` resource.
* ## Format:
*
* `projects/{project}/locations/{location}/intelligenceFindings/{intelligence_finding}`
* Please see {@see StorageControlClient::intelligenceFindingName()} for help formatting this field.
*/
function list_intelligence_finding_revisions_sample(string $formattedParent): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

// Prepare the request message.
$request = (new ListIntelligenceFindingRevisionsRequest())
->setParent($formattedParent);

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $storageControlClient->listIntelligenceFindingRevisions($request);

/** @var IntelligenceFindingRevision $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = StorageControlClient::intelligenceFindingName(
'[PROJECT]',
'[LOCATION]',
'[INTELLIGENCE_FINDING]'
);

list_intelligence_finding_revisions_sample($formattedParent);
}
// [END storage_v2_generated_StorageControl_ListIntelligenceFindingRevisions_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright 2026 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 storage_v2_generated_StorageControl_ListIntelligenceFindings_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\IntelligenceFinding;
use Google\Cloud\Storage\Control\V2\ListIntelligenceFindingsRequest;

/**
* Lists the `IntelligenceFinding` resources for the specified project.
*
* @param string $formattedParent The parent of the `IntelligenceFinding` resource.
*
* Format: `projects/{project}/locations/{location}`
* Please see {@see StorageControlClient::locationName()} for help formatting this field.
*/
function list_intelligence_findings_sample(string $formattedParent): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

// Prepare the request message.
$request = (new ListIntelligenceFindingsRequest())
->setParent($formattedParent);

// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $storageControlClient->listIntelligenceFindings($request);

/** @var IntelligenceFinding $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = StorageControlClient::locationName('[PROJECT]', '[LOCATION]');

list_intelligence_findings_sample($formattedParent);
}
// [END storage_v2_generated_StorageControl_ListIntelligenceFindings_sync]
Loading
Loading