Skip to content

Commit

Permalink
fix: remove BufferTask method which cannot be called from client libr…
Browse files Browse the repository at this point in the history
…aries (#6971)

* fix: remove BufferTask method which cannot be called from client libraries
PiperOrigin-RevId: 599211253
Source-Link: googleapis/googleapis@1654062
Source-Link: googleapis/googleapis-gen@2055a53
Copy-Tag: eyJwIjoiVGFza3MvLk93bEJvdC55YW1sIiwiaCI6IjIwNTVhNTMzYWYxNTRkY2MyNjNkNWMwYmNkNzhhZjg0YjQ0ZWYzMzIifQ==
  • Loading branch information
gcf-owl-bot[bot] authored Jan 18, 2024
1 parent b54653a commit 6ab845b
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 334 deletions.
Binary file modified Tasks/metadata/V2Beta2/Cloudtasks.php
Binary file not shown.
17 changes: 4 additions & 13 deletions Tasks/metadata/V2Beta3/Cloudtasks.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 0 additions & 73 deletions Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
use Google\Cloud\Location\ListLocationsResponse;
use Google\Cloud\Location\Location;
use Google\Cloud\Tasks\V2beta2\AcknowledgeTaskRequest;
use Google\Cloud\Tasks\V2beta2\BufferTaskRequest;
use Google\Cloud\Tasks\V2beta2\BufferTaskResponse;
use Google\Cloud\Tasks\V2beta2\CancelLeaseRequest;
use Google\Cloud\Tasks\V2beta2\CreateQueueRequest;
use Google\Cloud\Tasks\V2beta2\CreateTaskRequest;
Expand Down Expand Up @@ -456,77 +454,6 @@ public function acknowledgeTask($name, $scheduleTime, array $optionalArgs = [])
return $this->startCall('AcknowledgeTask', GPBEmpty::class, $optionalArgs, $request)->wait();
}

/**
* Creates and buffers a new task without the need to explicitly define a Task
* message. The queue must have [HTTP
* target][google.cloud.tasks.v2beta2.HttpTarget]. To create the task with a
* custom ID, use the following format and set TASK_ID to your desired ID:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
* To create the task with an automatically generated ID, use the following
* format:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
* Note: This feature is in its experimental stage. You must request access to
* the API through the [Cloud Tasks BufferTask Experiment Signup
* form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
*
* Sample code:
* ```
* $cloudTasksClient = new CloudTasksClient();
* try {
* $formattedQueue = $cloudTasksClient->queueName('[PROJECT]', '[LOCATION]', '[QUEUE]');
* $response = $cloudTasksClient->bufferTask($formattedQueue);
* } finally {
* $cloudTasksClient->close();
* }
* ```
*
* @param string $queue Required. The parent queue name. For example:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
*
* The queue must already exist.
* @param array $optionalArgs {
* Optional.
*
* @type string $taskId
* Optional. Task ID for the task being created. If not provided, a random
* task ID is assigned to the task.
* @type HttpBody $body
* Optional. Body of the HTTP request.
*
* The body can take any generic value. The value is written to the
* [HttpRequest][payload] of the [Task].
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
* {@see RetrySettings} for example usage.
* }
*
* @return \Google\Cloud\Tasks\V2beta2\BufferTaskResponse
*
* @throws ApiException if the remote call fails
*
* @experimental
*/
public function bufferTask($queue, array $optionalArgs = [])
{
$request = new BufferTaskRequest();
$requestParamHeaders = [];
$request->setQueue($queue);
$requestParamHeaders['queue'] = $queue;
if (isset($optionalArgs['taskId'])) {
$request->setTaskId($optionalArgs['taskId']);
$requestParamHeaders['task_id'] = $optionalArgs['taskId'];
}

if (isset($optionalArgs['body'])) {
$request->setBody($optionalArgs['body']);
}

$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('BufferTask', BufferTaskResponse::class, $optionalArgs, $request)->wait();
}

