Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ final class CloudTasksClientWrapper {
static final String METADATA_ZONE_URL =
"http://metadata.google.internal/computeMetadata/v1/instance/zone";
static final String CLOUD_TASKS_LOCATIONS_URL_FORMAT =
"https://cloudtasks.googleapis.com/v2beta3/projects/%s/locations";
"https://cloudtasks.googleapis.com/v2/projects/%s/locations";
static final String JSON_FIELD_LOCATIONS = "locations";
static final String JSON_FIELD_LOCATION_ID = "locationId";
static final String DEFAULT_LOCATION = "us-central1";
Expand Down Expand Up @@ -639,7 +639,7 @@ private static Future<List<TaskHandle>> enqueueNonTransactional(
return CompletableFuture.completedFuture(ImmutableList.of());
}

// Batch create via v2beta3 REST endpoint when multiple tasks are enqueued
// Batch create via v2 REST endpoint when multiple tasks are enqueued
if (taskOptionsList.size() > 1) {
return CompletableFuture.supplyAsync(
() -> {
Expand All @@ -657,7 +657,7 @@ private static Future<List<TaskHandle>> enqueueNonTransactional(
});
}

// Single task creation via v2beta3 REST endpoint
// Single task creation via v2 REST endpoint
TaskOptions singleOpt = taskOptionsList.get(0);
return CompletableFuture.supplyAsync(
() -> {
Expand Down Expand Up @@ -932,7 +932,7 @@ static Future<List<Boolean>> deleteTaskAsync(
}

/**
* Asynchronously deletes one or more tasks by string task name from Cloud Tasks. Uses v2beta3
* Asynchronously deletes one or more tasks by string task name from Cloud Tasks. Uses v2
* BatchDeleteTasks REST for multiple tasks and official Client SDK for single tasks.
*
* @param queueName the short name of the target App Engine queue
Expand All @@ -946,7 +946,7 @@ static Future<List<Boolean>> deleteTaskByNameAsync(
}
String effectiveQueue = isNullOrEmpty(queueName) ? DEFAULT_QUEUE_NAME : queueName;

// Batch delete via v2beta3 REST endpoint when multiple tasks are deleted
// Batch delete via v2 REST endpoint when multiple tasks are deleted
if (taskNames.size() > 1) {
return CompletableFuture.supplyAsync(() -> batchDeleteTasksRest(effectiveQueue, taskNames));
}
Expand Down Expand Up @@ -1036,6 +1036,7 @@ static Future<QueueStatistics> fetchStatisticsAsync(String queueName) {

try {
String token = getValidAccessToken();
// Queue statistics are fetched via Cloud Tasks v2beta3 (retained for QueueStats)
String restUrl =
"https://cloudtasks.googleapis.com/v2beta3/projects/"
+ projectId
Expand Down Expand Up @@ -1285,7 +1286,7 @@ private static TaskHandle createTaskRest(String effectiveQueue, TaskOptions opti
String location = getLocation();
String parentQueue =
"projects/" + projectId + "/locations/" + location + "/queues/" + effectiveQueue;
String urlStr = "https://cloudtasks.googleapis.com/v2beta3/" + parentQueue + "/tasks";
String urlStr = "https://cloudtasks.googleapis.com/v2/" + parentQueue + "/tasks";

JsonObject rootJson = new JsonObject();
JsonObject taskObj = buildTaskJsonObject(parentQueue, options.getTaskName(), options);
Expand Down Expand Up @@ -1340,7 +1341,7 @@ private static List<TaskHandle> batchCreateTasksRest(
String parentQueue =
"projects/" + projectId + "/locations/" + location + "/queues/" + effectiveQueue;
String urlStr =
"https://cloudtasks.googleapis.com/v2beta3/" + parentQueue + "/tasks:batchCreate";
"https://cloudtasks.googleapis.com/v2/" + parentQueue + "/tasks:batchCreate";

JsonObject rootJson = new JsonObject();
JsonArray requestsArray = new JsonArray();
Expand Down Expand Up @@ -1422,7 +1423,7 @@ private static List<Boolean> batchDeleteTasksRest(String effectiveQueue, List<St
String parentQueue =
"projects/" + projectId + "/locations/" + location + "/queues/" + effectiveQueue;
String urlStr =
"https://cloudtasks.googleapis.com/v2beta3/" + parentQueue + "/tasks:batchDelete";
"https://cloudtasks.googleapis.com/v2/" + parentQueue + "/tasks:batchDelete";

try {
JsonObject rootJson = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private TaskProcessor() {}
static final String HEADER_CONTENT_TYPE = "Content-Type";
static final String VALUE_APPLICATION_JSON = "application/json";
static final String CLOUD_TASKS_LOCATIONS_URL_FORMAT =
"https://cloudtasks.googleapis.com/v2beta3/projects/%s/locations";
"https://cloudtasks.googleapis.com/v2/projects/%s/locations";
static final String JSON_FIELD_LOCATIONS = "locations";
static final String JSON_FIELD_LOCATION_ID = "locationId";
static final String DEFAULT_LOCATION = "us-central1";
Expand Down Expand Up @@ -611,7 +611,7 @@ static ErrorCode dispatchPendingTask(
String effectiveQueue = isNullOrEmpty(queueName) ? DEFAULT_QUEUE_NAME : queueName;
String parentQueue =
"projects/" + projectId + "/locations/" + location + "/queues/" + effectiveQueue;
String urlStr = "https://cloudtasks.googleapis.com/v2beta3/" + parentQueue + "/tasks";
String urlStr = "https://cloudtasks.googleapis.com/v2/" + parentQueue + "/tasks";

try {
String token = getValidAccessToken();
Expand Down