-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
7,424 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
deep-copy-regex: | ||
- source: /google/cloud/parallelstore/(v1beta)/.*-php/(.*) | ||
- source: /google/cloud/parallelstore/(v1|v1beta)/.*-php/(.*) | ||
dest: /owl-bot-staging/Parallelstore/$1/$2 | ||
api-name: Parallelstore |
Binary file not shown.
104 changes: 104 additions & 0 deletions
104
Parallelstore/samples/V1/ParallelstoreClient/create_instance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?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 parallelstore_v1_generated_Parallelstore_CreateInstance_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Parallelstore\V1\Client\ParallelstoreClient; | ||
use Google\Cloud\Parallelstore\V1\CreateInstanceRequest; | ||
use Google\Cloud\Parallelstore\V1\Instance; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Creates a Parallelstore instance in a given project and location. | ||
* | ||
* @param string $formattedParent The instance's project and location, in the format | ||
* `projects/{project}/locations/{location}`. | ||
* Locations map to Google Cloud zones; for example, `us-west1-b`. Please see | ||
* {@see ParallelstoreClient::locationName()} for help formatting this field. | ||
* @param string $instanceId The name of the Parallelstore instance. | ||
* | ||
* * Must contain only lowercase letters, numbers, and hyphens. | ||
* * Must start with a letter. | ||
* * Must be between 1-63 characters. | ||
* * Must end with a number or a letter. | ||
* * Must be unique within the customer project / location | ||
* @param int $instanceCapacityGib Immutable. The instance's storage capacity in Gibibytes (GiB). | ||
* Allowed values are between 12000 and 100000, in multiples of 4000; e.g., | ||
* 12000, 16000, 20000, ... | ||
*/ | ||
function create_instance_sample( | ||
string $formattedParent, | ||
string $instanceId, | ||
int $instanceCapacityGib | ||
): void { | ||
// Create a client. | ||
$parallelstoreClient = new ParallelstoreClient(); | ||
|
||
// Prepare the request message. | ||
$instance = (new Instance()) | ||
->setCapacityGib($instanceCapacityGib); | ||
$request = (new CreateInstanceRequest()) | ||
->setParent($formattedParent) | ||
->setInstanceId($instanceId) | ||
->setInstance($instance); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $parallelstoreClient->createInstance($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var Instance $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 = ParallelstoreClient::locationName('[PROJECT]', '[LOCATION]'); | ||
$instanceId = '[INSTANCE_ID]'; | ||
$instanceCapacityGib = 0; | ||
|
||
create_instance_sample($formattedParent, $instanceId, $instanceCapacityGib); | ||
} | ||
// [END parallelstore_v1_generated_Parallelstore_CreateInstance_sync] |
80 changes: 80 additions & 0 deletions
80
Parallelstore/samples/V1/ParallelstoreClient/delete_instance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?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 parallelstore_v1_generated_Parallelstore_DeleteInstance_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Parallelstore\V1\Client\ParallelstoreClient; | ||
use Google\Cloud\Parallelstore\V1\DeleteInstanceRequest; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Deletes a single instance. | ||
* | ||
* @param string $formattedName Name of the resource | ||
* Please see {@see ParallelstoreClient::instanceName()} for help formatting this field. | ||
*/ | ||
function delete_instance_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$parallelstoreClient = new ParallelstoreClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteInstanceRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $parallelstoreClient->deleteInstance($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
printf('Operation completed successfully.' . PHP_EOL); | ||
} 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 | ||
{ | ||
$formattedName = ParallelstoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); | ||
|
||
delete_instance_sample($formattedName); | ||
} | ||
// [END parallelstore_v1_generated_Parallelstore_DeleteInstance_sync] |
83 changes: 83 additions & 0 deletions
83
Parallelstore/samples/V1/ParallelstoreClient/export_data.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?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 parallelstore_v1_generated_Parallelstore_ExportData_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Parallelstore\V1\Client\ParallelstoreClient; | ||
use Google\Cloud\Parallelstore\V1\ExportDataRequest; | ||
use Google\Cloud\Parallelstore\V1\ExportDataResponse; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Copies data from Parallelstore to Cloud Storage. | ||
* | ||
* @param string $formattedName Name of the resource. Please see | ||
* {@see ParallelstoreClient::instanceName()} for help formatting this field. | ||
*/ | ||
function export_data_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$parallelstoreClient = new ParallelstoreClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ExportDataRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $parallelstoreClient->exportData($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var ExportDataResponse $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 | ||
{ | ||
$formattedName = ParallelstoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); | ||
|
||
export_data_sample($formattedName); | ||
} | ||
// [END parallelstore_v1_generated_Parallelstore_ExportData_sync] |
72 changes: 72 additions & 0 deletions
72
Parallelstore/samples/V1/ParallelstoreClient/get_instance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?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 parallelstore_v1_generated_Parallelstore_GetInstance_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Parallelstore\V1\Client\ParallelstoreClient; | ||
use Google\Cloud\Parallelstore\V1\GetInstanceRequest; | ||
use Google\Cloud\Parallelstore\V1\Instance; | ||
|
||
/** | ||
* Gets details of a single instance. | ||
* | ||
* @param string $formattedName The instance resource name, in the format | ||
* `projects/{project_id}/locations/{location}/instances/{instance_id}`. Please see | ||
* {@see ParallelstoreClient::instanceName()} for help formatting this field. | ||
*/ | ||
function get_instance_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$parallelstoreClient = new ParallelstoreClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetInstanceRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Instance $response */ | ||
$response = $parallelstoreClient->getInstance($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 = ParallelstoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); | ||
|
||
get_instance_sample($formattedName); | ||
} | ||
// [END parallelstore_v1_generated_Parallelstore_GetInstance_sync] |
Oops, something went wrong.