Skip to content

Commit 87293f8

Browse files
fix!: [Run] An existing resource_definition cloudbuild.googleapis.com/WorkerPool is removed (#8499)
* fix!: An existing resource_definition `cloudbuild.googleapis.com/WorkerPool` is removed fix!: A type of an existing resource_reference option of the field `worker_pool` in message `.google.cloud.run.v2.SubmitBuildRequest` is changed from `cloudbuild.googleapis.com/WorkerPool` to `cloudbuild.googleapis.com/BuildWorkerPool` fix!: A type of an existing resource_reference option of the field `worker_pool` in message `.google.cloud.run.v2.BuildConfig` is changed from `cloudbuild.googleapis.com/WorkerPool` to `cloudbuild.googleapis.com/BuildWorkerPool` feat: Adding new resource tpye run.googleapis.com/WorkerPool. PiperOrigin-RevId: 792236244 Source-Link: googleapis/googleapis@0998e04 Source-Link: googleapis/googleapis-gen@dd4d74c Copy-Tag: eyJwIjoiUnVuLy5Pd2xCb3QueWFtbCIsImgiOiJkZDRkNzRjZWM4ZGUyZGZmNjYxZjA0OGRkYzgzNzgyYmJkYjZjMGRjIn0= * 🦉 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 7422c50 commit 87293f8

37 files changed

+6565
-28
lines changed

Run/metadata/V2/Build.php

10 Bytes
Binary file not shown.

Run/metadata/V2/InstanceSplit.php

1.21 KB
Binary file not shown.

Run/metadata/V2/Revision.php

191 Bytes
Binary file not shown.

Run/metadata/V2/VendorSettings.php

94 Bytes
Binary file not shown.

Run/metadata/V2/WorkerPool.php

Lines changed: 137 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Run/metadata/V2/WorkerPoolRevisionTemplate.php

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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 run_v2_generated_WorkerPools_CreateWorkerPool_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Run\V2\Client\WorkerPoolsClient;
29+
use Google\Cloud\Run\V2\CreateWorkerPoolRequest;
30+
use Google\Cloud\Run\V2\WorkerPool;
31+
use Google\Cloud\Run\V2\WorkerPoolRevisionTemplate;
32+
use Google\Rpc\Status;
33+
34+
/**
35+
* Creates a new WorkerPool in a given project and location.
36+
*
37+
* @param string $formattedParent The location and project in which this worker pool should be
38+
* created. Format: `projects/{project}/locations/{location}`, where
39+
* `{project}` can be project id or number. Only lowercase characters, digits,
40+
* and hyphens. Please see
41+
* {@see WorkerPoolsClient::locationName()} for help formatting this field.
42+
* @param string $workerPoolId The unique identifier for the WorkerPool. It must begin with
43+
* letter, and cannot end with hyphen; must contain fewer than 50 characters.
44+
* The name of the worker pool becomes
45+
* `{parent}/workerPools/{worker_pool_id}`.
46+
*/
47+
function create_worker_pool_sample(string $formattedParent, string $workerPoolId): void
48+
{
49+
// Create a client.
50+
$workerPoolsClient = new WorkerPoolsClient();
51+
52+
// Prepare the request message.
53+
$workerPoolTemplate = new WorkerPoolRevisionTemplate();
54+
$workerPool = (new WorkerPool())
55+
->setTemplate($workerPoolTemplate);
56+
$request = (new CreateWorkerPoolRequest())
57+
->setParent($formattedParent)
58+
->setWorkerPool($workerPool)
59+
->setWorkerPoolId($workerPoolId);
60+
61+
// Call the API and handle any network failures.
62+
try {
63+
/** @var OperationResponse $response */
64+
$response = $workerPoolsClient->createWorkerPool($request);
65+
$response->pollUntilComplete();
66+
67+
if ($response->operationSucceeded()) {
68+
/** @var WorkerPool $result */
69+
$result = $response->getResult();
70+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
71+
} else {
72+
/** @var Status $error */
73+
$error = $response->getError();
74+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
75+
}
76+
} catch (ApiException $ex) {
77+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
78+
}
79+
}
80+
81+
/**
82+
* Helper to execute the sample.
83+
*
84+
* This sample has been automatically generated and should be regarded as a code
85+
* template only. It will require modifications to work:
86+
* - It may require correct/in-range values for request initialization.
87+
* - It may require specifying regional endpoints when creating the service client,
88+
* please see the apiEndpoint client configuration option for more details.
89+
*/
90+
function callSample(): void
91+
{
92+
$formattedParent = WorkerPoolsClient::locationName('[PROJECT]', '[LOCATION]');
93+
$workerPoolId = '[WORKER_POOL_ID]';
94+
95+
create_worker_pool_sample($formattedParent, $workerPoolId);
96+
}
97+
// [END run_v2_generated_WorkerPools_CreateWorkerPool_sync]
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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 run_v2_generated_WorkerPools_DeleteWorkerPool_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Run\V2\Client\WorkerPoolsClient;
29+
use Google\Cloud\Run\V2\DeleteWorkerPoolRequest;
30+
use Google\Cloud\Run\V2\WorkerPool;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Deletes a WorkerPool.
35+
*
36+
* @param string $formattedName The full name of the WorkerPool.
37+
* Format:
38+
* `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
39+
* `{project}` can be project id or number. Please see
40+
* {@see WorkerPoolsClient::workerPoolName()} for help formatting this field.
41+
*/
42+
function delete_worker_pool_sample(string $formattedName): void
43+
{
44+
// Create a client.
45+
$workerPoolsClient = new WorkerPoolsClient();
46+
47+
// Prepare the request message.
48+
$request = (new DeleteWorkerPoolRequest())
49+
->setName($formattedName);
50+
51+
// Call the API and handle any network failures.
52+
try {
53+
/** @var OperationResponse $response */
54+
$response = $workerPoolsClient->deleteWorkerPool($request);
55+
$response->pollUntilComplete();
56+
57+
if ($response->operationSucceeded()) {
58+
/** @var WorkerPool $result */
59+
$result = $response->getResult();
60+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
61+
} else {
62+
/** @var Status $error */
63+
$error = $response->getError();
64+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
65+
}
66+
} catch (ApiException $ex) {
67+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
68+
}
69+
}
70+
71+
/**
72+
* Helper to execute the sample.
73+
*
74+
* This sample has been automatically generated and should be regarded as a code
75+
* template only. It will require modifications to work:
76+
* - It may require correct/in-range values for request initialization.
77+
* - It may require specifying regional endpoints when creating the service client,
78+
* please see the apiEndpoint client configuration option for more details.
79+
*/
80+
function callSample(): void
81+
{
82+
$formattedName = WorkerPoolsClient::workerPoolName('[PROJECT]', '[LOCATION]', '[WORKER_POOL]');
83+
84+
delete_worker_pool_sample($formattedName);
85+
}
86+
// [END run_v2_generated_WorkerPools_DeleteWorkerPool_sync]

0 commit comments

Comments
 (0)