Skip to content

Commit 56ec4fc

Browse files
feat: [google-cloud-batch] add block_project_ssh_keys field to the v1alpha job API to block project level ssh keys access to Batch created VMs (#12982)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add block_project_ssh_keys field to the v1alpha job API to block project level ssh keys access to Batch created VMs feat: remove visibility restriction of cancel job api, allow in v1alpha docs: Refine usage scope for field `task_execution` and `task_state` in `status_events` END_COMMIT_OVERRIDE --- feat: remove visibility restriction of cancel job api, allow in v1alpha --- feat: update Go Datastore import path feat: update Go Bigtable import path --- docs: Refine usage scope for field `task_execution` and `task_state` in `status_events` PiperOrigin-RevId: 659840586 Source-Link: googleapis/googleapis@d4acb64 Source-Link: googleapis/googleapis-gen@024a490 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiIwMjRhNDkwMDFkYjE2ZjBhNmIyNmIwNGRiYTBlMDBlNzkwNmJiNjdjIn0= BEGIN_NESTED_COMMIT docs: [google-cloud-batch] Refine usage scope for fields `task_execution` and `task_state` in StatusEvent PiperOrigin-RevId: 659685089 Source-Link: googleapis/googleapis@00ed8aa Source-Link: googleapis/googleapis-gen@85a9862 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiI4NWE5ODYyN2Y5ZTkwZWEyY2IwZTFjMDZlM2E0MTk1OTk0MmNhOTMwIn0= END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 477c8e4 commit 56ec4fc

23 files changed

+3494
-2023
lines changed

packages/google-cloud-batch/batch-v1-py.tar.gz

Whitespace-only changes.

packages/google-cloud-batch/google/cloud/batch/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__ = "0.17.23" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-batch/google/cloud/batch_v1/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__ = "0.17.23" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-batch/google/cloud/batch_v1/types/task.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ComputeResource(proto.Message):
109109

110110

111111
class StatusEvent(proto.Message):
112-
r"""Status event
112+
r"""Status event.
113113
114114
Attributes:
115115
type_ (str):
@@ -119,9 +119,13 @@ class StatusEvent(proto.Message):
119119
event_time (google.protobuf.timestamp_pb2.Timestamp):
120120
The time this event occurred.
121121
task_execution (google.cloud.batch_v1.types.TaskExecution):
122-
Task Execution
122+
Task Execution.
123+
This field is only defined for task-level status
124+
events where the task fails.
123125
task_state (google.cloud.batch_v1.types.TaskStatus.State):
124-
Task State
126+
Task State.
127+
This field is only defined for task-level status
128+
events.
125129
"""
126130

127131
type_: str = proto.Field(
@@ -179,11 +183,11 @@ class TaskExecution(proto.Message):
179183

180184

181185
class TaskStatus(proto.Message):
182-
r"""Status of a task
186+
r"""Status of a task.
183187
184188
Attributes:
185189
state (google.cloud.batch_v1.types.TaskStatus.State):
186-
Task state
190+
Task state.
187191
status_events (MutableSequence[google.cloud.batch_v1.types.StatusEvent]):
188192
Detailed info about why the state is reached.
189193
"""

packages/google-cloud-batch/google/cloud/batch_v1alpha/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
from .services.batch_service import BatchServiceAsyncClient, BatchServiceClient
2222
from .types.batch import (
23+
CancelJobRequest,
24+
CancelJobResponse,
2325
CreateJobRequest,
2426
CreateResourceAllowanceRequest,
2527
DeleteJobRequest,
@@ -76,6 +78,8 @@
7678
"AllocationPolicy",
7779
"BatchServiceClient",
7880
"CalendarPeriod",
81+
"CancelJobRequest",
82+
"CancelJobResponse",
7983
"ComputeResource",
8084
"CreateJobRequest",
8185
"CreateResourceAllowanceRequest",

packages/google-cloud-batch/google/cloud/batch_v1alpha/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"grpc": {
1111
"libraryClient": "BatchServiceClient",
1212
"rpcs": {
13+
"CancelJob": {
14+
"methods": [
15+
"cancel_job"
16+
]
17+
},
1318
"CreateJob": {
1419
"methods": [
1520
"create_job"
@@ -75,6 +80,11 @@
7580
"grpc-async": {
7681
"libraryClient": "BatchServiceAsyncClient",
7782
"rpcs": {
83+
"CancelJob": {
84+
"methods": [
85+
"cancel_job"
86+
]
87+
},
7888
"CreateJob": {
7989
"methods": [
8090
"create_job"
@@ -140,6 +150,11 @@
140150
"rest": {
141151
"libraryClient": "BatchServiceClient",
142152
"rpcs": {
153+
"CancelJob": {
154+
"methods": [
155+
"cancel_job"
156+
]
157+
},
143158
"CreateJob": {
144159
"methods": [
145160
"create_job"

packages/google-cloud-batch/google/cloud/batch_v1alpha/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__ = "0.17.23" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-batch/google/cloud/batch_v1alpha/services/batch_service/async_client.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,124 @@ async def sample_delete_job():
633633
# Done; return the response.
634634
return response
635635

636+
async def cancel_job(
637+
self,
638+
request: Optional[Union[batch.CancelJobRequest, dict]] = None,
639+
*,
640+
name: Optional[str] = None,
641+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
642+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
643+
metadata: Sequence[Tuple[str, str]] = (),
644+
) -> operation_async.AsyncOperation:
645+
r"""Cancel a Job.
646+
647+
.. code-block:: python
648+
649+
# This snippet has been automatically generated and should be regarded as a
650+
# code template only.
651+
# It will require modifications to work:
652+
# - It may require correct/in-range values for request initialization.
653+
# - It may require specifying regional endpoints when creating the service
654+
# client as shown in:
655+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
656+
from google.cloud import batch_v1alpha
657+
658+
async def sample_cancel_job():
659+
# Create a client
660+
client = batch_v1alpha.BatchServiceAsyncClient()
661+
662+
# Initialize request argument(s)
663+
request = batch_v1alpha.CancelJobRequest(
664+
name="name_value",
665+
)
666+
667+
# Make the request
668+
operation = client.cancel_job(request=request)
669+
670+
print("Waiting for operation to complete...")
671+
672+
response = (await operation).result()
673+
674+
# Handle the response
675+
print(response)
676+
677+
Args:
678+
request (Optional[Union[google.cloud.batch_v1alpha.types.CancelJobRequest, dict]]):
679+
The request object. CancelJob Request.
680+
name (:class:`str`):
681+
Required. Job name.
682+
This corresponds to the ``name`` field
683+
on the ``request`` instance; if ``request`` is provided, this
684+
should not be set.
685+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
686+
should be retried.
687+
timeout (float): The timeout for this request.
688+
metadata (Sequence[Tuple[str, str]]): Strings which should be
689+
sent along with the request as metadata.
690+
691+
Returns:
692+
google.api_core.operation_async.AsyncOperation:
693+
An object representing a long-running operation.
694+
695+
The result type for the operation will be
696+
:class:`google.cloud.batch_v1alpha.types.CancelJobResponse`
697+
Response to the CancelJob request.
698+
699+
"""
700+
# Create or coerce a protobuf request object.
701+
# - Quick check: If we got a request object, we should *not* have
702+
# gotten any keyword arguments that map to the request.
703+
has_flattened_params = any([name])
704+
if request is not None and has_flattened_params:
705+
raise ValueError(
706+
"If the `request` argument is set, then none of "
707+
"the individual field arguments should be set."
708+
)
709+
710+
# - Use the request object if provided (there's no risk of modifying the input as
711+
# there are no flattened fields), or create one.
712+
if not isinstance(request, batch.CancelJobRequest):
713+
request = batch.CancelJobRequest(request)
714+
715+
# If we have keyword arguments corresponding to fields on the
716+
# request, apply these.
717+
if name is not None:
718+
request.name = name
719+
720+
# Wrap the RPC method; this adds retry and timeout information,
721+
# and friendly error handling.
722+
rpc = self._client._transport._wrapped_methods[
723+
self._client._transport.cancel_job
724+
]
725+
726+
# Certain fields should be provided within the metadata header;
727+
# add these here.
728+
metadata = tuple(metadata) + (
729+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
730+
)
731+
732+
# Validate the universe domain.
733+
self._client._validate_universe_domain()
734+
735+
# Send the request.
736+
response = await rpc(
737+
request,
738+
retry=retry,
739+
timeout=timeout,
740+
metadata=metadata,
741+
)
742+
743+
# Wrap the response in an operation future.
744+
response = operation_async.from_gapic(
745+
response,
746+
self._client._transport.operations_client,
747+
batch.CancelJobResponse,
748+
metadata_type=batch.OperationMetadata,
749+
)
750+
751+
# Done; return the response.
752+
return response
753+
636754
async def update_job(
637755
self,
638756
request: Optional[Union[batch.UpdateJobRequest, dict]] = None,

packages/google-cloud-batch/google/cloud/batch_v1alpha/services/batch_service/client.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,121 @@ def sample_delete_job():
11091109
# Done; return the response.
11101110
return response
11111111

1112+
def cancel_job(
1113+
self,
1114+
request: Optional[Union[batch.CancelJobRequest, dict]] = None,
1115+
*,
1116+
name: Optional[str] = None,
1117+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1118+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1119+
metadata: Sequence[Tuple[str, str]] = (),
1120+
) -> operation.Operation:
1121+
r"""Cancel a Job.
1122+
1123+
.. code-block:: python
1124+
1125+
# This snippet has been automatically generated and should be regarded as a
1126+
# code template only.
1127+
# It will require modifications to work:
1128+
# - It may require correct/in-range values for request initialization.
1129+
# - It may require specifying regional endpoints when creating the service
1130+
# client as shown in:
1131+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1132+
from google.cloud import batch_v1alpha
1133+
1134+
def sample_cancel_job():
1135+
# Create a client
1136+
client = batch_v1alpha.BatchServiceClient()
1137+
1138+
# Initialize request argument(s)
1139+
request = batch_v1alpha.CancelJobRequest(
1140+
name="name_value",
1141+
)
1142+
1143+
# Make the request
1144+
operation = client.cancel_job(request=request)
1145+
1146+
print("Waiting for operation to complete...")
1147+
1148+
response = operation.result()
1149+
1150+
# Handle the response
1151+
print(response)
1152+
1153+
Args:
1154+
request (Union[google.cloud.batch_v1alpha.types.CancelJobRequest, dict]):
1155+
The request object. CancelJob Request.
1156+
name (str):
1157+
Required. Job name.
1158+
This corresponds to the ``name`` field
1159+
on the ``request`` instance; if ``request`` is provided, this
1160+
should not be set.
1161+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1162+
should be retried.
1163+
timeout (float): The timeout for this request.
1164+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1165+
sent along with the request as metadata.
1166+
1167+
Returns:
1168+
google.api_core.operation.Operation:
1169+
An object representing a long-running operation.
1170+
1171+
The result type for the operation will be
1172+
:class:`google.cloud.batch_v1alpha.types.CancelJobResponse`
1173+
Response to the CancelJob request.
1174+
1175+
"""
1176+
# Create or coerce a protobuf request object.
1177+
# - Quick check: If we got a request object, we should *not* have
1178+
# gotten any keyword arguments that map to the request.
1179+
has_flattened_params = any([name])
1180+
if request is not None and has_flattened_params:
1181+
raise ValueError(
1182+
"If the `request` argument is set, then none of "
1183+
"the individual field arguments should be set."
1184+
)
1185+
1186+
# - Use the request object if provided (there's no risk of modifying the input as
1187+
# there are no flattened fields), or create one.
1188+
if not isinstance(request, batch.CancelJobRequest):
1189+
request = batch.CancelJobRequest(request)
1190+
# If we have keyword arguments corresponding to fields on the
1191+
# request, apply these.
1192+
if name is not None:
1193+
request.name = name
1194+
1195+
# Wrap the RPC method; this adds retry and timeout information,
1196+
# and friendly error handling.
1197+
rpc = self._transport._wrapped_methods[self._transport.cancel_job]
1198+
1199+
# Certain fields should be provided within the metadata header;
1200+
# add these here.
1201+
metadata = tuple(metadata) + (
1202+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1203+
)
1204+
1205+
# Validate the universe domain.
1206+
self._validate_universe_domain()
1207+
1208+
# Send the request.
1209+
response = rpc(
1210+
request,
1211+
retry=retry,
1212+
timeout=timeout,
1213+
metadata=metadata,
1214+
)
1215+
1216+
# Wrap the response in an operation future.
1217+
response = operation.from_gapic(
1218+
response,
1219+
self._transport.operations_client,
1220+
batch.CancelJobResponse,
1221+
metadata_type=batch.OperationMetadata,
1222+
)
1223+
1224+
# Done; return the response.
1225+
return response
1226+
11121227
def update_job(
11131228
self,
11141229
request: Optional[Union[batch.UpdateJobRequest, dict]] = None,

packages/google-cloud-batch/google/cloud/batch_v1alpha/services/batch_service/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def _prep_wrapped_messages(self, client_info):
161161
default_timeout=60.0,
162162
client_info=client_info,
163163
),
164+
self.cancel_job: gapic_v1.method.wrap_method(
165+
self.cancel_job,
166+
default_timeout=60.0,
167+
client_info=client_info,
168+
),
164169
self.update_job: gapic_v1.method.wrap_method(
165170
self.update_job,
166171
default_timeout=60.0,
@@ -288,6 +293,15 @@ def delete_job(
288293
]:
289294
raise NotImplementedError()
290295

296+
@property
297+
def cancel_job(
298+
self,
299+
) -> Callable[
300+
[batch.CancelJobRequest],
301+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
302+
]:
303+
raise NotImplementedError()
304+
291305
@property
292306
def update_job(
293307
self,

0 commit comments

Comments
 (0)