Skip to content

Commit 23e91f5

Browse files
fix: [google-cloud-tasks] remove BufferTask method which cannot be called from client libraries (#12204)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 599211253 Source-Link: googleapis/googleapis@1654062 Source-Link: googleapis/googleapis-gen@2055a53 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRhc2tzLy5Pd2xCb3QueWFtbCIsImgiOiIyMDU1YTUzM2FmMTU0ZGNjMjYzZDVjMGJjZDc4YWY4NGI0NGVmMzMyIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 9acf675 commit 23e91f5

36 files changed

Lines changed: 25 additions & 2813 deletions

packages/google-cloud-tasks/google/cloud/tasks/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.15.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-tasks/google/cloud/tasks_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.15.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
from .services.cloud_tasks import CloudTasksAsyncClient, CloudTasksClient
2222
from .types.cloudtasks import (
2323
AcknowledgeTaskRequest,
24-
BufferTaskRequest,
25-
BufferTaskResponse,
2624
CancelLeaseRequest,
2725
CreateQueueRequest,
2826
CreateTaskRequest,
@@ -69,8 +67,6 @@
6967
"AppEngineHttpTarget",
7068
"AppEngineRouting",
7169
"AttemptStatus",
72-
"BufferTaskRequest",
73-
"BufferTaskResponse",
7470
"CancelLeaseRequest",
7571
"CloudTasksClient",
7672
"CreateQueueRequest",

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/gapic_metadata.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
"acknowledge_task"
1616
]
1717
},
18-
"BufferTask": {
19-
"methods": [
20-
"buffer_task"
21-
]
22-
},
2318
"CancelLease": {
2419
"methods": [
2520
"cancel_lease"
@@ -130,11 +125,6 @@
130125
"acknowledge_task"
131126
]
132127
},
133-
"BufferTask": {
134-
"methods": [
135-
"buffer_task"
136-
]
137-
},
138128
"CancelLease": {
139129
"methods": [
140130
"cancel_lease"
@@ -245,11 +235,6 @@
245235
"acknowledge_task"
246236
]
247237
},
248-
"BufferTask": {
249-
"methods": [
250-
"buffer_task"
251-
]
252-
},
253238
"CancelLease": {
254239
"methods": [
255240
"cancel_lease"

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.15.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
except AttributeError: # pragma: NO COVER
4343
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
4444

45-
from google.api import httpbody_pb2 # type: ignore
4645
from google.cloud.location import locations_pb2 # type: ignore
4746
from google.iam.v1 import iam_policy_pb2 # type: ignore
4847
from google.iam.v1 import policy_pb2 # type: ignore
@@ -2876,149 +2875,6 @@ async def sample_run_task():
28762875
# Done; return the response.
28772876
return response
28782877

2879-
async def buffer_task(
2880-
self,
2881-
request: Optional[Union[cloudtasks.BufferTaskRequest, dict]] = None,
2882-
*,
2883-
queue: Optional[str] = None,
2884-
task_id: Optional[str] = None,
2885-
body: Optional[httpbody_pb2.HttpBody] = None,
2886-
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2887-
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2888-
metadata: Sequence[Tuple[str, str]] = (),
2889-
) -> cloudtasks.BufferTaskResponse:
2890-
r"""Creates and buffers a new task without the need to explicitly
2891-
define a Task message. The queue must have [HTTP
2892-
target][google.cloud.tasks.v2beta2.HttpTarget]. To create the
2893-
task with a custom ID, use the following format and set TASK_ID
2894-
to your desired ID:
2895-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
2896-
To create the task with an automatically generated ID, use the
2897-
following format:
2898-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
2899-
Note: This feature is in its experimental stage. You must
2900-
request access to the API through the `Cloud Tasks BufferTask
2901-
Experiment Signup form <https://forms.gle/X8Zr5hiXH5tTGFqh8>`__.
2902-
2903-
.. code-block:: python
2904-
2905-
# This snippet has been automatically generated and should be regarded as a
2906-
# code template only.
2907-
# It will require modifications to work:
2908-
# - It may require correct/in-range values for request initialization.
2909-
# - It may require specifying regional endpoints when creating the service
2910-
# client as shown in:
2911-
# https://googleapis.dev/python/google-api-core/latest/client_options.html
2912-
from google.cloud import tasks_v2beta2
2913-
2914-
async def sample_buffer_task():
2915-
# Create a client
2916-
client = tasks_v2beta2.CloudTasksAsyncClient()
2917-
2918-
# Initialize request argument(s)
2919-
request = tasks_v2beta2.BufferTaskRequest(
2920-
queue="queue_value",
2921-
)
2922-
2923-
# Make the request
2924-
response = await client.buffer_task(request=request)
2925-
2926-
# Handle the response
2927-
print(response)
2928-
2929-
Args:
2930-
request (Optional[Union[google.cloud.tasks_v2beta2.types.BufferTaskRequest, dict]]):
2931-
The request object. LINT.IfChange Request message for
2932-
[BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
2933-
queue (:class:`str`):
2934-
Required. The parent queue name. For example:
2935-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID\`
2936-
2937-
The queue must already exist.
2938-
2939-
This corresponds to the ``queue`` field
2940-
on the ``request`` instance; if ``request`` is provided, this
2941-
should not be set.
2942-
task_id (:class:`str`):
2943-
Optional. Task ID for the task being
2944-
created. If not provided, a random task
2945-
ID is assigned to the task.
2946-
2947-
This corresponds to the ``task_id`` field
2948-
on the ``request`` instance; if ``request`` is provided, this
2949-
should not be set.
2950-
body (:class:`google.api.httpbody_pb2.HttpBody`):
2951-
Optional. Body of the HTTP request.
2952-
2953-
The body can take any generic value. The value is
2954-
written to the [HttpRequest][payload] of the [Task].
2955-
2956-
This corresponds to the ``body`` field
2957-
on the ``request`` instance; if ``request`` is provided, this
2958-
should not be set.
2959-
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2960-
should be retried.
2961-
timeout (float): The timeout for this request.
2962-
metadata (Sequence[Tuple[str, str]]): Strings which should be
2963-
sent along with the request as metadata.
2964-
2965-
Returns:
2966-
google.cloud.tasks_v2beta2.types.BufferTaskResponse:
2967-
Response message for
2968-
[BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
2969-
2970-
"""
2971-
# Create or coerce a protobuf request object.
2972-
# Quick check: If we got a request object, we should *not* have
2973-
# gotten any keyword arguments that map to the request.
2974-
has_flattened_params = any([queue, task_id, body])
2975-
if request is not None and has_flattened_params:
2976-
raise ValueError(
2977-
"If the `request` argument is set, then none of "
2978-
"the individual field arguments should be set."
2979-
)
2980-
2981-
request = cloudtasks.BufferTaskRequest(request)
2982-
2983-
# If we have keyword arguments corresponding to fields on the
2984-
# request, apply these.
2985-
if queue is not None:
2986-
request.queue = queue
2987-
if task_id is not None:
2988-
request.task_id = task_id
2989-
if body is not None:
2990-
request.body = body
2991-
2992-
# Wrap the RPC method; this adds retry and timeout information,
2993-
# and friendly error handling.
2994-
rpc = gapic_v1.method_async.wrap_method(
2995-
self._client._transport.buffer_task,
2996-
default_timeout=20.0,
2997-
client_info=DEFAULT_CLIENT_INFO,
2998-
)
2999-
3000-
# Certain fields should be provided within the metadata header;
3001-
# add these here.
3002-
metadata = tuple(metadata) + (
3003-
gapic_v1.routing_header.to_grpc_metadata(
3004-
(
3005-
("queue", request.queue),
3006-
("task_id", request.task_id),
3007-
)
3008-
),
3009-
)
3010-
3011-
# Send the request.
3012-
response = await rpc(
3013-
request,
3014-
retry=retry,
3015-
timeout=timeout,
3016-
metadata=metadata,
3017-
)
3018-
3019-
# Done; return the response.
3020-
return response
3021-
30222878
async def get_location(
30232879
self,
30242880
request: Optional[locations_pb2.GetLocationRequest] = None,

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/client.py

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
except AttributeError: # pragma: NO COVER
4747
OptionalRetry = Union[retries.Retry, object] # type: ignore
4848

49-
from google.api import httpbody_pb2 # type: ignore
5049
from google.cloud.location import locations_pb2 # type: ignore
5150
from google.iam.v1 import iam_policy_pb2 # type: ignore
5251
from google.iam.v1 import policy_pb2 # type: ignore
@@ -3044,149 +3043,6 @@ def sample_run_task():
30443043
# Done; return the response.
30453044
return response
30463045

3047-
def buffer_task(
3048-
self,
3049-
request: Optional[Union[cloudtasks.BufferTaskRequest, dict]] = None,
3050-
*,
3051-
queue: Optional[str] = None,
3052-
task_id: Optional[str] = None,
3053-
body: Optional[httpbody_pb2.HttpBody] = None,
3054-
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3055-
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3056-
metadata: Sequence[Tuple[str, str]] = (),
3057-
) -> cloudtasks.BufferTaskResponse:
3058-
r"""Creates and buffers a new task without the need to explicitly
3059-
define a Task message. The queue must have [HTTP
3060-
target][google.cloud.tasks.v2beta2.HttpTarget]. To create the
3061-
task with a custom ID, use the following format and set TASK_ID
3062-
to your desired ID:
3063-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
3064-
To create the task with an automatically generated ID, use the
3065-
following format:
3066-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
3067-
Note: This feature is in its experimental stage. You must
3068-
request access to the API through the `Cloud Tasks BufferTask
3069-
Experiment Signup form <https://forms.gle/X8Zr5hiXH5tTGFqh8>`__.
3070-
3071-
.. code-block:: python
3072-
3073-
# This snippet has been automatically generated and should be regarded as a
3074-
# code template only.
3075-
# It will require modifications to work:
3076-
# - It may require correct/in-range values for request initialization.
3077-
# - It may require specifying regional endpoints when creating the service
3078-
# client as shown in:
3079-
# https://googleapis.dev/python/google-api-core/latest/client_options.html
3080-
from google.cloud import tasks_v2beta2
3081-
3082-
def sample_buffer_task():
3083-
# Create a client
3084-
client = tasks_v2beta2.CloudTasksClient()
3085-
3086-
# Initialize request argument(s)
3087-
request = tasks_v2beta2.BufferTaskRequest(
3088-
queue="queue_value",
3089-
)
3090-
3091-
# Make the request
3092-
response = client.buffer_task(request=request)
3093-
3094-
# Handle the response
3095-
print(response)
3096-
3097-
Args:
3098-
request (Union[google.cloud.tasks_v2beta2.types.BufferTaskRequest, dict]):
3099-
The request object. LINT.IfChange Request message for
3100-
[BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
3101-
queue (str):
3102-
Required. The parent queue name. For example:
3103-
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID\`
3104-
3105-
The queue must already exist.
3106-
3107-
This corresponds to the ``queue`` field
3108-
on the ``request`` instance; if ``request`` is provided, this
3109-
should not be set.
3110-
task_id (str):
3111-
Optional. Task ID for the task being
3112-
created. If not provided, a random task
3113-
ID is assigned to the task.
3114-
3115-
This corresponds to the ``task_id`` field
3116-
on the ``request`` instance; if ``request`` is provided, this
3117-
should not be set.
3118-
body (google.api.httpbody_pb2.HttpBody):
3119-
Optional. Body of the HTTP request.
3120-
3121-
The body can take any generic value. The value is
3122-
written to the [HttpRequest][payload] of the [Task].
3123-
3124-
This corresponds to the ``body`` field
3125-
on the ``request`` instance; if ``request`` is provided, this
3126-
should not be set.
3127-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
3128-
should be retried.
3129-
timeout (float): The timeout for this request.
3130-
metadata (Sequence[Tuple[str, str]]): Strings which should be
3131-
sent along with the request as metadata.
3132-
3133-
Returns:
3134-
google.cloud.tasks_v2beta2.types.BufferTaskResponse:
3135-
Response message for
3136-
[BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
3137-
3138-
"""
3139-
# Create or coerce a protobuf request object.
3140-
# Quick check: If we got a request object, we should *not* have
3141-
# gotten any keyword arguments that map to the request.
3142-
has_flattened_params = any([queue, task_id, body])
3143-
if request is not None and has_flattened_params:
3144-
raise ValueError(
3145-
"If the `request` argument is set, then none of "
3146-
"the individual field arguments should be set."
3147-
)
3148-
3149-
# Minor optimization to avoid making a copy if the user passes
3150-
# in a cloudtasks.BufferTaskRequest.
3151-
# There's no risk of modifying the input as we've already verified
3152-
# there are no flattened fields.
3153-
if not isinstance(request, cloudtasks.BufferTaskRequest):
3154-
request = cloudtasks.BufferTaskRequest(request)
3155-
# If we have keyword arguments corresponding to fields on the
3156-
# request, apply these.
3157-
if queue is not None:
3158-
request.queue = queue
3159-
if task_id is not None:
3160-
request.task_id = task_id
3161-
if body is not None:
3162-
request.body = body
3163-
3164-
# Wrap the RPC method; this adds retry and timeout information,
3165-
# and friendly error handling.
3166-
rpc = self._transport._wrapped_methods[self._transport.buffer_task]
3167-
3168-
# Certain fields should be provided within the metadata header;
3169-
# add these here.
3170-
metadata = tuple(metadata) + (
3171-
gapic_v1.routing_header.to_grpc_metadata(
3172-
(
3173-
("queue", request.queue),
3174-
("task_id", request.task_id),
3175-
)
3176-
),
3177-
)
3178-
3179-
# Send the request.
3180-
response = rpc(
3181-
request,
3182-
retry=retry,
3183-
timeout=timeout,
3184-
metadata=metadata,
3185-
)
3186-
3187-
# Done; return the response.
3188-
return response
3189-
31903046
def __enter__(self) -> "CloudTasksClient":
31913047
return self
31923048

0 commit comments

Comments
 (0)