Skip to content
Open
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
2 changes: 1 addition & 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,86 @@
<?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_CreateRapidCache_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\CreateRapidCacheRequest;
use Google\Cloud\Storage\Control\V2\RapidCache;
use Google\Rpc\Status;

/**
* Creates a Rapid Cache instance.
*
* @param string $formattedParent The bucket to which this cache belongs.
* Format: `projects/{project}/buckets/{bucket}`
* Please see {@see StorageControlClient::bucketName()} for help formatting this field.
*/
function create_rapid_cache_sample(string $formattedParent): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

// Prepare the request message.
$rapidCache = new RapidCache();
$request = (new CreateRapidCacheRequest())
->setParent($formattedParent)
->setRapidCache($rapidCache);

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

if ($response->operationSucceeded()) {
/** @var RapidCache $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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::bucketName('[PROJECT]', '[BUCKET]');

create_rapid_cache_sample($formattedParent);
}
// [END storage_v2_generated_StorageControl_CreateRapidCache_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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_GetRapidCache_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\GetRapidCacheRequest;
use Google\Cloud\Storage\Control\V2\RapidCache;

/**
* Gets a Rapid Cache instance.
*
* @param string $formattedName The name field in the request should be:
* `projects/{project}/buckets/{bucket}/rapidCaches/{rapid_cache}`
* Please see {@see StorageControlClient::rapidCacheName()} for help formatting this field.
*/
function get_rapid_cache_sample(string $formattedName): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

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

// Call the API and handle any network failures.
try {
/** @var RapidCache $response */
$response = $storageControlClient->getRapidCache($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::rapidCacheName('[PROJECT]', '[BUCKET]', '[RAPID_CACHE]');

get_rapid_cache_sample($formattedName);
}
// [END storage_v2_generated_StorageControl_GetRapidCache_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Google\Cloud\Storage\Control\V2\ListIntelligenceFindingsRequest;

/**
* Lists the `IntelligenceFinding` resources for the specified project.
* Lists the `IntelligenceFinding` resources for the specified the project.
*
* @param string $formattedParent The parent of the `IntelligenceFinding` resource.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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_ListRapidCaches_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\ListRapidCachesRequest;
use Google\Cloud\Storage\Control\V2\RapidCache;

/**
* Lists Rapid Cache instances for a given bucket.
*
* @param string $formattedParent The bucket to which this cache belongs. Please see
* {@see StorageControlClient::bucketName()} for help formatting this field.
*/
function list_rapid_caches_sample(string $formattedParent): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

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

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

/** @var RapidCache $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::bucketName('[PROJECT]', '[BUCKET]');

list_rapid_caches_sample($formattedParent);
}
// [END storage_v2_generated_StorageControl_ListRapidCaches_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
use Google\Cloud\Storage\Control\V2\SummarizeIntelligenceFindingsRequest;

/**
* Summarize the intelligence findings for the specified scope(org, folder or
* project).
* Summarizes the intelligence findings for the specified scope (organization,
* folder or project).
*
* @param string $parent The scope to summarize the findings for.
* Format:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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_UpdateManagedFolder_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\ManagedFolder;
use Google\Cloud\Storage\Control\V2\UpdateManagedFolderRequest;

/**
* Updates a managed folder. Currently, this RPC only supports updating the
* `rapid_cache_config` field.
*
* 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 update_managed_folder_sample(): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

// Prepare the request message.
$managedFolder = new ManagedFolder();
$request = (new UpdateManagedFolderRequest())
->setManagedFolder($managedFolder);

// Call the API and handle any network failures.
try {
/** @var ManagedFolder $response */
$response = $storageControlClient->updateManagedFolder($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END storage_v2_generated_StorageControl_UpdateManagedFolder_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?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_UpdateRapidCache_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Storage\Control\V2\Client\StorageControlClient;
use Google\Cloud\Storage\Control\V2\RapidCache;
use Google\Cloud\Storage\Control\V2\UpdateRapidCacheRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
* Updates a Rapid Cache instance.
*
* 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 update_rapid_cache_sample(): void
{
// Create a client.
$storageControlClient = new StorageControlClient();

// Prepare the request message.
$rapidCache = new RapidCache();
$updateMask = new FieldMask();
$request = (new UpdateRapidCacheRequest())
->setRapidCache($rapidCache)
->setUpdateMask($updateMask);

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

if ($response->operationSucceeded()) {
/** @var RapidCache $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END storage_v2_generated_StorageControl_UpdateRapidCache_sync]
Loading
Loading