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!: [cloudtasks] remove BufferTask method which cannot be called from client libraries #10232

Merged
merged 2 commits into from Jan 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions java-tasks/README.md
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.29.0</version>
<version>26.30.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-tasks.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-tasks/2.32.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-tasks/2.33.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.tasks.v2beta2;

import com.google.api.HttpBody;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
Expand Down Expand Up @@ -518,25 +517,6 @@
* </td>
* </tr>
* <tr>
* <td>BufferTask</td>
* <td><p> 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).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li>bufferTask(BufferTaskRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li>bufferTask(QueueName queue, String taskId, HttpBody body)
* <li>bufferTask(String queue, String taskId, HttpBody body)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li>bufferTaskCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td>ListLocations</td>
* <td><p> Lists information about the supported locations for this service.</td>
* <td>
Expand Down Expand Up @@ -3881,170 +3861,6 @@ public final UnaryCallable<RunTaskRequest, Task> runTaskCallable() {
return stub.runTaskCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
* QueueName queue = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
* String taskId = "taskId-880873088";
* HttpBody body = HttpBody.newBuilder().build();
* BufferTaskResponse response = cloudTasksClient.bufferTask(queue, taskId, body);
* }
* }</pre>
*
* @param queue Required. The parent queue name. For example:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
* <p>The queue must already exist.
* @param taskId Optional. Task ID for the task being created. If not provided, a random task ID
* is assigned to the task.
* @param body Optional. Body of the HTTP request.
* <p>The body can take any generic value. The value is written to the [HttpRequest][payload]
* of the [Task].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BufferTaskResponse bufferTask(QueueName queue, String taskId, HttpBody body) {
BufferTaskRequest request =
BufferTaskRequest.newBuilder()
.setQueue(queue == null ? null : queue.toString())
.setTaskId(taskId)
.setBody(body)
.build();
return bufferTask(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
* String queue = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString();
* String taskId = "taskId-880873088";
* HttpBody body = HttpBody.newBuilder().build();
* BufferTaskResponse response = cloudTasksClient.bufferTask(queue, taskId, body);
* }
* }</pre>
*
* @param queue Required. The parent queue name. For example:
* projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
* <p>The queue must already exist.
* @param taskId Optional. Task ID for the task being created. If not provided, a random task ID
* is assigned to the task.
* @param body Optional. Body of the HTTP request.
* <p>The body can take any generic value. The value is written to the [HttpRequest][payload]
* of the [Task].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BufferTaskResponse bufferTask(String queue, String taskId, HttpBody body) {
BufferTaskRequest request =
BufferTaskRequest.newBuilder().setQueue(queue).setTaskId(taskId).setBody(body).build();
return bufferTask(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
* BufferTaskRequest request =
* BufferTaskRequest.newBuilder()
* .setQueue(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString())
* .setTaskId("taskId-880873088")
* .setBody(HttpBody.newBuilder().build())
* .build();
* BufferTaskResponse response = cloudTasksClient.bufferTask(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BufferTaskResponse bufferTask(BufferTaskRequest request) {
return bufferTaskCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
* BufferTaskRequest request =
* BufferTaskRequest.newBuilder()
* .setQueue(QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]").toString())
* .setTaskId("taskId-880873088")
* .setBody(HttpBody.newBuilder().build())
* .build();
* ApiFuture<BufferTaskResponse> future =
* cloudTasksClient.bufferTaskCallable().futureCall(request);
* // Do something.
* BufferTaskResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<BufferTaskRequest, BufferTaskResponse> bufferTaskCallable() {
return stub.bufferTaskCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Expand Up @@ -195,11 +195,6 @@ public UnaryCallSettings<RunTaskRequest, Task> runTaskSettings() {
return ((CloudTasksStubSettings) getStubSettings()).runTaskSettings();
}

/** Returns the object with the settings used for calls to bufferTask. */
public UnaryCallSettings<BufferTaskRequest, BufferTaskResponse> bufferTaskSettings() {
return ((CloudTasksStubSettings) getStubSettings()).bufferTaskSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -433,11 +428,6 @@ public UnaryCallSettings.Builder<RunTaskRequest, Task> runTaskSettings() {
return getStubSettingsBuilder().runTaskSettings();
}

/** Returns the builder for the settings used for calls to bufferTask. */
public UnaryCallSettings.Builder<BufferTaskRequest, BufferTaskResponse> bufferTaskSettings() {
return getStubSettingsBuilder().bufferTaskSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Expand Up @@ -13,9 +13,6 @@
"AcknowledgeTask": {
"methods": ["acknowledgeTask", "acknowledgeTask", "acknowledgeTask", "acknowledgeTaskCallable"]
},
"BufferTask": {
"methods": ["bufferTask", "bufferTask", "bufferTask", "bufferTaskCallable"]
},
"CancelLease": {
"methods": ["cancelLease", "cancelLease", "cancelLease", "cancelLeaseCallable"]
},
Expand Down
Expand Up @@ -28,8 +28,6 @@
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.tasks.v2beta2.AcknowledgeTaskRequest;
import com.google.cloud.tasks.v2beta2.BufferTaskRequest;
import com.google.cloud.tasks.v2beta2.BufferTaskResponse;
import com.google.cloud.tasks.v2beta2.CancelLeaseRequest;
import com.google.cloud.tasks.v2beta2.CreateQueueRequest;
import com.google.cloud.tasks.v2beta2.CreateTaskRequest;
Expand Down Expand Up @@ -163,10 +161,6 @@ public UnaryCallable<RunTaskRequest, Task> runTaskCallable() {
throw new UnsupportedOperationException("Not implemented: runTaskCallable()");
}

public UnaryCallable<BufferTaskRequest, BufferTaskResponse> bufferTaskCallable() {
throw new UnsupportedOperationException("Not implemented: bufferTaskCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down