/**
* Cancel a pull task's lease.
*
Expand Down
5 changes: 0 additions & 5 deletions Tasks/src/V2beta2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
"acknowledgeTask"
]
},
"BufferTask": {
"methods": [
"bufferTask"
]
},
"CancelLease": {
"methods": [
"cancelLease"
Expand Down
5 changes: 0 additions & 5 deletions Tasks/src/V2beta2/resources/cloud_tasks_client_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
"BufferTask": {
"timeout_millis": 20000,
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
"CancelLease": {
"timeout_millis": 20000,
"retry_codes_name": "no_retry_1_codes",
Expand Down
17 changes: 0 additions & 17 deletions Tasks/src/V2beta2/resources/cloud_tasks_rest_client_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@
],
],
],
'BufferTask' => [
'method' => 'post',
'uriTemplate' => '/v2beta2/{queue=projects/*/locations/*/queues/*}/tasks/{task_id}:buffer',
'body' => '*',
'placeholders' => [
'queue' => [
'getters' => [
'getQueue',
],
],
'task_id' => [
'getters' => [
'getTaskId',
],
],
],
],
'CancelLease' => [
'method' => 'post',
'uriTemplate' => '/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}:cancelLease',
Expand Down
79 changes: 3 additions & 76 deletions Tasks/src/V2beta3/Gapic/CloudTasksGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
use Google\ApiCore\RetrySettings;
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Api\HttpBody;
use Google\Auth\FetchAuthTokenInterface;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\GetPolicyOptions;
Expand All @@ -47,8 +46,6 @@
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\ListLocationsResponse;
use Google\Cloud\Location\Location;
use Google\Cloud\Tasks\V2beta3\BufferTaskRequest;
use Google\Cloud\Tasks\V2beta3\BufferTaskResponse;
use Google\Cloud\Tasks\V2beta3\CreateQueueRequest;
use Google\Cloud\Tasks\V2beta3\CreateTaskRequest;
use Google\Cloud\Tasks\V2beta3\DeleteQueueRequest;
Expand Down Expand Up @@ -80,8 +77,9 @@
* ```
* $cloudTasksClient = new CloudTasksClient();
* try {
* $formattedQueue = $cloudTasksClient->queueName('[PROJECT]', '[LOCATION]', '[QUEUE]');
* $response = $cloudTasksClient->bufferTask($formattedQueue);
* $formattedParent = $cloudTasksClient->locationName('[PROJECT]', '[LOCATION]');
* $queue = new Queue();
* $response = $cloudTasksClient->createQueue($formattedParent, $queue);
* } finally {
* $cloudTasksClient->close();
* }
Expand Down Expand Up @@ -387,77 +385,6 @@ public function __construct(array $options = [])
$this->setClientOptions($clientOptions);
}

/**
* Creates and buffers a new task without the need to explicitly define a Task
* message. The queue must have [HTTP
* target][google.cloud.tasks.v2beta3.HttpTarget]. To create the task with a
* custom ID, use the following format and set TASK_ID to your desired ID:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
* To create the task with an automatically generated ID, use the following
* format:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
* Note: This feature is in its experimental stage. You must request access to
* the API through the [Cloud Tasks BufferTask Experiment Signup
* form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
*
* Sample code:
* ```
* $cloudTasksClient = new CloudTasksClient();
* try {
* $formattedQueue = $cloudTasksClient->queueName('[PROJECT]', '[LOCATION]', '[QUEUE]');
* $response = $cloudTasksClient->bufferTask($formattedQueue);
* } finally {
* $cloudTasksClient->close();
* }
* ```
*
* @param string $queue Required. The parent queue name. For example:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
*
* The queue must already exist.
* @param array $optionalArgs {
* Optional.
*
* @type string $taskId
* Optional. Task ID for the task being created. If not provided, a random
* task ID is assigned to the task.
* @type HttpBody $body
* Optional. Body of the HTTP request.
*
* The body can take any generic value. The value is written to the
* [HttpRequest][payload] of the [Task].
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
* {@see RetrySettings} for example usage.
* }
*
* @return \Google\Cloud\Tasks\V2beta3\BufferTaskResponse
*
* @throws ApiException if the remote call fails
*
* @experimental
*/
public function bufferTask($queue, array $optionalArgs = [])
{
$request = new BufferTaskRequest();
$requestParamHeaders = [];
$request->setQueue($queue);
$requestParamHeaders['queue'] = $queue;
if (isset($optionalArgs['taskId'])) {
$request->setTaskId($optionalArgs['taskId']);
$requestParamHeaders['task_id'] = $optionalArgs['taskId'];
}

if (isset($optionalArgs['body'])) {
$request->setBody($optionalArgs['body']);
}

$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('BufferTask', BufferTaskResponse::class, $optionalArgs, $request)->wait();
}

/**
* Creates a queue.
*
Expand Down
5 changes: 0 additions & 5 deletions Tasks/src/V2beta3/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
"grpc": {
"libraryClient": "CloudTasksGapicClient",
"rpcs": {
"BufferTask": {
"methods": [
"bufferTask"
]
},
"CreateQueue": {
"methods": [
"createQueue"
Expand Down
5 changes: 0 additions & 5 deletions Tasks/src/V2beta3/resources/cloud_tasks_client_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
}
},
"methods": {
"BufferTask": {
"timeout_millis": 20000,
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
"CreateQueue": {
"timeout_millis": 20000,
"retry_codes_name": "no_retry_1_codes",
Expand Down
17 changes: 0 additions & 17 deletions Tasks/src/V2beta3/resources/cloud_tasks_rest_client_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@
],
],
'google.cloud.tasks.v2beta3.CloudTasks' => [
'BufferTask' => [
'method' => 'post',
'uriTemplate' => '/v2beta3/{queue=projects/*/locations/*/queues/*}/tasks/{task_id}:buffer',
'body' => '*',
'placeholders' => [
'queue' => [
'getters' => [
'getQueue',
],
],
'task_id' => [
'getters' => [
'getTaskId',
],
],
],
],
'CreateQueue' => [
'method' => 'post',
'uriTemplate' => '/v2beta3/{parent=projects/*/locations/*}/queues',
Expand Down
Loading

0 comments on commit 6ab845b

Please sign in to comment.