Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [Tasks] remove BufferTask method which cannot be called from client libraries #6971

Merged
merged 2 commits into from
Jan 18, 2024
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
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 @@ -105,7 +103,7 @@
*
* @deprecated This class will be removed in the next major version update.
*/
class CloudTasksGapicClient

Check failure on line 106 in Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta2\Gapic\CloudTasksGapicClient#bufferTask() was removed

Check failure on line 106 in Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta2\Gapic\CloudTasksGapicClient#bufferTask() was removed

Check failure on line 106 in Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta2\Gapic\CloudTasksGapicClient#bufferTask() was removed
{
use GapicClientTrait;

Expand Down Expand Up @@ -456,77 +454,6 @@
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 All @@ -96,7 +94,7 @@
*
* @deprecated This class will be removed in the next major version update.
*/
class CloudTasksGapicClient

Check failure on line 97 in Tasks/src/V2beta3/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta3\Gapic\CloudTasksGapicClient#bufferTask() was removed

Check failure on line 97 in Tasks/src/V2beta3/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta3\Gapic\CloudTasksGapicClient#bufferTask() was removed

Check failure on line 97 in Tasks/src/V2beta3/Gapic/CloudTasksGapicClient.php

View workflow job for this annotation

GitHub Actions / backwards-compatibility-check

Method Google\Cloud\Tasks\V2beta3\Gapic\CloudTasksGapicClient#bufferTask() was removed
{
use GapicClientTrait;

Expand Down Expand Up @@ -387,77 +385,6 @@
$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
Loading